public abstract class TreeMutationAbstract
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
changedAtLastCall |
protected java.lang.String |
key |
protected int |
locationOfLastChange |
static int |
MAXTRIES
A constant that indicates how often a mutation function can try to get to
a correct node before it should give up
|
protected CentralRegistry |
registry |
protected NAryTreeHistory.TypesOfChange |
typeOfChange |
Constructor and Description |
---|
TreeMutationAbstract(CentralRegistry registry) |
Modifier and Type | Method and Description |
---|---|
boolean |
changedAtLastCall()
Returns true if the last call of the algorithm caused changes to the tree
|
protected void |
didChange(int node,
NAryTreeHistory.TypesOfChange _typeOfChange) |
java.lang.String |
getKey()
Each tree mutation should define a unique key to be used to identify the
algorithm in maps and such
|
int |
locationOfLastChange()
Returns the node closest to where the change was made (e.g.
|
NAryTree |
mutate(NAryTree tree)
Calls mutate(Node) on the root and makes sure that the changed node
becomes the new root
|
abstract NAryTree |
mutate(NAryTree tree,
int node)
Mutates the given node (only use if you need to mutate a specific sub
tree, not beeing the whole tree).
|
protected void |
noChange() |
public static final int MAXTRIES
protected CentralRegistry registry
protected java.lang.String key
protected boolean changedAtLastCall
protected int locationOfLastChange
protected NAryTreeHistory.TypesOfChange typeOfChange
public TreeMutationAbstract(CentralRegistry registry)
public java.lang.String getKey()
public abstract NAryTree mutate(NAryTree tree, int node)
node
- Node to mutate onpublic NAryTree mutate(NAryTree tree)
tree
- public boolean changedAtLastCall()
public int locationOfLastChange()
protected void noChange()
protected void didChange(int node, NAryTreeHistory.TypesOfChange _typeOfChange)