Class AtomicTerm
java.lang.Object
com.tangosol.coherence.dsltools.termtrees.Term
com.tangosol.coherence.dsltools.termtrees.AtomicTerm
AtomicTerms is the class used to represent literal Terms such as String
and Numbers. The functor() method for AtomicTerms return a type name for
the stored literals.
- Author:
- djl 2009.08.31
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.coherence.dsltools.termtrees.Term
Term.TermIterator -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe numberic code for a boolean literalstatic final intThe numberic code for a double literalstatic final intThe numberic code for a float literalstatic final intThe numberic code for a integer literalstatic final intThe numberic code for a long literalstatic final intThe numberic code for a boolean literalstatic final intThe numberic code for a symbol literalstatic final intThe numberic code for a string literalstatic final intThe numberic code for a symbol literal -
Constructor Summary
ConstructorsConstructorDescriptionAtomicTerm(String sValue, int nType) Construct a new AtomicTerm with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(TermWalker walker) Do a dispatch back to the given walker.Term[]children()Obtain the childern Termsstatic AtomicTermcreateBoolean(String value) Create new AtomicTerm representing a Boolean with given valuestatic AtomicTermcreateDouble(String value) Create new AtomicTerm representing a Double with given valuestatic AtomicTermcreateFloat(String value) Create new AtomicTerm representing a float with given valuestatic AtomicTermcreateInteger(String value) Create new AtomicTerm representing a Integer with given valuestatic AtomicTermcreateLong(String value) Create new AtomicTerm representing a Long with given valuestatic AtomicTermCreate new AtomicTerm representing a null.static AtomicTermcreateNull(String value) Create new AtomicTerm representing a null with given valuestatic AtomicTermcreateShort(String value) Create new AtomicTerm representing a Short with given valuestatic AtomicTermcreateString(String value) Create new AtomicTerm representing a String with given valuestatic AtomicTermcreateSymbol(String value) Create new AtomicTerm representing a Symbol with given valueFind the Term amoungst the children whose functor equals the given functor.Answer a String representation of the Term that is allowed to show more internal details than toString() which does not compress information.Obtain the functor representation of the Term.Obtain the Number representation of the node.Obtain the Object representation of the node.intObtain the typecode for the node.getValue()Obtain the string value for the node.booleanisNumber()Answer whether the receiver is an Atomic Term representing a Number.booleanTest whether the value is of a valid number format.voidnegate()Make negavite the representation of this node.negativeNumber(Number num) Make negative the given number that supposedly came from this node.termAt(int index) Obtain the child term at the given index.booleanAnswer whether the receiver is equal to the given Term.toString()Return a human-readable description for this Node.Join the receiver with the given child Term.Methods inherited from class com.tangosol.coherence.dsltools.termtrees.Term
childrenTermEqual, findAttribute, headChildrenTermEqual, isAtom, isLeaf, iterator, lengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
STRINGLITERAL
public static final int STRINGLITERALThe numberic code for a string literal- See Also:
-
INTEGERLITERAL
public static final int INTEGERLITERALThe numberic code for a integer literal- See Also:
-
LONGLITERAL
public static final int LONGLITERALThe numberic code for a long literal- See Also:
-
FLOATLITERAL
public static final int FLOATLITERALThe numberic code for a float literal- See Also:
-
DOUBLELITERAL
public static final int DOUBLELITERALThe numberic code for a double literal- See Also:
-
BOOLEANLITERAL
public static final int BOOLEANLITERALThe numberic code for a boolean literal- See Also:
-
NULLLITERAL
public static final int NULLLITERALThe numberic code for a boolean literal- See Also:
-
SHORTLITERAL
public static final int SHORTLITERALThe numberic code for a symbol literal- See Also:
-
SYMBOLLITERAL
public static final int SYMBOLLITERALThe numberic code for a symbol literal- See Also:
-
-
Constructor Details
-
AtomicTerm
Construct a new AtomicTerm with the given parameters.- Parameters:
sValue- the String representation of the literalnType- the type code for the given literal
-
-
Method Details
-
getTypeCode
public int getTypeCode()Obtain the typecode for the node.- Returns:
- the typecode
-
getValue
-
getFunctor
Obtain the functor representation of the Term.- Specified by:
getFunctorin classTerm- Returns:
- the functor
-
fullFormString
Answer a String representation of the Term that is allowed to show more internal details than toString() which does not compress information. Similar to Object.toString().- Specified by:
fullFormStringin classTerm- Returns:
- a String representation of the receiver
-
isNumber
-
withChild
-
children
-
termAt
Obtain the child term at the given index. The index is 1 based for children and with at(0) returning the functor as an AtomicTerm. Beware, your 0 based habits can cause problems but 1 based indexing is useful since the functor is an interesting part of the information space. We are bowing here to the wisdom of Mathematica Expressions. -
findChild
-
termEqual
Answer whether the receiver is equal to the given Term. Terms are equal if their functors are equal and their children are termEqual to the children of the given term. -
getObject
Obtain the Object representation of the node. This will be one of the java Types String, Integer, Long, Float, Double, or Boolean.- Returns:
- the Object
-
getNumber
-
negativeNumber
-
negate
public void negate()Make negavite the representation of this node. -
isValidNumber
public boolean isValidNumber()Test whether the value is of a valid number format.- Returns:
- the results of testing for numeric format validity
-
accept
Description copied from class:TermDo a dispatch back to the given walker. -
toString
-
createString
Create new AtomicTerm representing a String with given value- Parameters:
value- the text of the literal- Returns:
- a AtomicTerm for a String
-
createShort
Create new AtomicTerm representing a Short with given value- Parameters:
value- the text of the literal- Returns:
- a AtomicTerm for a Integer
-
createInteger
Create new AtomicTerm representing a Integer with given value- Parameters:
value- the text of the literal- Returns:
- a AtomicTerm for a Integer
-
createLong
Create new AtomicTerm representing a Long with given value- Parameters:
value- the text of the literal- Returns:
- a AtomicTerm for a Long
-
createFloat
Create new AtomicTerm representing a float with given value- Parameters:
value- the text of the literal- Returns:
- a AtomicTerm for a Float
-
createDouble
Create new AtomicTerm representing a Double with given value- Parameters:
value- the text of the literal- Returns:
- a AtomicTerm for a Double
-
createBoolean
Create new AtomicTerm representing a Boolean with given value- Parameters:
value- the text of the literal- Returns:
- a AtomicTerm for a boolean
-
createNull
Create new AtomicTerm representing a null with given value- Parameters:
value- the text of the literal- Returns:
- a AtomicTerm for a null
-
createNull
Create new AtomicTerm representing a null.- Returns:
- a AtomicTerm for a null
-
createSymbol
Create new AtomicTerm representing a Symbol with given value- Parameters:
value- the text of the literal- Returns:
- a AtomicTerm for a Symbol
-