|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.uacalc.terms.VariableImp
public class VariableImp
The term graph; that is, term tree with possibly shared nodes. This graph is acyclic.
| Field Summary |
|---|
| Fields inherited from interface org.uacalc.terms.Variable |
|---|
x, y, z |
| Constructor Summary | |
|---|---|
VariableImp(java.lang.String name)
|
|
| Method Summary | |
|---|---|
int |
depth()
The depth of the term tree. |
boolean |
equals(java.lang.Object obj)
|
java.lang.Object |
eval(Algebra alg,
java.util.Map map)
The evaluation of this term in an algebra using map as
the variable assignment. |
java.util.List<Term> |
getChildren()
A list of terms which are the immediate children. |
java.lang.String |
getName()
The list of the variables for the language of this term. |
java.util.List |
getVariableList()
The list of variables in the order they appear in the term. |
int |
hashCode()
|
TermOperation |
interpretation(SmallAlgebra alg)
The operation obtained from this term using the variables in the order they occur. |
Operation |
interpretation(SmallAlgebra alg,
java.util.List<Variable> varlist,
boolean all)
The interpretation of this term in an algebra; that is, the operation on alg corresponding to this term. |
int |
intEval(Algebra alg,
java.util.Map map)
The int evaluation of this term in an algebra using map as
the variable assignment. |
boolean |
isaVariable()
|
OperationSymbol |
leadingOperationSymbol()
The leading operation symbol or null if this term is a variable. |
int |
length()
The length of the term. |
Term |
substitute(java.util.Map<Variable,Term> map)
Replace some of the variables with terms. |
java.lang.String |
toString()
A reasonably good printout of the term. |
java.lang.StringBuffer |
writeStringBuffer(java.lang.StringBuffer sb)
This is really an efficiency helper for toString. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public VariableImp(java.lang.String name)
| Method Detail |
|---|
public java.lang.String getName()
getName in interface Variablepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean isaVariable()
isaVariable in interface Termpublic java.util.List<Term> getChildren()
Term
getChildren in interface Termpublic OperationSymbol leadingOperationSymbol()
Term
leadingOperationSymbol in interface Term
public java.lang.Object eval(Algebra alg,
java.util.Map map)
Termmap as
the variable assignment.
eval in interface Term
public int intEval(Algebra alg,
java.util.Map map)
Termmap as
the variable assignment.
intEval in interface Term
public Operation interpretation(SmallAlgebra alg,
java.util.List<Variable> varlist,
boolean all)
Termalg corresponding to this term.
The varlist, a list of Variable's, specifies the
order. If useAll is true, variables that are
not explicit in this term are still used.
(z*y)*z, and
varlist is (x, y, z).
If useAll is true, the resulting operation will
have arity 3 and be independent of its first variable. Otherwise
it will be a 2 place operation with y as the first
variable and z as the second.
interpretation in interface Termalg - the Algebravarlist - the list of variablesall - if true, use all the variables in varlist
public TermOperation interpretation(SmallAlgebra alg)
Term(z*y)*z.
The result will be a 2 place operation with z as the first
variable and y as the second.
interpretation in interface Termalg - the Algebra
#interpretation(Algebra,List,boolean)public java.util.List getVariableList()
Term
getVariableList in interface Termpublic int depth()
Term
depth in interface Termpublic int length()
Term
length in interface Termpublic Term substitute(java.util.Map<Variable,Term> map)
Term
substitute in interface Termmap - a map for the substitution
public java.lang.String toString()
Term
toString in interface TermtoString in class java.lang.Objectpublic java.lang.StringBuffer writeStringBuffer(java.lang.StringBuffer sb)
Term
writeStringBuffer in interface Term
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||