|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.cmu.emulator.event.ESplayTree
public class ESplayTree
Implements a top-down splay tree. Note that all "matching" is based on the compareTo method.
Field Summary | |
---|---|
private EBNodeFarm |
ebnFarm
|
private static EBinaryNode |
header
|
private static EBinaryNode |
newNode
|
private static EBinaryNode |
nullNode
|
private EBinaryNode |
root
|
Constructor Summary | |
---|---|
ESplayTree()
Construct the tree. |
Method Summary | |
---|---|
EmuEvent |
find(EmuEvent x)
Find an item in the tree. |
EmuEvent |
findMax()
Find the largest item in the tree. |
EmuEvent |
findMin()
Find the smallest item in the tree. |
int |
getSize()
|
private int |
getSize(EBinaryNode t)
|
void |
insert(EmuEvent x)
Insert into the tree. |
boolean |
isEmpty()
Test if the tree is logically empty. |
void |
makeEmpty()
Make the tree logically empty. |
void |
printTree()
Print the tree contents in sorted order. |
private void |
printTree(EBinaryNode t)
Internal method to print a subtree in sorted order. |
void |
remove(EmuEvent x)
Remove from the tree. |
EmuEvent |
removeMin()
|
(package private) static EBinaryNode |
rotateWithLeftChild(EBinaryNode k2)
Rotate binary tree node with left child. |
(package private) static EBinaryNode |
rotateWithRightChild(EBinaryNode k1)
Rotate binary tree node with right child. |
private EBinaryNode |
splay(EmuEvent x,
EBinaryNode t)
Internal method to perform a top-down splay. |
ArrayList |
toArrayList()
|
private void |
toArrayList(EBinaryNode t,
ArrayList aList)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private EBNodeFarm ebnFarm
private EBinaryNode root
private static EBinaryNode nullNode
private static EBinaryNode newNode
private static EBinaryNode header
Constructor Detail |
---|
public ESplayTree()
Method Detail |
---|
public final void insert(EmuEvent x)
x
- the item to insert.public final void remove(EmuEvent x)
x
- the item to remove.public final EmuEvent findMin()
public final EmuEvent removeMin()
public final EmuEvent findMax()
public final EmuEvent find(EmuEvent x)
x
- the item to search for.
public final void makeEmpty()
public final boolean isEmpty()
public final void printTree()
private final EBinaryNode splay(EmuEvent x, EBinaryNode t)
x
- the target item to splay around.t
- the root of the subtree to splay.
static final EBinaryNode rotateWithLeftChild(EBinaryNode k2)
static final EBinaryNode rotateWithRightChild(EBinaryNode k1)
private final void printTree(EBinaryNode t)
t
- the node that roots the tree.public final ArrayList toArrayList()
private final void toArrayList(EBinaryNode t, ArrayList aList)
public final int getSize()
private final int getSize(EBinaryNode t)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |