All Packages Class Hierarchy This Package Previous Next Index
Class JObserve.Linkage
java.lang.Object
|
+----JObserve.Linkage
- public class Linkage
- extends Object
Linkage
Links for linked lists, basically just a pair of forward and reverse
links to similar objects and a generic object pointer.
The "backwards" pointer in the first object points to the last object
in the list; the "forward" pointer of the last element points to the
first element forming a doubly linked ring structure.
Generally, the list head is an empty element and the presence of a single
entry is taken as an empty list.
This was called QLinkage in the old C routines and all member functions
started with 'Q'.
-
Linkage()
- Default element constructor
-
Empty()
- Test a list for the empty condition
The list is considered empty if a single entry, the head remains.
-
Init()
- Initialize an empty list head.
-
InsertAfter(Linkage)
- Insert a new element after a given element
Call from given element.
-
InsertBefore(Linkage)
- Insert a new element before a given element
Call from given element.
-
InsertHead(Linkage)
- Insert a new element at the head of the list.
-
InsertTail(Linkage)
- Insert a new element at the tail of the list.
-
Predecessor()
- Return the predecessor of this element.
-
RemoveElement()
- Remove this element from the list.
-
RemoveHead()
- Remove the element at the front of the list.
-
RemoveTail()
- Remove the element at the end of the list.
-
Replace(Linkage)
- Replace one link in a list with another
-
Successor()
- Return the successor of this element.
-
Unlink()
- Unlink an element
Linkage
public Linkage()
- Default element constructor
Init
public Linkage Init()
- Initialize an empty list head.
- Returns:
-
Linkage
the (start) of a linked list
Unlink
public Linkage Unlink()
- Unlink an element
- Returns:
-
Linkage
the element
Predecessor
public Linkage Predecessor()
- Return the predecessor of this element.
A null element pointer returns a null predecessor pointer.
A single element list, returns a pointer to the given element.
- Returns:
-
Linkage
the previous element of the list.
Replace
public Linkage Replace(Linkage replacement)
- Replace one link in a list with another
- Returns:
-
Linkage
the old, now unlinked element
Successor
public Linkage Successor()
- Return the successor of this element.
A null element returns a null successor.
A single element list, returns a pointer to the given element.
- Returns:
-
Linkage
the next element of the list.
InsertHead
public Linkage InsertHead(Linkage NewElement)
- Insert a new element at the head of the list.
Call from list head.
- Parameters:
- New - first element for the linked list.
- Returns:
- Linkage the added element.
InsertTail
public Linkage InsertTail(Linkage NewElement)
- Insert a new element at the tail of the list.
Call from list head.
- Parameters:
-
Linkage
- New last element for the linked list.
- Returns:
-
Linkage
the new last element of the linked list.
InsertBefore
public Linkage InsertBefore(Linkage NewElement)
- Insert a new element before a given element
Call from given element.
- Parameters:
-
Linkage
- New element to be added to the linked list.
- Returns:
-
Linkage
the added element
InsertAfter
public Linkage InsertAfter(Linkage NewElement)
- Insert a new element after a given element
Call from given element.
- Parameters:
-
Linkage
- New element to be added to the linked list.
- Returns:
-
Linkage
the added element
RemoveHead
public Linkage RemoveHead()
- Remove the element at the front of the list.
Since the Head element is an empty place holder,
the next element (the first real one) is unlinked.
Call from list head.
- Returns:
-
Linkage
the deleted element, if null a one element list.
RemoveTail
public Linkage RemoveTail()
- Remove the element at the end of the list.
Call from list head.
- Returns:
-
Linkage
the deleted element, if null a one element list.
RemoveElement
public Linkage RemoveElement()
- Remove this element from the list.
- Returns:
-
Linkage
the deleted element
Empty
public boolean Empty()
- Test a list for the empty condition
The list is considered empty if a single entry, the head remains.
- Returns:
-
boolean
True if there's only a single entry (the head).
All Packages Class Hierarchy This Package Previous Next Index