Package com.semedy.reasoner.edb.ramstore
Class AVLNodeStore
java.lang.Object
com.semedy.reasoner.edb.ramstore.AVLNodeStore
An avl tree
- Author:
- Juergen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbal(int n) get the balance valuevoidclear()clear the avl treeintdata(int n) get the index for the dataint[]retrun all nodesintleft(int n) get the left nodeintnewNode()create a new nodevoidremoveNode(int address) remove nodeintright(int n) get the right nodevoidsetBal(int n, int b) set the balance value for node nvoidsetData(int n, int d) set the data index for node nvoidsetLeft(int n, int l) set the left node for node nvoidsetRight(int n, int r) set the right node for node nintsize()return the number of nodesintreturn the number of bytes used in main memory
-
Field Details
-
_elementData
public int[] _elementDatathe avl nodes
-
-
Constructor Details
-
AVLNodeStore
-
-
Method Details
-
sizeInBytes
public int sizeInBytes()return the number of bytes used in main memory- Returns:
-
newNode
create a new node- Returns:
- Throws:
IOException
-
getElementData
public int[] getElementData()retrun all nodes- Returns:
-
right
public int right(int n) get the right node- Parameters:
n-- Returns:
-
left
public int left(int n) get the left node- Parameters:
n-- Returns:
-
bal
public int bal(int n) get the balance value- Parameters:
n-- Returns:
-
data
public int data(int n) get the index for the data- Parameters:
n-- Returns:
-
setRight
public void setRight(int n, int r) set the right node for node n- Parameters:
n-r-
-
setLeft
public void setLeft(int n, int l) set the left node for node n- Parameters:
n-l-
-
setBal
public void setBal(int n, int b) set the balance value for node n- Parameters:
n-b-
-
setData
public void setData(int n, int d) set the data index for node n- Parameters:
n-d-
-
removeNode
public void removeNode(int address) remove node- Parameters:
address-
-
size
public int size()return the number of nodes- Returns:
-
clear
public void clear()clear the avl tree
-