Class LLNode

java.lang.Object
  extended byLLNode
Direct Known Subclasses:
AgentNode, CharNode, StudentNode

public abstract class LLNode
extends Object


Field Summary
 LLNode next
          The next branch/node/whatever to process
 
Constructor Summary
LLNode()
          Constructor for LLNode just sets next to null
 
Method Summary
 void add(LLNode node)
          Add the input node after the last node in this list.
 int count()
          Return the count of the elements in the list
 LLNode getNext()
           
 void insertAfter(LLNode node)
          Insert the input node after this node.
 LLNode last()
          Return the last element in the list
 void remove(LLNode node)
          Method to remove node from list, fixing links appropriately.
 LLNode reverse()
          Reverse the list starting at this, and return the last element of the list.
 LLNode reverse2()
          Reverse2: Push all the elements on the stack, then pop all the elements off the stack.
 void setNext(LLNode nextOne)
          Methods to set and get next elements
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

next

public LLNode next
The next branch/node/whatever to process

Constructor Detail

LLNode

public LLNode()
Constructor for LLNode just sets next to null

Method Detail

setNext

public void setNext(LLNode nextOne)
Methods to set and get next elements

Parameters:
nextOne - next element in list

getNext

public LLNode getNext()

remove

public void remove(LLNode node)
Method to remove node from list, fixing links appropriately.

Parameters:
node - element to remove from list.

insertAfter

public void insertAfter(LLNode node)
Insert the input node after this node.

Parameters:
node - element to insert after this.

last

public LLNode last()
Return the last element in the list


count

public int count()
Return the count of the elements in the list


add

public void add(LLNode node)
Add the input node after the last node in this list.

Parameters:
node - element to insert after this.

reverse

public LLNode reverse()
Reverse the list starting at this, and return the last element of the list. The last element becomes the FIRST element of the list, and THIS goes to null.


reverse2

public LLNode reverse2()
Reverse2: Push all the elements on the stack, then pop all the elements off the stack.