Package com.semedy.reasoner.edb.ramstore
Class AVLNodeStore
java.lang.Object
com.semedy.reasoner.edb.ramstore.AVLNodeStore
An avl tree
- Author:
- Juergen
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
bal
(int n) get the balance valuevoid
clear()
clear the avl treeint
data
(int n) get the index for the dataint[]
retrun all nodesint
left
(int n) get the left nodeint
newNode()
create a new nodevoid
removeNode
(int address) remove nodeint
right
(int n) get the right nodevoid
setBal
(int n, int b) set the balance value for node nvoid
setData
(int n, int d) set the data index for node nvoid
setLeft
(int n, int l) set the left node for node nvoid
setRight
(int n, int r) set the right node for node nint
size()
return the number of nodesint
return 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
-