|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.cilib.type.types.container.AbstractTree<E>
E - The Cloneable type.public abstract class AbstractTree<E extends Cloneable & Comparable<? super E>>
Base class for all Tree objects. Contains the methods common to all Tree objects.
| Nested Class Summary | |
|---|---|
protected class |
AbstractTree.TreeIterator
Provides a simple Iterator for trees. |
| Field Summary | |
|---|---|
protected E |
key
|
| Constructor Summary | |
|---|---|
AbstractTree()
|
|
| Method Summary | |
|---|---|
void |
accept(Visitor<E> visitor)
Accept the Visitor instance and perform the actions within the Visitor on the objects contained within this Structure. |
boolean |
addAll(StructuredType<? extends E> structure)
Add add the objects of type E, within structureto the
current Structure. |
void |
breadthFirstTraversal(Visitor<Tree<E>> visitor)
Perform a breadth first traversal of the current Tree node, executing the operation stored within the provided Visitor instance. |
void |
depthFirstTraversal(PrePostVisitor<E> visitor)
Perform a depth first traversal of the current Tree node, executing the operation stored within the provided Visitor instance. |
abstract boolean |
equals(Object obj)
Compare the specified object with this type for equality. |
abstract AbstractTree<E> |
getClone()
Create a cloned copy of the current object and return it. |
E |
getKey()
Get the key value maintained by this Tree. |
String |
getRepresentation()
|
abstract int |
hashCode()
Returns the hash code value for this list. |
boolean |
isEmpty()
Determine if the current Tree is empty. |
Iterator<E> |
iterator()
|
void |
randomize(Random random)
Apply a randomization using the provided Random. |
boolean |
removeAll(StructuredType<E> structure)
Remove all instances contained within structure, if contained. |
void |
setKey(E element)
Set the current key for the Tree. |
int |
size()
Defines the size of the structure. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sourceforge.cilib.type.types.container.Tree |
|---|
addSubTree, getDegree, getSubTree, getSubTree, isLeaf, removeSubTree, removeSubTree |
| Methods inherited from interface net.sourceforge.cilib.type.types.container.StructuredType |
|---|
add, clear, contains, remove, remove |
| Field Detail |
|---|
protected E extends Cloneable & Comparable<? super E> key
| Constructor Detail |
|---|
public AbstractTree()
| Method Detail |
|---|
public abstract AbstractTree<E> getClone()
getClone in interface StructuredType<E extends Cloneable & Comparable<? super E>>getClone in interface Tree<E extends Cloneable & Comparable<? super E>>getClone in interface TypegetClone in interface CloneableObject.clone()public abstract boolean equals(Object obj)
true if and only if the specified object is also an instance
of the same type.
equals in interface Typeequals in class Objectobj - The object to compare.
true if equality exists, false otherwise.Object.equals(Object)public abstract int hashCode()
int hashCode = 7;
Iterator<E> i = list.iterator();
while (i.hasNext()) {
E obj = i.next();
hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
}
This ensures that type1.equals(type2) implies that
type1.hashCode()==type2.hashCode() for any two types,
type1 and type2, as required by the general
contract of Object.hashCode().
hashCode in interface TypehashCode in class ObjectObject.equals(Object),
Type.equals(Object)public void breadthFirstTraversal(Visitor<Tree<E>> visitor)
breadthFirstTraversal in interface Tree<E extends Cloneable & Comparable<? super E>>visitor - The visitor operation to execute at each node.public void depthFirstTraversal(PrePostVisitor<E> visitor)
depthFirstTraversal in interface Tree<E extends Cloneable & Comparable<? super E>>visitor - The visitor operation to execute at each node.public void accept(Visitor<E> visitor)
accept in interface StructuredType<E extends Cloneable & Comparable<? super E>>visitor - The Visitor instance to execute.public E getKey()
getKey in interface Tree<E extends Cloneable & Comparable<? super E>>public void setKey(E element)
setKey in interface Tree<E extends Cloneable & Comparable<? super E>>element - The E to be used as the key.public boolean isEmpty()
null. ie: getKey() == null.
isEmpty in interface StructuredType<E extends Cloneable & Comparable<? super E>>true if the Tree is empty, else false.public boolean addAll(StructuredType<? extends E> structure)
E, within structureto the
current Structure.
addAll in interface StructuredType<E extends Cloneable & Comparable<? super E>>structure - The containing object of elements to add.
true if successful, false otherwise.public boolean removeAll(StructuredType<E> structure)
structure, if contained.
removeAll in interface StructuredType<E extends Cloneable & Comparable<? super E>>structure - The listing of instances to be removed.
true if successful, false otherwise.public Iterator<E> iterator()
iterator in interface Iterable<E extends Cloneable & Comparable<? super E>>iterator in interface StructuredType<E extends Cloneable & Comparable<? super E>>public int size()
size in interface StructuredType<E extends Cloneable & Comparable<? super E>>public String getRepresentation()
public void randomize(Random random)
RandomizableRandom.
randomize in interface Randomizablerandom - The Random to use for the randomization.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||