Package com.github.basking2.sdsai.dsds
Class BTreeLocation<USERKEY,STOREKEY>
- java.lang.Object
-
- com.github.basking2.sdsai.dsds.BTreeLocation<USERKEY,STOREKEY>
-
- All Implemented Interfaces:
java.lang.Comparable<BTreeLocation<USERKEY,STOREKEY>>
public class BTreeLocation<USERKEY,STOREKEY> extends java.lang.Object implements java.lang.Comparable<BTreeLocation<USERKEY,STOREKEY>>
A recursive reprentation of a point in an in-order traversal of a B-Tree.
-
-
Field Summary
Fields Modifier and Type Field Description intindexNode<USERKEY,STOREKEY>nodeNodeStore<USERKEY,STOREKEY,?>nodeStoreBTreeLocation<USERKEY,STOREKEY>prevThe previous state (not the previous tree node).booleansubtreeHasNextbooleansubtreeHasPrev
-
Constructor Summary
Constructors Constructor Description BTreeLocation(BTreeLocation<USERKEY,STOREKEY> loc)Copy constructor.BTreeLocation(BTreeLocation<USERKEY,STOREKEY> prev, Node<USERKEY,STOREKEY> node, int index)BTreeLocation(NodeStore<USERKEY,STOREKEY,?> nodeStore, Node<USERKEY,STOREKEY> node, int index)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(BTreeLocation<USERKEY,STOREKEY> that)BTreeLocation<USERKEY,STOREKEY>descend()BTreeLocation<USERKEY,STOREKEY>descend(int child)Push the current state and step into the given child.USERKEYgetKey()Return the current STOREKEY to the user data.Node<USERKEY,STOREKEY>getNode()Return the current Node.BTreeLocation<USERKEY,STOREKEY>go(int index)Set the index to this value and return this.booleanhasNext()booleanhasPrev()BTreeLocation<USERKEY,STOREKEY>leftChild()BTreeLocation<USERKEY,STOREKEY>leftData()BTreeLocation<USERKEY,STOREKEY>max()Return the maximum location for this subtree location.BTreeLocation<USERKEY,STOREKEY>min()Return the minimum location for this subtree location.BTreeLocation<USERKEY,STOREKEY>next()May never be called unlesshasNext()is true.BTreeLocation<USERKEY,STOREKEY>prev()BTreeLocation<USERKEY,STOREKEY>rightChild()BTreeLocation<USERKEY,STOREKEY>rightData()voidsetSubtreeHasNext()Set hasNext using local information about if there is another available datalement in this subtree.voidsetSubtreeHasPrev()Set hasPrev using local node information only.
-
-
-
Field Detail
-
prev
public BTreeLocation<USERKEY,STOREKEY> prev
The previous state (not the previous tree node). This the state that we left the parent node in.
-
index
public int index
-
subtreeHasNext
public boolean subtreeHasNext
-
subtreeHasPrev
public boolean subtreeHasPrev
-
-
Constructor Detail
-
BTreeLocation
public BTreeLocation(NodeStore<USERKEY,STOREKEY,?> nodeStore, Node<USERKEY,STOREKEY> node, int index)
-
BTreeLocation
public BTreeLocation(BTreeLocation<USERKEY,STOREKEY> prev, Node<USERKEY,STOREKEY> node, int index)
-
BTreeLocation
public BTreeLocation(BTreeLocation<USERKEY,STOREKEY> loc)
Copy constructor.
-
-
Method Detail
-
compareTo
public int compareTo(BTreeLocation<USERKEY,STOREKEY> that)
- Specified by:
compareToin interfacejava.lang.Comparable<USERKEY>
-
hasPrev
public boolean hasPrev()
-
hasNext
public boolean hasNext()
-
next
public BTreeLocation<USERKEY,STOREKEY> next()
-
prev
public BTreeLocation<USERKEY,STOREKEY> prev()
-
setSubtreeHasNext
public void setSubtreeHasNext()
Set hasNext using local information about if there is another available datalement in this subtree. This does not take into account the parent's hasNext status.
-
setSubtreeHasPrev
public void setSubtreeHasPrev()
Set hasPrev using local node information only.
-
getKey
public USERKEY getKey()
Return the current STOREKEY to the user data.
-
leftChild
public BTreeLocation<USERKEY,STOREKEY> leftChild()
-
leftData
public BTreeLocation<USERKEY,STOREKEY> leftData()
-
rightChild
public BTreeLocation<USERKEY,STOREKEY> rightChild()
-
rightData
public BTreeLocation<USERKEY,STOREKEY> rightData()
-
go
public BTreeLocation<USERKEY,STOREKEY> go(int index)
Set the index to this value and return this.
-
descend
public BTreeLocation<USERKEY,STOREKEY> descend(int child)
Push the current state and step into the given child.
-
descend
public BTreeLocation<USERKEY,STOREKEY> descend()
-
min
public BTreeLocation<USERKEY,STOREKEY> min()
Return the minimum location for this subtree location.- Returns:
- the minimum location for this subtree location.
-
max
public BTreeLocation<USERKEY,STOREKEY> max()
Return the maximum location for this subtree location.- Returns:
- the maximum location for this subtree location.
-
-