|
||||||||||
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.P2Number
public class P2Number
An object used for comparing and counting
Field Summary | |
---|---|
static java.util.Random |
random
|
Constructor Summary | |
---|---|
protected |
P2Number()
constructor for Ponder2 serialisation |
|
P2Number(java.math.BigDecimal value)
constructs a P2Number with value as its initial value |
|
P2Number(java.lang.String value)
constructs a P2Number with its initial value expressed as a string |
Method Summary | |
---|---|
java.math.BigDecimal |
asNumber()
Returns itself as a BigDecimal number |
protected java.math.BigDecimal |
divide(java.math.BigDecimal aNumber)
Answer the result of dividing the receiver by aNumber |
protected boolean |
eq(java.math.BigDecimal aNumber)
Answer true if the receiver is equal to aNumber else answer false |
boolean |
equals(java.lang.Object obj)
|
protected boolean |
ge(java.math.BigDecimal aNumber)
Answer true if the receiver is greater than or equal to aNumber else answer false |
protected boolean |
gt(java.math.BigDecimal aNumber)
Answer true if the receiver is greater than aNumber else answer false |
int |
hashCode()
|
protected boolean |
le(java.math.BigDecimal aNumber)
Answer true if the receiver is less than or equal to aNumber else answer false |
protected boolean |
lt(java.math.BigDecimal aNumber)
Answer true if the receiver is less than aNumber else answer false |
protected java.math.BigDecimal |
minus(java.math.BigDecimal aNumber)
Answer the result of subtracting aNumber from the receiver |
protected boolean |
ne(java.math.BigDecimal aNumber)
Answer true if the receiver is not equal to aNumber else answer false |
protected P2Array |
op_collect(P2Object source,
P2Object aBlock)
Execute aBlock this number of times. |
protected void |
op_do(P2Object source,
P2Object aBlock)
Execute aBlock this number of times. |
protected java.math.BigDecimal |
plus(java.math.BigDecimal aNumber)
Answer the result of adding the receiver and aNumber |
protected java.math.BigDecimal |
random()
Answer a random number depending upon the value of the receiver: 0 => random long value n => random integer >=0 and < n n.m => random double >= 0.0 and < 1.0 |
P2Object |
readXml(com.twicom.qdparser.TaggedElement xml,
java.util.Map<java.lang.Integer,P2Serializable> read)
|
protected java.math.BigDecimal |
times(java.math.BigDecimal aNumber)
Answer the result of multiplying the receiver and aNumber |
java.lang.String |
toString()
|
com.twicom.qdparser.TaggedElement |
writeXml(java.util.Set<P2Object> written)
|
Methods inherited from class net.ponder2.objects.P2Object |
---|
asArray, asBlock, asBoolean, asClass, asDouble, asFloat, asHash, asInteger, asLong, asP2Array, 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, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.util.Random random
Constructor Detail |
---|
protected P2Number()
public P2Number(java.math.BigDecimal value)
value
- the initial value of this numberpublic P2Number(java.lang.String value) throws Ponder2ArgumentException
value
- the initial value of this number
Ponder2ArgumentException
Method Detail |
---|
public java.math.BigDecimal asNumber() throws Ponder2ArgumentException
P2Object
asNumber
in class P2Object
Ponder2ArgumentException
protected boolean lt(java.math.BigDecimal aNumber)
aNumber
- the value to be compared
protected boolean gt(java.math.BigDecimal aNumber)
aNumber
- the value to be compared
protected boolean le(java.math.BigDecimal aNumber)
aNumber
- the value to be compared
protected boolean ge(java.math.BigDecimal aNumber)
aNumber
- the value to be compared
protected boolean eq(java.math.BigDecimal aNumber)
aNumber
- the value to be compared
protected boolean ne(java.math.BigDecimal aNumber)
aNumber
- the value to be compared
protected java.math.BigDecimal plus(java.math.BigDecimal aNumber)
aNumber
- the value to be used
protected java.math.BigDecimal minus(java.math.BigDecimal aNumber)
aNumber
- the value to be used
protected java.math.BigDecimal times(java.math.BigDecimal aNumber)
aNumber
- the value to be used
protected java.math.BigDecimal divide(java.math.BigDecimal aNumber)
aNumber
- the value to be used
protected java.math.BigDecimal random()
protected void op_do(P2Object source, P2Object aBlock) throws Ponder2Exception
aBlock
- the block to be executed. It may take one argument
Ponder2Exception
protected P2Array op_collect(P2Object source, P2Object aBlock) throws Ponder2Exception
aBlock
- the block to be executed. It may take one argument
Ponder2Exception
public java.lang.String toString()
toString
in class java.lang.Object
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
readXml
in interface P2Serializable
readXml
in class P2Object
Ponder2OperationException
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |