|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.ponder2.objects.P2Object
net.ponder2.objects.P2Array
public class 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.
Constructor Summary | |
---|---|
P2Array()
creates an empty P2Array |
|
P2Array(int... values)
creates a P2Array initialised with int values |
|
P2Array(P2Object... values)
creates a P2Array initialised with values |
|
P2Array(java.lang.String... values)
creates a P2Array initialised with string values |
Method Summary | |
---|---|
void |
add(P2Object aP2Object)
adds a aP2Object to the receiver. |
void |
addAll(P2Array anArray)
adds all objects in anArray to the receiver. |
P2Object[] |
asArray()
Returns itself as an array of Ponder2 objects |
P2Hash |
asHash()
Returns a Hash comprising of the array contents taken as key, value pairs |
P2Array |
asP2Array()
Returns itself as a Ponder2 Array |
P2Object |
at(int anIndex)
returns the object at anIndex |
P2Object |
atput(int anIndex,
P2Object aP2Object)
inserts aP2Object at anIndex posiion in the array. |
java.util.Vector<P2Object> |
getValues()
Returns all the values in the array as a Vector |
boolean |
has(int anIndex)
returns true if the array an element at anIndex. |
boolean |
hasObject(P2Object aP2Object)
returns true if the array contains aP2Object |
P2Array |
operation_collect(P2Object source,
P2Block aBlock)
for each entry in the array executes aBlock with the entry given as an argument to the block. |
void |
operation_do(P2Object source,
P2Block aBlock)
for each object in the array executes aBlock with the object given as an argument to the block. |
protected void |
operation_removeAll()
Removes all objects stored in the receiver. |
P2Object |
readXml(com.twicom.qdparser.TaggedElement xml,
java.util.Map<java.lang.Integer,P2Serializable> read)
|
protected P2Object |
remove(int anIndex)
Answer the value associated with the given index and remove it from the receiver. |
protected boolean |
removeObject(P2Object anObject)
Removes anObject from the receiver. |
int |
size()
returns the number of elements in the receiver |
java.lang.String |
toString()
|
com.twicom.qdparser.TaggedElement |
writeXml(java.util.Set<P2Object> written)
|
Methods inherited from class net.ponder2.objects.P2Object |
---|
asBlock, asBoolean, asClass, asDouble, asFloat, asInteger, asLong, asNumber, asString, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, fromXml, getManagedObject, getOID, getSMC, operation, operation, setSMC |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public P2Array()
public P2Array(P2Object... values)
values
- the values to use to initialise the arraypublic P2Array(java.lang.String... values)
values
- the values to use to initialise the arraypublic P2Array(int... values)
values
- the values to use to initialise the arrayMethod Detail |
---|
public P2Object[] asArray() throws Ponder2ArgumentException
P2Object
asArray
in class P2Object
Ponder2ArgumentException
public P2Array asP2Array() throws Ponder2ArgumentException
P2Object
asP2Array
in class P2Object
Ponder2ArgumentException
public P2Hash asHash() throws Ponder2ArgumentException, Ponder2OperationException
asHash
in class P2Object
Ponder2ArgumentException
Ponder2OperationException
P2Object.asHash()
public void operation_do(P2Object source, P2Block aBlock) throws Ponder2Exception
source
- the originator of the commandaBlock
- the block to be executed
Ponder2Exception
public P2Array operation_collect(P2Object source, P2Block aBlock) throws Ponder2Exception
source
- the originator of the commandaBlock
- the block to be executed
Ponder2Exception
public void add(P2Object aP2Object)
aP2Object
- the object to be added to the arraypublic void addAll(P2Array anArray) throws Ponder2ArgumentException
anArray
- the array to be added to this object
Ponder2ArgumentException
public P2Object at(int anIndex)
anIndex
- the index of the required object
public P2Object atput(int anIndex, P2Object aP2Object)
anIndex
- the index of the object to be addedaP2Object
- the object to be added
public int size()
public boolean has(int anIndex)
anIndex
- the object to be checked
public boolean hasObject(P2Object aP2Object)
aP2Object
- the object to be checked
protected P2Object remove(int anIndex)
protected boolean removeObject(P2Object anObject) throws Ponder2Exception
anObject
- the object to be removed
Ponder2Exception
protected void operation_removeAll()
public com.twicom.qdparser.TaggedElement writeXml(java.util.Set<P2Object> written) throws Ponder2OperationException
writeXml
in interface P2Serializable
writeXml
in class P2Object
Ponder2OperationException
public P2Object readXml(com.twicom.qdparser.TaggedElement xml, java.util.Map<java.lang.Integer,P2Serializable> read) throws Ponder2OperationException, Ponder2ArgumentException
readXml
in interface P2Serializable
readXml
in class P2Object
Ponder2OperationException
Ponder2ArgumentException
public java.util.Vector<P2Object> getValues()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |