MultiGridCell class documentation

Authors

Generated by pauljohn

Contents -

  1. Software documentation for the MultiGridCell class
  2. Software documentation for the AppCell protocol

Software documentation for the MultiGridCell class

MultiGridCell : SwarmObject

Declared in:
MultiGridCell.h
Conforms to:
AppCell

The MultiGrid2d class is a grid of cells. If your cells do not need to do anything fancy, and if you are happy to use a Swarm list as your collection for each cell, then you can use MultiGridCell as the cell type in your MultiGrid2d. If you need a fancy type of cell, I urge you to build your "AppSpecificCell" as a subclass of MultiGridCell. You inherit the methods that do the grunt work, and then you add only the fancy ones to do your special things in your program.


Instance Variables

Method summary

createCollection 

- (id) createCollection;

Create the collection that will be used in this cell. If you don't want a Swarm List to be used, you must subclass and override this method.


createEnd 

- (id) createEnd;

Description forthcoming.


deleteAllItems 

- (void) deleteAllItems;

Tells the collection to destroy all items (drop them from memory)


getAtOffset: 

- (id) getAtOffset: (unsigned)offset;

Returns a pointer to the object at the indicated offset in the list


getCellValue 

- (long) getCellValue;

Just returns 0. If you need something that has substantive meaning, override it in your subclass.


getCollection 

- (id) getCollection;

Returns a pointer to the collection that this cell holds. If you build your application-specific cell as a sublcass from MultiGridCell, generally, you don't have to override this one.


getCount 

- (unsigned) getCount;

Return the number of items in the cell's collection. If you build your application-specific cell as a sublcass from MultiGridCell, generally, you don't have to override this one.


getFirst 

- (id) getFirst;

Tells the collection to return a pointer to its first item


getLast 

- (id) getLast;

Tells the collection to return a pointer to its last item


getRandomItem 

- (id) getRandomItem;

Selects an item from the collection at random (all are equally likely) and returns a pointer to it. The item is not removed from the collection


getX 

- (unsigned) getX;

Return the X coordinate at which the cell resides. If you build your application-specific cell as a sublcass from MultiGridCell, generally, you don't have to override this one.


getY 

- (unsigned) getY;

Return the Y coordinate at which the cell resides. If you build your application-specific cell as a sublcass from MultiGridCell, generally, you don't have to override this one.


initializeAllValues 

- (id) initializeAllValues;

This method does nothing, because by default the cells don't have any values that need initializing. If you cells have values in them, be sure to override this!


insertItem: 

- (BOOL) insertItem: (id)obj;

insertItem will insert the new object into the beginning of the collection. If your collection is somehow special and does not allow items to be added at the first part, or if you want something else to happen when your object is inserted, then subclass and override.


insertItem: Key: 

- (BOOL) insertItem: (id)obj1 Key: (id)obj2;

Subclass must override this because Swarm Lists don't use keys. But some collections do need keys, so this method is here.


performForEach: 

- (id) performForEach: (SEL)aSel;

If one wants each item in the cell to perform a particular action, this is the way to do it. Just pass through a selector.


performForEach: with: 

- (id) performForEach: (SEL)aSel with: (id)anObject;

If one wants each item in the cell to perform a particular action, and method that is represented by the selector takes an additional argument, this is the way to do it. Just pass through a selector and the argument. The argument must be an object.


remove: 

- (id) remove: (id)anObj;

Removes the requested object from the collection. Returns nil if that object is not in the list.


removeAllItems 

- (void) removeAllItems;

Removes all items from the collection. Returns nil if that object is not in the list.


removeAtOffset: 

- (id) removeAtOffset: (unsigned)offset;

Remove the Nth item, N=0,...,count-1, from the collection


removeFirst 

- (id) removeFirst;

Removes and returns the first item from the collection. Returns nil if the collection has no items.


removeLast 

- (id) removeLast;

Removes and returns the last item from the collection. Returns nil if the collection has no items.


removeRandomItem 

- (id) removeRandomItem;

Selects an item from the collection at random (all are equally likely) and removes it from the collection and returns it.


setX: 

- (id) setX: (unsigned)theX;

This tells the cell that its X coordinate is theX. If you build your application-specific cell as a sublcass from MultiGridCell, generally, you don't have to override this one.


setX: Y: 

- (id) setX: (unsigned)theX Y: (unsigned)theY;

This tells the cell that its coordinates are ( theX, theY). If you build your application-specific cell as a sublcass from MultiGridCell, generally, you don't have to override this one.


setY: 

- (id) setY: (unsigned)theY;

This tells the cell that its Y coordinate is theY. If you build your application-specific cell as a sublcass from MultiGridCell, generally, you don't have to override this one.




Instance Variables for MultiGridCell Class

list

@protected id list;

Description forthcoming.


x

@protected int x;

Description forthcoming.





Software documentation for the AppCell protocol

AppCell

Declared in:
MultiGridCell.h

Since we assume specific applications will need to customize the behavior of the cells, this protocol is used to assure our grid that the cells are good enough to get the job done.

Method summary

createCollection 

- (id) createCollection;

Description forthcoming.


createEnd 

- (id) createEnd;

Description forthcoming.


deleteAllItems 

- (void) deleteAllItems;

Description forthcoming.


getAtOffset: 

- (id) getAtOffset: (unsigned)offset;

Description forthcoming.


getCellValue 

- (long) getCellValue;

Description forthcoming.


getCollection 

- (id) getCollection;

Description forthcoming.


getCount 

- (unsigned) getCount;

Description forthcoming.


getFirst 

- (id) getFirst;

Description forthcoming.


getLast 

- (id) getLast;

Description forthcoming.


getRandomItem 

- (id) getRandomItem;

Description forthcoming.


getX 

- (unsigned) getX;

Description forthcoming.


getY 

- (unsigned) getY;

Description forthcoming.


initializeAllValues 

- (id) initializeAllValues;

Description forthcoming.


insertItem: 

- (BOOL) insertItem: (id)obj;

Description forthcoming.


insertItem: Key: 

- (BOOL) insertItem: (id)obj1 Key: (id)obj2;

Description forthcoming.


perform: 

- (id) perform: (SEL)aSel;

Description forthcoming.


perform: with: 

- (id) perform: (SEL)aSel with: (id)anObject;

Description forthcoming.


performForEach: 

- (id) performForEach: (SEL)aSel;

Description forthcoming.


performForEach: with: 

- (id) performForEach: (SEL)aSel with: (id)anObject;

Description forthcoming.


remove: 

- (id) remove: (id)anObj;

Description forthcoming.


removeAllItems 

- (void) removeAllItems;

Description forthcoming.


removeAtOffset: 

- (id) removeAtOffset: (unsigned)offset;

Description forthcoming.


removeFirst 

- (id) removeFirst;

Description forthcoming.


removeLast 

- (id) removeLast;

Description forthcoming.


removeRandomItem 

- (id) removeRandomItem;

Description forthcoming.


setX: 

- (id) setX: (unsigned)theX;

Description forthcoming.


setX: Y: 

- (id) setX: (unsigned)theX Y: (unsigned)theY;

Description forthcoming.


setY: 

- (id) setY: (unsigned)theY;

Description forthcoming.