public class NAryTreeImplWithHistory extends NAryTreeImpl
Modifier and Type | Field and Description |
---|---|
protected int |
treeOfLifeID
Stores the id to correctly retrieve its parent in the history log.
|
configurations, leafs, next, numConfigurations, parent, type, types
Constructor and Description |
---|
NAryTreeImplWithHistory(int[] next,
short[] type,
int[] parent) |
NAryTreeImplWithHistory(int size,
int numConfigurations) |
NAryTreeImplWithHistory(java.util.List<java.lang.Integer> next,
java.util.List<java.lang.Short> type,
java.util.List<java.lang.Integer> parent) |
NAryTreeImplWithHistory(NAryTree original) |
NAryTreeImplWithHistory(gnu.trove.list.TIntList next,
gnu.trove.list.TShortList type,
gnu.trove.list.TIntList parent) |
Modifier and Type | Method and Description |
---|---|
NAryTreeImplWithHistory |
add(NAryTree source,
int node,
int par,
int location)
Returns a new tree where the subtree below the node at index node in the
source tree is copied into this tree under node with index parent at
location index.
|
NAryTreeImplWithHistory |
addChild(int operatorNode,
int location,
short leafType,
byte configurationType)
Returns a new tree in which a child is added to the operator at the given
index
|
NAryTreeImplWithHistory |
addParent(int node,
short newType,
byte configurationType)
Returns a new tree in which node from source is replaced by a new node of
the given type and where the existing node becomes a child of this newly
added parent.
|
NAryTree |
applyHidingAndOperatorDowngrading(int configurationNumber)
Apply all hiding and downgrading configurations of the provided
configuration number.
|
NAryTreeImplWithHistory |
move(int node,
int newParent,
int location)
moves the given node by removing it from its parent and adding is under
the new parent.
|
NAryTreeImplWithHistory |
remove(int node)
removes the node at index node from the tre
|
NAryTreeImplWithHistory |
replace(int node,
NAryTree source,
int srcNode)
replaces node from this tree with the node from the source tree
It is assumed that this tree and the given tree have an equal number of
configurations.
|
NAryTreeImplWithHistory |
swap(int node1,
int node2)
returns a new tree with the two nodes swapped.
|
addConfiguration, applyConfiguration, compareTo, countNodes, equals, expectedCol, findBlockEffect, getChildAtIndex, getConfiguration, getHighestParentWithOneChild, getNext, getNextFast, getNextLeaf, getNextLeafFast, getNodeConfiguration, getNodeConfigurationFast, getNumberOfConfigurations, getParent, getParentFast, getType, getType, getTypeFast, getTypeFast, hashCode, hashCode, isBlocked, isConsistent, isDowngraded, isHidden, isInSubtree, isLeaf, main, move, nChildren, numLeafs, remove, removeAllConfigurations, removeConfiguration, replace, set, setNodeConfiguration, setType, setType, size, size, toInternalString, toString
protected int treeOfLifeID
public NAryTreeImplWithHistory(NAryTree original)
original
- public NAryTreeImplWithHistory(int[] next, short[] type, int[] parent)
next
- type
- parent
- public NAryTreeImplWithHistory(int size, int numConfigurations)
size
- numConfigurations
- public NAryTreeImplWithHistory(gnu.trove.list.TIntList next, gnu.trove.list.TShortList type, gnu.trove.list.TIntList parent)
next
- type
- parent
- public NAryTreeImplWithHistory(java.util.List<java.lang.Integer> next, java.util.List<java.lang.Short> type, java.util.List<java.lang.Integer> parent)
next
- type
- parent
- public NAryTreeImplWithHistory swap(int node1, int node2)
NAryTree
swap
in interface NAryTree
swap
in class NAryTreeImpl
node1
- First node to swapnode2
- Other node to swap withpublic NAryTreeImplWithHistory add(NAryTree source, int node, int par, int location)
NAryTree
add
in interface NAryTree
add
in class NAryTreeImpl
source
- NAryTree to add a node fromnode
- Node to add from the source tree to the current treepublic NAryTreeImplWithHistory addParent(int node, short newType, byte configurationType)
NAryTree
addParent
in interface NAryTree
addParent
in class NAryTreeImpl
node
- a node in the tree that gets a new parent (can be any node)newType
- the type of the new parent (cannot be LOOP, TAU or any leaf
type)public NAryTreeImplWithHistory addChild(int operatorNode, int location, short leafType, byte configurationType)
NAryTree
addChild
in interface NAryTree
addChild
in class NAryTreeImpl
operatorNode
- node to which a child needs to be added (cannot be a leaf or a
LOOP)location
- the index at which the child should be added. 0 means the new
child becomes the leftmost, and any value greater than the
number of children implies the new node becomes the rightmost.leafType
- the new type of the new leaf node to be insertedpublic NAryTreeImplWithHistory replace(int node, NAryTree source, int srcNode)
NAryTree
replace
in interface NAryTree
replace
in class NAryTreeImpl
node
- Node in this tree to be replacedsource
- NAryTree to get the new node fromsrcNode
- Node from the source tree to be the replacement in this treepublic NAryTreeImplWithHistory remove(int node)
NAryTree
remove
in interface NAryTree
remove
in class NAryTreeImpl
node
- Index of the node to be removedpublic NAryTreeImplWithHistory move(int node, int newParent, int location)
NAryTree
move
in interface NAryTree
move
in class NAryTreeImpl
node
- Node to be (re)movednewParent
- Index of the new parentlocation
- Child index of the moved node in the parent nodepublic NAryTree applyHidingAndOperatorDowngrading(int configurationNumber)
NAryTreeImpl
applyHidingAndOperatorDowngrading
in class NAryTreeImpl