<virtual, protected> new AbstractAlgorithm(tree, visualiser, isSubalgorithm)
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
tree |
btv.BinaryTree | ||
visualiser |
btv.Visualiser | ||
isSubalgorithm |
Boolean |
<optional> |
Set true if this algorithm is part of another algorithm. |
- Source:
Members
-
<protected> endAnimationListeners :jsgl.util.ArrayList
-
Listeners that are invoked at the end of animation chain.
Type:
- jsgl.util.ArrayList
- Source:
-
<protected> isSubalgorithm :Boolean
-
True if algorithm is called from another algorithm.
Type:
- Boolean
- Source:
-
<protected> startAnimationListeners :jsgl.util.ArrayList
-
Listeners that are invoked at the start of animation chain.
Type:
- jsgl.util.ArrayList
- Source:
-
<protected> tree :btv.BinaryTree
-
Type:
- Source:
-
<protected> treeCopy :btv.BinaryTree
-
Type:
- Source:
-
<protected> visualiser :btv.Visualiser
-
Type:
- Source:
Methods
-
<protected, static> copyNodeRec(leftChildSource, rightChildSource, parentCopy)
-
Copy given node recursively.
Parameters:
Name Type Description leftChildSource
btv.BinaryTreeNode rightChildSource
btv.BinaryTreeNode parentCopy
btv.BinaryTreeNOde - Source:
-
<protected, static> copyTree(tree) → {btv.BinaryTree}
-
Create a copy of given tree.
Parameters:
Name Type Description tree
btv.BinaryTree - Source:
Returns:
- Type
- btv.BinaryTree
-
addEndAnimationListener(listener)
-
Adds a listener function to be invoked when the chain of animations ends.
Parameters:
Name Type Description listener
Function - Source:
-
addStartAnimationListener(listener)
-
Adds a listener function to be invoked when the chain of animations starts.
Parameters:
Name Type Description listener
Function - Source:
-
<protected> fireEndAnimationListeners()
-
Invokes all registered listener functions.
- Source:
-
<protected> fireStartAnimationListeners()
-
Invokes all registered listener functions.
- Source:
-
<virtual, protected> redo()
-
Makes changes on the tree (do the algoritm) and fill the animatorsArray.
- Source:
-
<protected> redoEnd(show)
-
Routine at end of each redo function.
Parameters:
Name Type Argument Description show
Boolean <optional>
- Source:
-
<protected> redoStart()
-
Routine at start of each redo function.
- Source:
-
removeEndAnimationListener(listener)
-
Removes a listener function.
Parameters:
Name Type Description listener
Function - Source:
-
removeStartAnimationListener(listener)
-
Removes a listener function.
Parameters:
Name Type Description listener
Function - Source:
-
<protected> undo()
-
Makes changes on the tree (undo the algoritm) - set the tree to state before this algorithm was done (executed).
- Source: