|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Node
A object of the class, Node has an object that contains a reference to an object of type Comparable and a reference to another Node. Allows a Node to be inserted into a list at construction. Supports linking a subsequent object to this Node, will return the reference to the next Node, or the reference to the data Object. However, the data object is immutable once the object is constructed. Students are not allowed to modify this class
Constructor Summary | |
Node(java.lang.Comparable initValue)
Constructor builds the Node with the supplied parameter |
|
Node(java.lang.Comparable initValue,
Node initNext)
Constructor builds the Node with the supplied parameters |
Method Summary | |
int |
compareTo(java.lang.Object obj)
Compares value of Node to the parameter and returns: -1 if the Node is less than the parameter, 0 if the Node is equal to the parameter, and 1 if the Node is greater than the parameter |
java.lang.Comparable |
getData()
Returns reference to the data value of the object |
Node |
getNext()
Returns reference to the next Node |
void |
setNext(Node newNode)
Sets the next reference of this object to the paramter object |
java.lang.String |
toString()
Returns string representation of the object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Node(java.lang.Comparable initValue)
data
- initValue must be of type Comparablepublic Node(java.lang.Comparable initValue, Node initNext)
initValue
- must be of type Comparablelink
- to a next Node, or nullMethod Detail |
public Node getNext()
public void setNext(Node newNode)
newNodde
- which is an object of the class Nodepublic java.lang.Comparable getData()
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |