|
|
com.declarativa.interprolog
|
Field Summary | |
TermModel[] |
children
public for convenience, but should not be set outside this class; children == null means children == new TermModel[0] |
static int |
listMaxLength
|
Object |
node
public for convenience, but should not be set outside this class |
TermModel |
root
The TermModel containing this; relevant to define variable scope. |
Constructor Summary | |
TermModel()
|
|
TermModel(int n)
|
|
TermModel(Object n)
|
|
TermModel(Object n,
boolean isAList)
|
|
TermModel(Object n,
TermModel[] c)
|
|
TermModel(Object n,
TermModel[] c,
boolean isAList)
|
|
TermModel(Object n,
Vector v)
|
Method Summary | |
void |
addChildren(TermModel[] more)
Add children to this term node; a new children array is created and old children are copied to it |
void |
addTermModelListener(TermModelListener l)
Start notifying listener l of changes to this term. |
void |
addTreeModelListener(TreeModelListener l)
|
void |
assignTermChanges(TermModel other)
Assuming this and the other terms are structurally similar, replaces variable nodes in this term by corresponding nonvar nodes. |
void |
assignToVar(VariableNode v,
Object value)
Replaces all occurrences of v in this subterm by value, using setNodeValue |
Object |
clone()
Clones by serialization, to keep variable bindings; these should form a closed graph within this term, otherwise the new term instance would contain dangling references |
void |
deleteChildren(int[] less)
Delete children with specified indexes; a new children array is created and old children are copied to it |
void |
deleteChildren(TermModel[] less)
Removes the children in array; it finds children to remove by using the equivalent of Prolog's ==. |
boolean |
equals(Object x)
True if both terms are structurally similar with equal nodes |
static ObjectExamplePair |
example()
|
static TreePath |
findPathForNode(String label,
TermModel tree,
boolean exactMatch)
|
void |
fireTermChanged()
|
TermModel[] |
flatList()
Flattens this list into a new TermModel array, but not completely: the result may still contain lists |
static TermModel[] |
flatList(TermModel list)
Flattens a list into a TermModel array, but not completely: the result may still contain lists |
Object |
getChild(int index)
|
Object |
getChild(Object parent,
int index)
|
int |
getChildCount()
|
int |
getChildCount(Object parent)
|
TermModel[] |
getChildren()
|
String |
getFunctorArity()
Return a node/arity String |
int |
getIndexOfChild(Object parent,
Object child)
|
Object |
getRoot()
|
String |
getTemplate()
Return a Node(_,..._) String |
int |
intValue()
Returns node object as an int, assuming it is a Number |
boolean |
isAtom()
|
boolean |
isInteger()
|
boolean |
isLeaf()
|
boolean |
isLeaf(Object node)
|
boolean |
isList()
May be an empty list |
boolean |
isListEnd()
|
boolean |
isNumber()
|
boolean |
isRoot()
This node is its own root |
boolean |
isVar()
|
String |
listToString(PrologOperatorsContext ops)
|
Vector |
makeIntegerVector()
Assuming this is a list of numbers, returns a Vector containing one Integer for each number in the list |
static TermModel |
makeList(TermModel[] terms)
|
static TermModel |
makeList(Vector terms)
|
boolean |
nodeIsVar()
|
static Hashtable |
props2Hashtable(TermModel[] terms)
|
void |
removeTermModelListener(TermModelListener l)
|
void |
removeTreeModelListener(TreeModelListener l)
|
void |
setChild(int index,
TermModel child)
Set the child, notifying TermModelListeners |
void |
setChildren(TermModel[] c)
Set the children array, notifying TermModelListeners |
void |
setNodeValue(Object v)
Set the node, notifying TermModelListeners |
void |
setRoot()
Set the root variables of nodes in this subterm to refer this term node as their root |
void |
setRoot(TermModel r)
Set the root variables of nodes in this subterm to refer r as their root |
String |
toString()
|
String |
toString(PrologEngine engine)
|
String |
toString(PrologOperatorsContext ops)
|
boolean |
unifies(TermModel term)
Returns true if the term is (would be) unifiable with this. |
void |
valueForPathChanged(TreePath path,
Object newValue)
|
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public Object node
public TermModel[] children
public transient TermModel root
public static final int listMaxLength
Constructor Detail |
public TermModel()
public TermModel(Object n)
public TermModel(Object n, TermModel[] c)
public TermModel(Object n, boolean isAList)
public TermModel(Object n, TermModel[] c, boolean isAList)
public TermModel(int n)
public TermModel(Object n, Vector v)
Method Detail |
public static ObjectExamplePair example()
public Object clone()
public boolean equals(Object x)
public void setNodeValue(Object v)
public void setChild(int index, TermModel child)
public void setChildren(TermModel[] c)
public TermModel[] getChildren()
public void addChildren(TermModel[] more)
public void deleteChildren(int[] less)
public void deleteChildren(TermModel[] less)
public void assignToVar(VariableNode v, Object value)
public void assignTermChanges(TermModel other)
public void setRoot()
public void setRoot(TermModel r)
public boolean isRoot()
public String getTemplate()
public String getFunctorArity()
public Object getRoot()
public Object getChild(Object parent, int index)
public int getChildCount(Object parent)
getChildCount
in interface TreeModel
TreeModel
public boolean isLeaf(Object node)
public void valueForPathChanged(TreePath path, Object newValue)
valueForPathChanged
in interface TreeModel
TreeModel
public int getIndexOfChild(Object parent, Object child)
getIndexOfChild
in interface TreeModel
TreeModel
public void addTreeModelListener(TreeModelListener l)
addTreeModelListener
in interface TreeModel
TreeModel
public void removeTreeModelListener(TreeModelListener l)
removeTreeModelListener
in interface TreeModel
TreeModel
public Object getChild(int index)
public int getChildCount()
public boolean isLeaf()
public void addTermModelListener(TermModelListener l)
public void removeTermModelListener(TermModelListener l)
public void fireTermChanged()
public static TreePath findPathForNode(String label, TermModel tree, boolean exactMatch)
public static TermModel makeList(TermModel[] terms)
public static TermModel makeList(Vector terms)
public Vector makeIntegerVector()
public int intValue()
public String toString()
public String toString(PrologOperatorsContext ops)
public String toString(PrologEngine engine)
public String listToString(PrologOperatorsContext ops)
public boolean isListEnd()
public boolean isList()
public boolean isAtom()
public boolean isNumber()
public boolean isInteger()
public boolean isVar()
public boolean nodeIsVar()
public TermModel[] flatList()
public static TermModel[] flatList(TermModel list)
public static Hashtable props2Hashtable(TermModel[] terms)
public boolean unifies(TermModel term)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Declarativa - Serviços de Informática, Lda. |