Class Node<USERKEY,STOREKEY>
- java.lang.Object
-
- com.github.basking2.sdsai.dsds.node.Node<USERKEY,STOREKEY>
-
- Type Parameters:
USERKEY- The user's key.STOREKEY- The key in the data storage medium.
- All Implemented Interfaces:
java.io.Serializable
public class Node<USERKEY,STOREKEY> extends java.lang.Object implements java.io.SerializableThe basic object that is persisted to a large distributed storage via aNodeStore. Notice that aNodedoes not posses any knowlede of the key it is stored under. Only it's children or ancestor nodes.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Node()Create a Node that can store a single ancestor, child, and data object.Node(int childCap)Create a Node that can store a number of children, one data keys and one ancestor.Node(int childCap, int dataCap)Create a Node that can store a number of children and data keys and has only one ancestor.Node(int childCap, int dataCap, int ancestorsCap)Create a Node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<STOREKEY>getAncestors()intgetAncestorsCap()intgetChildCap()java.util.List<STOREKEY>getChildren()java.util.List<USERKEY>getData()intgetDataCap()booleanisAncestorsFull()booleanisChildrenFull()booleanisDataFull()booleanisEmpty()Return true of this node has no data.booleanisLeaf()Return true if this node has no children.booleanisRoot()Return true of this node has no ancestors.voidsetAncestorCap(int ancestorsCap)voidsetAncestors(java.util.List<STOREKEY> ancestors)voidsetChildCap(int childCap)voidsetChildren(java.util.List<STOREKEY> children)voidsetData(java.util.List<USERKEY> data)voidsetDataCap(int dataCap)java.lang.StringtoString()
-
-
-
Constructor Detail
-
Node
public Node()
Create a Node that can store a single ancestor, child, and data object.
-
Node
public Node(int childCap)
Create a Node that can store a number of children, one data keys and one ancestor.- Parameters:
childCap- The number of children this Node may have.
-
Node
public Node(int childCap, int dataCap)Create a Node that can store a number of children and data keys and has only one ancestor.- Parameters:
childCap- The number of children this Node may have.dataCap- The number of data entries this Node may have.
-
Node
public Node(int childCap, int dataCap, int ancestorsCap)Create a Node.- Parameters:
childCap- The number of children this Node may have.dataCap- The number of data elements this Node may have.ancestorsCap- The number of ancestors this node may have.
-
-
Method Detail
-
getData
public java.util.List<USERKEY> getData()
-
getAncestors
public java.util.List<STOREKEY> getAncestors()
-
getChildren
public java.util.List<STOREKEY> getChildren()
-
getDataCap
public int getDataCap()
-
getChildCap
public int getChildCap()
-
getAncestorsCap
public int getAncestorsCap()
-
isDataFull
public boolean isDataFull()
-
isChildrenFull
public boolean isChildrenFull()
-
isAncestorsFull
public boolean isAncestorsFull()
-
setData
public void setData(java.util.List<USERKEY> data)
-
setChildren
public void setChildren(java.util.List<STOREKEY> children)
-
setAncestors
public void setAncestors(java.util.List<STOREKEY> ancestors)
-
setDataCap
public void setDataCap(int dataCap)
-
setChildCap
public void setChildCap(int childCap)
-
setAncestorCap
public void setAncestorCap(int ancestorsCap)
-
isEmpty
public boolean isEmpty()
Return true of this node has no data.- Returns:
- true of this node has no data.
-
isLeaf
public boolean isLeaf()
Return true if this node has no children.- Returns:
- true if this node has no children.
-
isRoot
public boolean isRoot()
Return true of this node has no ancestors.- Returns:
- true if this node has no ancestors.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-