Class NodeTerm
- java.lang.Object
-
- com.tangosol.coherence.dsltools.termtrees.Term
-
- com.tangosol.coherence.dsltools.termtrees.NodeTerm
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.coherence.dsltools.termtrees.Term
Term.TermIterator
-
-
Constructor Summary
Constructors Constructor Description NodeTerm(String sFunctor)
Construct a new TermNode with the given functor.NodeTerm(String sFunctor, Term t1)
Construct a new TermNode with the given functor and given Terms.NodeTerm(String sFunctor, Term[] aTerms)
Construct a new TermNode with the given functor and given Terms.NodeTerm(String sFunctor, Term[] aTerms, Term term)
Construct a new TermNode with the given functor and given Terms.NodeTerm(String sFunctor, Term t1, Term t2)
Construct a new TermNode with the given functor and given Terms.NodeTerm(String sFunctor, Term term, Term[] aTerms)
Construct a new TermNode with the given functor and given Terms.NodeTerm(String sFunctor, Term t1, Term t2, Term t3)
Construct a new TermNode with the given functor and given Terms.NodeTerm(String sFunctor, Term t1, Term t2, Term t3, Term t4)
Construct a new TermNode with the given functor and given Terms.NodeTerm(String sFunctor, Term t1, Term t2, Term t3, Term t4, Term t5)
Construct a new TermNode with the given functor and given Terms.
-
Method Summary
All 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 TermsString
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.boolean
isAtom()
Answer whether the receiver is an Atomic Term.boolean
isLeaf()
Answer whether the receiver has children.int
length()
Answer whether the length of the receivers childrenvoid
setFunctor(String sFunctor)
Set the receiver's functor to be the given StringTerm
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, findChild, headChildrenTermEqual, isNumber, iterator
-
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
-
-
-
-
Constructor Detail
-
NodeTerm
public NodeTerm(String sFunctor)
Construct a new TermNode with the given functor.- Parameters:
sFunctor
- the functor for the Term
-
NodeTerm
public NodeTerm(String sFunctor, Term t1)
Construct a new TermNode with the given functor and given Terms.- Parameters:
sFunctor
- the functor for the Termt1
- a child term
-
NodeTerm
public NodeTerm(String sFunctor, Term t1, Term t2)
Construct a new TermNode with the given functor and given Terms.- Parameters:
sFunctor
- the functor for the Termt1
- a child termt2
- a child term
-
NodeTerm
public NodeTerm(String sFunctor, Term t1, Term t2, Term t3)
Construct a new TermNode with the given functor and given Terms.- Parameters:
sFunctor
- the functor for the Termt1
- a child termt2
- a child termt3
- a child term
-
NodeTerm
public NodeTerm(String sFunctor, Term t1, Term t2, Term t3, Term t4)
Construct a new TermNode with the given functor and given Terms.- Parameters:
sFunctor
- the functor for the Termt1
- a child termt2
- a child termt3
- a child termt4
- a child term
-
NodeTerm
public NodeTerm(String sFunctor, Term t1, Term t2, Term t3, Term t4, Term t5)
Construct a new TermNode with the given functor and given Terms.- Parameters:
sFunctor
- the functor for the Termt1
- a child termt2
- a child termt3
- a child termt4
- a child termt5
- a child term
-
NodeTerm
public NodeTerm(String sFunctor, Term[] aTerms)
Construct a new TermNode with the given functor and given Terms.- Parameters:
sFunctor
- the functor for the TermaTerms
- children of the node
-
NodeTerm
public NodeTerm(String sFunctor, Term term, Term[] aTerms)
Construct a new TermNode with the given functor and given Terms.- Parameters:
sFunctor
- the functor for the Termterm
- a termaTerms
- children of the node
-
-
Method Detail
-
getFunctor
public String getFunctor()
Obtain the functor representation of the Term.- Specified by:
getFunctor
in classTerm
- Returns:
- the functor
-
isLeaf
public boolean isLeaf()
Answer whether the receiver has children.
-
isAtom
public boolean isAtom()
Answer whether the receiver is an Atomic Term.
-
children
public Term[] children()
Obtain the childern Terms
-
length
public int length()
Answer whether the length of the receivers children
-
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.
-
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.
-
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.
-
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
-
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.
-
setFunctor
public void setFunctor(String sFunctor)
Set the receiver's functor to be the given String- Parameters:
sFunctor
- the new functor for this Term
-
-