|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--xxl.indexStructures.Tree
The Tree-class is a generic and highly flexible super-class that implements features used by grow and post-trees. To use this class you have to subclass the inner class Descriptor (which describes the region represented by a given subtree) and Node (which reoresents leaf- and non-leaf nodes). The structure of this class including all abstract methods is as follows:
public abstract class Tree {
public static interface Descriptor extends Cloneable {
public abstract boolean overlaps (Descriptor descriptor);
public abstract boolean contains (Descriptor descriptor);
public abstract void union (Descriptor descriptor);
public abstract boolean equals (Object object);
public abstract Object clone ();
}
protected abstract Object createPostData (Node.SplitInfo splitInfo, IndexEntry newEntry);
protected abstract Node.SplitInfo createRoot (Object data, Descriptor descriptor);
protected static class IndexEntry {
}
protected static abstract class Node {
public class SplitInfo {
}
protected abstract Iterator entries ();
protected abstract int number ();
protected abstract IndexEntry chooseSubtree (Object data, Descriptor descriptor, IndexEntry indexEntry, boolean [] dirty);
protected abstract void grow (Object data, Descriptor descriptor);
protected abstract SplitInfo split (Stack path);
protected abstract void post (Object postData);
}
public abstract Iterator query (Function assessment, Function selection, Queue queue, int level);
protected static abstract class QueryIterator implements Iterator {
protected static class Candidate {
}
protected abstract Iterator expand (Node node, Descriptor nodeDescriptor, Function currentAssessment);
}
}
| Inner Class Summary | |
static interface |
Tree.Descriptor
The Descriptor describes the region represented by a given subtree. |
class |
Tree.IndexEntry
An IndexEntry is a non-leaf node. |
class |
Tree.Node
Node is the class used to represent leaf- and non-leaf nodes. |
class |
Tree.Query
Queries on the Tree are evaluated lazily (ONC). |
| Field Summary | |
protected Function |
determineContainer
Returns the Container that is used to store a new node created by a split operation. |
protected Function |
getContainer
Returns the Container that is used to store the node the IndexEntry is pointing to. |
protected Function |
getDescriptor
Returns the Descriptor of a given data item. |
protected Function |
getSplitMaxRatio
|
protected Function |
getSplitMinRatio
Returns the minimal relative number of entries the node may contain after a split. |
protected int |
height
Number of tree-levels (0 = tree is empty, 1 = tree contains only one node). |
protected Function |
overflows
Returns the maximum capacity of a node. |
protected Tree.Descriptor |
rootDescriptor
The Descriptor of the tree. |
protected Tree.IndexEntry |
rootEntry
The root node of the tree. |
protected Function |
underflows
Returns the current load of a node. |
| Constructor Summary | |
Tree()
|
|
| Method Summary | |
Tree.IndexEntry |
chooseLeaf(java.lang.Object data)
|
Tree.IndexEntry |
chooseLeaf(Tree.Descriptor descriptor,
int targetLevel)
|
protected Tree.IndexEntry |
chooseLeaf(Tree.Descriptor descriptor,
int targetLevel,
java.util.Stack path)
|
Tree.IndexEntry |
createIndexEntry(int parentLevel)
|
abstract Tree.Node |
createNode(int level)
|
protected Tree.Node |
down(java.util.Stack path,
Tree.IndexEntry indexEntry)
|
protected java.util.Map.Entry |
grow(java.lang.Object entry)
|
int |
height()
Returns height. |
protected Tree.IndexEntry |
indexEntry(java.util.Stack path)
|
Tree |
initialize(Function getDescriptor,
Container container,
int minCapacity,
int maxCapacity)
|
Tree |
initialize(Function getDescriptor,
Function getContainer,
Function determineContainer,
Function underflows,
Function overflows,
Function getSplitMinRatio,
Function getSplitMaxRatio)
|
Tree |
initialize(Tree.IndexEntry rootEntry,
Tree.Descriptor rootDescriptor,
int height,
Function getDescriptor,
Container container,
int minCapacity,
int maxCapacity)
|
Tree |
initialize(Tree.IndexEntry rootEntry,
Tree.Descriptor rootDescriptor,
int height,
Function getDescriptor,
Function getContainer,
Function determineContainer,
Function underflows,
Function overflows,
Function getSplitMinRatio,
Function getSplitMaxRatio)
Creates a new (empty) Tree. |
void |
insert(java.lang.Object data)
Inserts an Object into the tree (This function calls insert on the root-node by default). |
protected void |
insert(java.lang.Object data,
Tree.Descriptor descriptor,
int targetLevel)
Inserts an Object into the tree. |
protected int |
level(java.util.Stack path)
|
protected Tree.Node |
node(java.util.Stack path)
|
java.util.Iterator |
query()
Returns a new QueryIterator. |
java.util.Iterator |
query(int level)
Returns a new QueryIterator. |
java.util.Iterator |
query(Tree.Descriptor queryDescriptor)
Returns an iterator for all leaf-entries whose descriptors overlap with the given queryDescriptor |
java.util.Iterator |
query(Tree.Descriptor queryDescriptor,
int targetLevel)
Returns an iterator for all objects whose descriptors overlap with the given queryDescriptor |
Tree.Descriptor |
rootDescriptor()
Returns rootDescriptor. |
Tree.IndexEntry |
rootEntry()
Returns rootEntry. |
protected Tree.IndexEntry |
up(java.util.Stack path)
|
protected void |
update(java.util.Stack path)
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected Function getDescriptor
protected Function determineContainer
protected Function getContainer
protected Function overflows
Tree.Node#getSizeprotected Function underflows
Tree#getCapacityprotected Function getSplitMinRatio
protected Function getSplitMaxRatio
protected Tree.IndexEntry rootEntry
rootDescriptorprotected Tree.Descriptor rootDescriptor
rootEntryprotected int height
| Constructor Detail |
public Tree()
| Method Detail |
public Tree initialize(Tree.IndexEntry rootEntry,
Tree.Descriptor rootDescriptor,
int height,
Function getDescriptor,
Function getContainer,
Function determineContainer,
Function underflows,
Function overflows,
Function getSplitMinRatio,
Function getSplitMaxRatio)
public Tree initialize(Function getDescriptor,
Function getContainer,
Function determineContainer,
Function underflows,
Function overflows,
Function getSplitMinRatio,
Function getSplitMaxRatio)
public Tree initialize(Tree.IndexEntry rootEntry,
Tree.Descriptor rootDescriptor,
int height,
Function getDescriptor,
Container container,
int minCapacity,
int maxCapacity)
public Tree initialize(Function getDescriptor,
Container container,
int minCapacity,
int maxCapacity)
public Tree.IndexEntry rootEntry()
public Tree.Descriptor rootDescriptor()
public int height()
public Tree.IndexEntry createIndexEntry(int parentLevel)
public abstract Tree.Node createNode(int level)
public void insert(java.lang.Object data)
protected void insert(java.lang.Object data,
Tree.Descriptor descriptor,
int targetLevel)
public Tree.IndexEntry chooseLeaf(java.lang.Object data)
public Tree.IndexEntry chooseLeaf(Tree.Descriptor descriptor,
int targetLevel)
protected Tree.IndexEntry chooseLeaf(Tree.Descriptor descriptor,
int targetLevel,
java.util.Stack path)
protected java.util.Map.Entry grow(java.lang.Object entry)
protected Tree.IndexEntry indexEntry(java.util.Stack path)
protected Tree.Node node(java.util.Stack path)
protected int level(java.util.Stack path)
protected Tree.Node down(java.util.Stack path,
Tree.IndexEntry indexEntry)
protected void update(java.util.Stack path)
protected Tree.IndexEntry up(java.util.Stack path)
public java.util.Iterator query(Tree.Descriptor queryDescriptor,
int targetLevel)
queryDescriptor - describes the query in terms of a descriptorlevel - the tree-level to provide the answer-objectspublic java.util.Iterator query(Tree.Descriptor queryDescriptor)
queryDescriptor - describes the query in terms of a descriptorpublic java.util.Iterator query(int level)
public java.util.Iterator query()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||