public class EfficientTreeImpl extends java.lang.Object implements EfficientTree
EfficientTree.NodeType| Modifier and Type | Field and Description |
|---|---|
static int |
childrenFactor |
| Constructor and Description |
|---|
EfficientTreeImpl(int[] tree,
gnu.trove.map.TObjectIntMap<java.lang.String> activity2int,
java.lang.String[] int2activity)
Construct a new efficient tree using the given inputs.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(int parent,
int asChildNr,
int operatorOrActivity)
Add a child to the tree, as a child of parent, at the given position.
|
EfficientTree |
clone() |
void |
copy(int srcPos,
int destPos,
int length)
Please refer to EfficientTreeUtils for higher-level editing functions.
|
boolean |
equals(java.lang.Object obj) |
int |
getActivity(int node) |
gnu.trove.map.TObjectIntMap<java.lang.String> |
getActivity2int() |
java.lang.String |
getActivityName(int node) |
int |
getChild(int parent,
int numberOfChild) |
java.lang.Iterable<java.lang.Integer> |
getChildren(int node) |
int[] |
getChildTree(int node)
Deprecated.
|
static gnu.trove.map.TObjectIntMap<java.lang.String> |
getEmptyActivity2int() |
java.lang.String[] |
getInt2activity() |
int |
getMaxNumberOfNodes() |
EfficientTree.NodeType |
getNodeType(int node) |
int |
getNumberOfChildren(int node) |
int |
getRoot() |
int[] |
getTree() |
int |
hashCode() |
boolean |
isActivity(int node) |
boolean |
isConcurrent(int node) |
boolean |
isInterleaved(int node) |
boolean |
isLoop(int node) |
boolean |
isOperator(int node) |
boolean |
isOr(int node) |
boolean |
isSequence(int node) |
boolean |
isSkip(int node) |
boolean |
isTau(int node) |
boolean |
isXor(int node) |
void |
reorderNodes(java.lang.Integer[] nodes,
int end)
Please refer to EfficientTreeUtils for higher-level editing functions.
|
void |
replaceTree(int[] tree)
Replace the tree structure.
|
void |
setNodeActivity(int node,
int activity)
Please refer to EfficientTreeUtils for higher-level editing functions.
|
void |
setNodeType(int node,
EfficientTree.NodeType operator)
Please refer to EfficientTreeUtils for higher-level editing functions.
|
void |
setNumberOfChildren(int node,
int numberOfChildren)
Please refer to EfficientTreeUtils for higher-level editing functions.
|
void |
setSize(int size)
Please refer to EfficientTreeUtils for higher-level editing functions.
|
EfficientTreeImpl |
shortenTree()
Copy the tree into a tight array
|
void |
swap(int startA,
int startB,
int lengthB)
Please refer to EfficientTreeUtils for higher-level editing functions.
|
java.lang.String |
toString()
Return a string representation of this tree.
|
void |
toString(int node,
java.lang.StringBuilder result) |
int |
traverse(int node) |
public static final int childrenFactor
public EfficientTreeImpl(int[] tree,
gnu.trove.map.TObjectIntMap<java.lang.String> activity2int,
java.lang.String[] int2activity)
tree - activity2int - The mapping from activities (strings) to integers. The map
should be created such that the emptiness value is not 0 (as
that is a valid activity). Preferably, use
getEmptyActivity2int() to obtain such a map.int2activity - The mapping from integers to the activities (strings). Should
be consistent with activity2int.public int[] getTree()
getTree in interface EfficientTreepublic gnu.trove.map.TObjectIntMap<java.lang.String> getActivity2int()
getActivity2int in interface EfficientTreepublic java.lang.String[] getInt2activity()
getInt2activity in interface EfficientTreepublic void addChild(int parent,
int asChildNr,
int operatorOrActivity)
parent - asChildNr - public int traverse(int node)
traverse in interface EfficientTreepublic int getActivity(int node)
getActivity in interface EfficientTreepublic java.lang.String getActivityName(int node)
getActivityName in interface EfficientTreepublic boolean isOperator(int node)
isOperator in interface EfficientTreepublic int getNumberOfChildren(int node)
getNumberOfChildren in interface EfficientTreepublic int getChild(int parent,
int numberOfChild)
getChild in interface EfficientTreenumberOfChild - (the first child has number 0)public boolean isTau(int node)
isTau in interface EfficientTreepublic boolean isActivity(int node)
isActivity in interface EfficientTreepublic boolean isSequence(int node)
isSequence in interface EfficientTreepublic boolean isXor(int node)
isXor in interface EfficientTreepublic boolean isConcurrent(int node)
isConcurrent in interface EfficientTreepublic boolean isInterleaved(int node)
isInterleaved in interface EfficientTreepublic boolean isLoop(int node)
isLoop in interface EfficientTreepublic boolean isOr(int node)
isOr in interface EfficientTreepublic int getRoot()
getRoot in interface EfficientTreepublic java.lang.Iterable<java.lang.Integer> getChildren(int node)
getChildren in interface EfficientTreepublic EfficientTreeImpl shortenTree()
public boolean isSkip(int node)
isSkip in interface EfficientTree@Deprecated public int[] getChildTree(int node)
public static gnu.trove.map.TObjectIntMap<java.lang.String> getEmptyActivity2int()
public void replaceTree(int[] tree)
tree - public java.lang.String toString()
toString in class java.lang.Objectpublic void toString(int node,
java.lang.StringBuilder result)
throws UnknownTreeNodeException
UnknownTreeNodeExceptionpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic EfficientTree clone()
clone in interface EfficientTreeclone in class java.lang.Objectpublic EfficientTree.NodeType getNodeType(int node)
getNodeType in interface EfficientTreepublic int getMaxNumberOfNodes()
getMaxNumberOfNodes in interface EfficientTreepublic void copy(int srcPos,
int destPos,
int length)
EfficientTreecopy in interface EfficientTreesrcPos - start of the block - sourcedestPos - start of the block - destinationlength - number of nodes to be movedpublic void setNodeType(int node,
EfficientTree.NodeType operator)
EfficientTreesetNodeType in interface EfficientTreepublic void setNodeActivity(int node,
int activity)
EfficientTreesetNodeActivity in interface EfficientTreepublic void setNumberOfChildren(int node,
int numberOfChildren)
EfficientTreesetNumberOfChildren in interface EfficientTreepublic void setSize(int size)
EfficientTreesetSize in interface EfficientTreepublic void swap(int startA,
int startB,
int lengthB)
EfficientTreeswap in interface EfficientTreepublic void reorderNodes(java.lang.Integer[] nodes,
int end)
EfficientTreereorderNodes in interface EfficientTreenodes - A consecutive but possibly shuffled list of indices, in which
to reorder nodes.end - The index after the end of the last node.