|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.ksu.cis.viewer.SplayTree
An immutable splay tree that can draw itself. A splay tree is self-adjusting in the sense that the deepest node accessed on any operation is brought to the root. By using double rotations whenever possible, logarathmic amortized peformance is achieved. This implementation is top-down. As a result, if a single rotation must occur, it occurs at the lowest point in the path traversed.
Constructor Summary | |
SplayTree()
Constructs an empty SplayTree. |
Method Summary | |
Object |
clone()
Because this structure is immutable, this method simply returns this tree. |
JComponent |
getDrawing()
Returns a drawing of this tree. |
JComponent |
getDrawing(Font fnt)
Returns a drawing of this tree using the given Font. |
BSTInterface |
put(String key)
Returns the tree resulting from the insert of the given key. |
BSTInterface |
remove(String key)
Returns the tree resulting from the removal of the given key. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SplayTree()
Method Detail |
public BSTInterface put(String key) throws NullPointerException
put
in interface BSTInterface
NullPointerException
- If key is nullpublic BSTInterface remove(String key) throws NullPointerException
remove
in interface BSTInterface
NullPointerException
- If key is nullpublic JComponent getDrawing()
getDrawing
in interface BSTInterface
public JComponent getDrawing(Font fnt) throws NullPointerException
getDrawing
in interface BSTInterface
NullPointerException
- if fnt is null.public Object clone()
clone
in interface BSTInterface
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |