scranton
Class Linear1

java.lang.Object
  extended byscranton.Linear1
Direct Known Subclasses:
Linear1Ind, Linear2, RecursiveBinaryTreeViaLinear1

public class Linear1
extends java.lang.Object

Fundamental class for constructing linear recursive objects.


Field Summary
protected  java.lang.Object data
          Field (possibly null) referencing the object associated to this Linear1 object.
protected  Linear1 link
          Field (possibly null) referencing the Linear1 object that follows this one in the recursive structure.
 
Constructor Summary
Linear1()
          Constructs a "null" Linear1 object.
Linear1(java.lang.Object data)
          Constructs an non-empty Linear1 object with no recursive reference (a null reference).
Linear1(java.lang.Object data, Linear1 link)
          Constructs a non empty Linear1 object with a recursive reference to a next (possibly null) object.
 
Method Summary
 Linear1 factory()
          Returns a null Linear1() object
 java.lang.Object getData()
          Returns reference to the object referenced by the data field.
 Linear1 getLink()
          Returns reference to the next Linear1 recursive object.
 void setData(java.lang.Object newData)
          Replace the current data field reference with a reference to newData.
 void setLink(Linear1 newLink)
          Replace the current contents of the link field with a reference to the newLink Linear1 object.
 java.lang.String toString()
          Returns a string composed of a tab delimited sequence of the data.toString()s of the objects in the recursive Linear1 structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected java.lang.Object data
Field (possibly null) referencing the object associated to this Linear1 object.


link

protected Linear1 link
Field (possibly null) referencing the Linear1 object that follows this one in the recursive structure.

Constructor Detail

Linear1

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

See Also:
Object.Object()

Linear1

public Linear1(java.lang.Object data)
Constructs an non-empty Linear1 object with no recursive reference (a null reference).

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

Linear1

public Linear1(java.lang.Object data,
               Linear1 link)
Constructs a non empty Linear1 object with a recursive reference to a next (possibly null) object.

Parameters:
data - Reference to the object that corresponds to this Linear1 object.
link - Recursive reference to the next Linear1 object.
Method Detail

getData

public java.lang.Object getData()
Returns reference to the object referenced by the data field.

Returns:
Object Reference to the current associated object.

setData

public void setData(java.lang.Object newData)
Replace the current data field reference with a reference to newData.

Parameters:
newData - New object to be associated with this Linear1 object.

getLink

public Linear1 getLink()
Returns reference to the next Linear1 recursive object. WARNING: if improperly used it could create an alias to the object references by link.

Returns:
Linear1 Reference (possibly null) to the next recursive Linear1 object.

setLink

public void setLink(Linear1 newLink)
Replace the current contents of the link field with a reference to the newLink Linear1 object.

Parameters:
newLink - The recursive Linear1 object (possibly null) referenced after this Linear1 object.

toString

public java.lang.String toString()
Returns a string composed of a tab delimited sequence of the data.toString()s of the objects in the recursive Linear1 structure.

Returns:
String Returns a tab delimited string of the objects in the recursive Linear1 structure.

factory

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

Returns:
A null Linear1() object