Class AtomicTerm
- java.lang.Object
-
- com.tangosol.coherence.dsltools.termtrees.Term
-
- com.tangosol.coherence.dsltools.termtrees.AtomicTerm
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.coherence.dsltools.termtrees.Term
Term.TermIterator
-
-
Field Summary
Fields Modifier and Type Field Description static int
BOOLEANLITERAL
The numberic code for a boolean literalstatic int
DOUBLELITERAL
The numberic code for a double literalstatic int
FLOATLITERAL
The numberic code for a float literalstatic int
INTEGERLITERAL
The numberic code for a integer literalstatic int
LONGLITERAL
The numberic code for a long literalstatic int
NULLLITERAL
The numberic code for a boolean literalstatic int
SHORTLITERAL
The numberic code for a symbol literalstatic int
STRINGLITERAL
The numberic code for a string literalstatic int
SYMBOLLITERAL
The numberic code for a symbol literal
-
Constructor Summary
Constructors Constructor Description AtomicTerm(String sValue, int nType)
Construct a new AtomicTerm with the given parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(TermWalker walker)
Do a dispatch back to the given walker.Term[]
children()
Obtain the childern Termsstatic AtomicTerm
createBoolean(String value)
Create new AtomicTerm representing a Boolean with given valuestatic AtomicTerm
createDouble(String value)
Create new AtomicTerm representing a Double with given valuestatic AtomicTerm
createFloat(String value)
Create new AtomicTerm representing a float with given valuestatic AtomicTerm
createInteger(String value)
Create new AtomicTerm representing a Integer with given valuestatic AtomicTerm
createLong(String value)
Create new AtomicTerm representing a Long with given valuestatic AtomicTerm
createNull()
Create new AtomicTerm representing a null.static AtomicTerm
createNull(String value)
Create new AtomicTerm representing a null with given valuestatic AtomicTerm
createShort(String value)
Create new AtomicTerm representing a Short with given valuestatic AtomicTerm
createString(String value)
Create new AtomicTerm representing a String with given valuestatic AtomicTerm
createSymbol(String value)
Create new AtomicTerm representing a Symbol with given valueTerm
findChild(String fn)
Find the Term amoungst the children whose functor equals the given functor.String
fullFormString()
Answer a String representation of the Term that is allowed to show more internal details than toString() which does not compress information.String
getFunctor()
Obtain the functor representation of the Term.Number
getNumber()
Obtain the Number representation of the node.Object
getObject()
Obtain the Object representation of the node.int
getTypeCode()
Obtain the typecode for the node.String
getValue()
Obtain the string value for the node.boolean
isNumber()
Answer whether the receiver is an Atomic Term representing a Number.boolean
isValidNumber()
Test whether the value is of a valid number format.void
negate()
Make negavite the representation of this node.Number
negativeNumber(Number num)
Make negative the given number that supposedly came from this node.Term
termAt(int index)
Obtain the child term at the given index.boolean
termEqual(Term t)
Answer whether the receiver is equal to the given Term.String
toString()
Return a human-readable description for this Node.Term
withChild(Term t)
Join the receiver with the given child Term.-
Methods inherited from class com.tangosol.coherence.dsltools.termtrees.Term
childrenTermEqual, findAttribute, headChildrenTermEqual, isAtom, isLeaf, iterator, length
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
STRINGLITERAL
public static final int STRINGLITERAL
The numberic code for a string literal- See Also:
- Constant Field Values
-
INTEGERLITERAL
public static final int INTEGERLITERAL
The numberic code for a integer literal- See Also:
- Constant Field Values
-
LONGLITERAL
public static final int LONGLITERAL
The numberic code for a long literal- See Also:
- Constant Field Values
-
FLOATLITERAL
public static final int FLOATLITERAL
The numberic code for a float literal- See Also:
- Constant Field Values
-
DOUBLELITERAL
public static final int DOUBLELITERAL
The numberic code for a double literal- See Also:
- Constant Field Values
-
BOOLEANLITERAL
public static final int BOOLEANLITERAL
The numberic code for a boolean literal- See Also:
- Constant Field Values
-
NULLLITERAL
public static final int NULLLITERAL
The numberic code for a boolean literal- See Also:
- Constant Field Values
-
SHORTLITERAL
public static final int SHORTLITERAL
The numberic code for a symbol literal- See Also:
- Constant Field Values
-
SYMBOLLITERAL
public static final int SYMBOLLITERAL
The numberic code for a symbol literal- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AtomicTerm
public AtomicTerm(String sValue, int nType)
Construct a new AtomicTerm with the given parameters.- Parameters:
sValue
- the String representation of the literalnType
- the type code for the given literal
-
-
Method Detail
-
getTypeCode
public int getTypeCode()
Obtain the typecode for the node.- Returns:
- the typecode
-
getValue
public String getValue()
Obtain the string value for the node.- Returns:
- the string value
-
getFunctor
public String getFunctor()
Obtain the functor representation of the Term.- Specified by:
getFunctor
in classTerm
- Returns:
- the functor
-
fullFormString
public String 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:
fullFormString
in classTerm
- Returns:
- a String representation of the receiver
-
isNumber
public boolean isNumber()
Answer whether the receiver is an Atomic Term representing a Number.
-
withChild
public Term withChild(Term t)
Join the receiver with the given child Term. AtomicTerms will construct a general list term (functor .list.) and NodeTerms may be mutated.
-
children
public Term[] children()
Obtain the childern Terms
-
termAt
public Term termAt(int index)
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
public Term findChild(String fn)
Find the Term amoungst the children whose functor equals the given functor.
-
termEqual
public boolean termEqual(Term t)
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
public Object 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
public Number getNumber()
Obtain the Number representation of the node.- Returns:
- the Comparable
-
negativeNumber
public Number negativeNumber(Number num)
Make negative the given number that supposedly came from this node.- Parameters:
num
- a Number that was created by this node- Returns:
- a negated
-
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 the results of testing for numeric format validity
-
accept
public void accept(TermWalker walker)
Description copied from class:Term
Do a dispatch back to the given walker.
-
toString
public String toString()
Return a human-readable description for this Node.
-
createString
public static AtomicTerm createString(String value)
Create new AtomicTerm representing a String with given value- Parameters:
value
- the text of the literal- Returns:
- a AtomicTerm for a String
-
createShort
public static AtomicTerm createShort(String value)
Create new AtomicTerm representing a Short with given value- Parameters:
value
- the text of the literal- Returns:
- a AtomicTerm for a Integer
-
createInteger
public static AtomicTerm createInteger(String value)
Create new AtomicTerm representing a Integer with given value- Parameters:
value
- the text of the literal- Returns:
- a AtomicTerm for a Integer
-
createLong
public static AtomicTerm createLong(String value)
Create new AtomicTerm representing a Long with given value- Parameters:
value
- the text of the literal- Returns:
- a AtomicTerm for a Long
-
createFloat
public static AtomicTerm createFloat(String value)
Create new AtomicTerm representing a float with given value- Parameters:
value
- the text of the literal- Returns:
- a AtomicTerm for a Float
-
createDouble
public static AtomicTerm createDouble(String value)
Create new AtomicTerm representing a Double with given value- Parameters:
value
- the text of the literal- Returns:
- a AtomicTerm for a Double
-
createBoolean
public static AtomicTerm createBoolean(String value)
Create new AtomicTerm representing a Boolean with given value- Parameters:
value
- the text of the literal- Returns:
- a AtomicTerm for a boolean
-
createNull
public static AtomicTerm createNull(String value)
Create new AtomicTerm representing a null with given value- Parameters:
value
- the text of the literal- Returns:
- a AtomicTerm for a null
-
createNull
public static AtomicTerm createNull()
Create new AtomicTerm representing a null.- Returns:
- a AtomicTerm for a null
-
createSymbol
public static AtomicTerm createSymbol(String value)
Create new AtomicTerm representing a Symbol with given value- Parameters:
value
- the text of the literal- Returns:
- a AtomicTerm for a Symbol
-
-