Release Planner v1.0

rp.util
Class TwoList

java.lang.Object
  |
  +--rp.util.TwoList
Direct Known Subclasses:
DOMObject, DOMRelation, DOMRelation.Endpoint

public class TwoList
extends java.lang.Object

A utility baseclass providing storage and associated functions operating on two doubly-linked circular lists, A and B. One element of the list is specially designated as the head.

Version:
$Revision: 1.1 $, $Date: 2001/06/25 15:03:48 $

Nested Class Summary
protected static interface TwoList.Iterator
          Used for iterating over TwoList lists (A or B).
protected static class TwoList.IteratorA
          An implementation of the Iterator interface for A-lists.
protected static class TwoList.IteratorB
          An implementation of the Iterator interface for B-lists.
 
Field Summary
protected  TwoList headA
           
protected  TwoList headB
           
protected  TwoList nextA
           
protected  TwoList nextB
           
protected  int numsA
           
protected  int numsB
           
protected  TwoList prevA
           
protected  TwoList prevB
           
 
Constructor Summary
protected TwoList()
          Initializes node storage as unused.
 
Method Summary
protected  void addA(TwoList head)
          Adds this element at the rear of the A-list headed by the parameter.
protected  void addB(TwoList head)
          Adds this element at the rear of the B-list headed by the parameter.
protected  int countA()
          Returns the number of nodes in the A-list of which this node is a part (or head).
protected  int countB()
          Returns the number of nodes in the B-list of which this node is a part (or head).
protected  void decommissionAsHeadA()
          Frees this A head node to be used again.
protected  void decommissionAsHeadB()
          Frees this B head node to be used again.
protected  TwoList firstA()
          Returns the first element on the A-list, or null if none.
protected  TwoList firstB()
          Returns the first element on the B-list, or null if none.
 TwoList headA()
          Returns the head of the A-list or null if not initialized.
 TwoList headB()
          Returns the head of the B-list or null if not initialized.
protected  void initAsHeadA()
          Initializes this node as the head of an empty A-list.
protected  void initAsHeadB()
          Initializes this node as the head of an empty B-list.
protected  boolean isElementA()
          Tests if this node is an element of an A-list (but not the head)
protected  boolean isElementB()
          Tests if this node is an element of a B-list (but not the head)
protected  boolean isHeadA()
          Tests if this node is a head of an A-list.
protected  boolean isHeadB()
          Tests if this node is a head of a B-list.
protected  void rmA()
          Removes this element from the A-list.
protected  void rmB()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numsA

protected int numsA

numsB

protected int numsB

headA

protected TwoList headA

headB

protected TwoList headB

nextA

protected TwoList nextA

nextB

protected TwoList nextB

prevA

protected TwoList prevA

prevB

protected TwoList prevB
Constructor Detail

TwoList

protected TwoList()
Initializes node storage as unused. Protected constructor indicating use as baseclass.

Method Detail

initAsHeadA

protected void initAsHeadA()
Initializes this node as the head of an empty A-list.


initAsHeadB

protected void initAsHeadB()
Initializes this node as the head of an empty B-list.


decommissionAsHeadA

protected void decommissionAsHeadA()
Frees this A head node to be used again.


decommissionAsHeadB

protected void decommissionAsHeadB()
Frees this B head node to be used again.


isHeadA

protected boolean isHeadA()
Tests if this node is a head of an A-list.

Returns:
if this node is the head of an A-list.

isHeadB

protected boolean isHeadB()
Tests if this node is a head of a B-list.

Returns:
if this node is the head of a B-list.

isElementA

protected boolean isElementA()
Tests if this node is an element of an A-list (but not the head)

Returns:
if this node is an element of an A-list.

isElementB

protected boolean isElementB()
Tests if this node is an element of a B-list (but not the head)

Returns:
if this node is an element of a B-list.

countA

protected int countA()
Returns the number of nodes in the A-list of which this node is a part (or head).

Returns:
the number of elements in the A-list.

countB

protected int countB()
Returns the number of nodes in the B-list of which this node is a part (or head).

Returns:
the number of elements in the B-list.

headA

public TwoList headA()
Returns the head of the A-list or null if not initialized.

Returns:
the head of the A-list.

headB

public TwoList headB()
Returns the head of the B-list or null if not initialized.

Returns:
the head of the B-list.

firstA

protected TwoList firstA()
Returns the first element on the A-list, or null if none. Only valid for heads.

Returns:
the first element on the A-list, or null if none.

firstB

protected TwoList firstB()
Returns the first element on the B-list, or null if none. Only valid for heads.

Returns:
the first element on the B-list, or null if none.

addA

protected void addA(TwoList head)
Adds this element at the rear of the A-list headed by the parameter.

Parameters:
head - the head of the list to which to add this element

addB

protected void addB(TwoList head)
Adds this element at the rear of the B-list headed by the parameter.

Parameters:
head - the head of the list to which to add this element

rmA

protected void rmA()
Removes this element from the A-list. Illegal for heads.


rmB

protected void rmB()

Release Planner v1.0