P2Array

Holds a collection of Ponder2 objects. An array may be returned from sending a message to an object or or may be created in PonderTalk with the

 #( obj1 obj2 obj3) 
syntax.

Factory Messages
OperationDescription

Operational Messages
OperationReturnDescription
asHash P2Hash Returns a Hash comprising of the array contents taken as key, value pairs
do: aBlock self for each object in the array executes aBlock with the object given as an argument to the block. Answers the receiver
collect: aBlock P2Array for each entry in the array executes aBlock with the entry given as an argument to the block. Answers an array of answers built from each execution of the block.
add: aP2Object self adds a aP2Object to the receiver. Answers the receiver
addAll: anArray self adds all objects in anArray to the receiver. Answers the receiver
at: anIndex P2Object returns the object at anIndex
at: anIndex put: aP2Object P2Object inserts aP2Object at anIndex posiion in the array. Returns the object added.
size int returns the number of elements in the receiver
has: anIndex boolean returns true if the array an element at anIndex. This is really here to compliment the other collections and the remove: operations.
hasObject: aP2Object boolean returns true if the array contains aP2Object
remove: anIndex P2Object Answer the value associated with the given index and remove it from the receiver.
removeObject: anObject boolean Removes anObject from the receiver. All copies of anObject will be removed. Answers true if one or more were removed.
removeAll self Removes all objects stored in the receiver. Answers self.