public class TermGraph extends PrintableX implements java.lang.Comparable<TermGraph>
Constructor and Description |
---|
TermGraph(TermVar root) |
TermGraph(TermVar root,
java.util.Map<Variable,Term> recursionEquations) |
Modifier and Type | Method and Description |
---|---|
Term |
addRecursionEquation(Variable var,
Term node)
Adds a recursion equation in canonical form to the system of equations of the
term graph.
|
void |
checkAndTrim()
Check and remove useless (unreachable) equations
|
void |
commitAllMappings() |
int |
compareTo(TermGraph o)
Poor performance - do not use if not absolutely necessary.
|
TermGraph |
copy() |
TermGraph |
copyRootAndTrim(TermVar newRoot)
Creates a copy with the specified root and removes all useless (unreachable)
equations
|
boolean |
equals(java.lang.Object o) |
Term |
get(Variable recursionVar) |
java.util.Map<Variable,Term> |
getRecursionEquations()
Use and manipulate it carefully! Adding equations that are not in canonical
form leads to unpredictable behavior.
|
TermVar |
getRoot() |
int |
hashCode() |
boolean |
isHorizontallyBound() |
void |
merge(Variable keep,
Variable remove) |
void |
print(java.io.Writer out)
The root is the first printed variable.
|
Variable |
removeByValue(Variable termValue)
Removes one mapping for a given value and returns the key.
|
void |
resetAllMappings() |
void |
setRoot(TermVar root)
Just sets the root without removing any equations.
|
void |
sortCommutative()
Sort the outgoing edges of commutative function symbols.
|
void |
substitute(Variable from,
java.util.List<Variable> to)
Replaces from by to.
|
void |
substitute(Variable from,
Variable to)
Replaces one variable by another one.
|
void |
suggestMapping(Variable from,
Term to)
Suggests a mapping from a variable to a term node.
|
TermAtomList |
top() |
TermAtomList |
top(java.util.List<Variable> recVars) |
TermAtomList |
top(TermAtom var) |
toString
public TermGraph(TermVar root)
public Term addRecursionEquation(Variable var, Term node) throws MalformedTermException
MalformedTermException
- If the equation is not in canonical form.public void checkAndTrim() throws MalformedTermException
MalformedTermException
public void commitAllMappings()
public int compareTo(TermGraph o)
compareTo
in interface java.lang.Comparable<TermGraph>
public TermGraph copy()
public TermGraph copyRootAndTrim(TermVar newRoot) throws MalformedTermException
newRoot
- MalformedTermException
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.util.Map<Variable,Term> getRecursionEquations()
public TermVar getRoot()
public int hashCode()
hashCode
in class java.lang.Object
public boolean isHorizontallyBound()
public void print(java.io.Writer out) throws java.io.IOException
public Variable removeByValue(Variable termValue)
public void resetAllMappings()
public void setRoot(TermVar root)
root
- public void sortCommutative()
public void substitute(Variable from, java.util.List<Variable> to)
from
- A hedge variable.to
- A list of variables.public void suggestMapping(Variable from, Term to)
commitAllMappings()
is executed.
Suggested mappings can be canceled by calling resetAllMappings()
.public TermAtomList top()
public TermAtomList top(java.util.List<Variable> recVars)
public TermAtomList top(TermAtom var)