scranton
Class Linear2

java.lang.Object
  extended byscranton.Linear1
      extended byscranton.Linear2
Direct Known Subclasses:
Linear2Ind

public class Linear2
extends Linear1

Extends the Linear1 class to a class to construct two way linked linearly recursive collection objects.


Field Summary
protected  Linear2 previous
          Field (possibly null) referencing the recursive Linear2 object that precedes this object.
 
Fields inherited from class scranton.Linear1
data, link
 
Constructor Summary
Linear2()
          Constructs a "null" Linear2 object.
Linear2(Linear2 newPrev, java.lang.Object data, Linear2 newNext)
          Linear2 constructor creates a non empty object with a given recursive reference to another (possibly null) object.
Linear2(java.lang.Object data)
          Constructs a non-empty object with (null reference) no preceding or following recursive references.
 
Method Summary
 Linear1 factory()
          Returns a null Linear2() object
 Linear2 getNext()
          Returns reference to the Linear2 recursive object that follows this Linear2 object.
 Linear2 getPrevious()
          Returns reference to the Linear2 recursive object that precedes this Linear2 object.
 void setNext(Linear2 newNext)
          Replace the current contents of the link field with a reference to the newLink Linear2 object.
 void setPrevious(Linear2 newPrev)
          Replace the current contents of the previous field with a reference to the newLink Linear2 object.
 
Methods inherited from class scranton.Linear1
getData, getLink, setData, setLink, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

previous

protected Linear2 previous
Field (possibly null) referencing the recursive Linear2 object that precedes this object.

Constructor Detail

Linear2

public Linear2()
Constructs a "null" Linear2 object.

See Also:
Object.Object()

Linear2

public Linear2(java.lang.Object data)
Constructs a non-empty object with (null reference) no preceding or following recursive references.

Parameters:
data - The item to be referenced by this Linear1 object.

Linear2

public Linear2(Linear2 newPrev,
               java.lang.Object data,
               Linear2 newNext)
Linear2 constructor creates a non empty object with a given recursive reference to another (possibly null) object.

Parameters:
newPrev - Reference to the Linear2 recursive object (possibly null) that precedes this object.
data - Reference to the object associated with this Linear2 object.
newNext - Recursive reference to the next (possibly null) Linear2 object.
Method Detail

getPrevious

public Linear2 getPrevious()
Returns reference to the Linear2 recursive object that precedes this Linear2 object. WARNING: if improperly used it could create an alias to the object references by link.

Returns:
Linear2 Reference (possibly null) to the preceding recursive Linear2 object.

getNext

public Linear2 getNext()
Returns reference to the Linear2 recursive object that follows this Linear2 object. WARNING: if improperly used it could create an alias to the object references by link.

Returns:
Linear2 Reference (possibly null) to the following recursive Linear2 object.

setPrevious

public void setPrevious(Linear2 newPrev)
Replace the current contents of the previous field with a reference to the newLink Linear2 object.

Parameters:
newPrev - The recursive Linear2 object (possibly null) referenced before this Linear2 object.

setNext

public void setNext(Linear2 newNext)
Replace the current contents of the link field with a reference to the newLink Linear2 object.

Parameters:
newNext - The recursive Linear2 object (possibly null) referenced after this Linear2 object.

factory

public Linear1 factory()
Returns a null Linear2() object

Overrides:
factory in class Linear1
Returns:
A null Linear2() object