jfig.objects
Class FigObjectList

java.lang.Object
  extended byjfig.objects.FigObjectList
All Implemented Interfaces:
java.util.Enumeration

public final class FigObjectList
extends java.lang.Object
implements java.util.Enumeration

layer-sorted doubly-linked list.

FigObjectList provides a simple doubly-linked and layer-sorted list data structure to store FIG objects.


Nested Class Summary
(package private)  class FigObjectList.ListEnumerator
           
(package private)  class FigObjectList.ReverseListEnumerator
           
 
Field Summary
(package private)  ListNode enumerationNode
           
(package private)  java.lang.String name
           
(package private)  ListNode otmp
           
(package private)  ListNode root
           
 
Constructor Summary
FigObjectList()
          constructor for an empty object list
FigObjectList(java.lang.String name)
          constructor for an named empty object list
 
Method Summary
 void append(FigObject obj)
          append an object to the list.
 FigObjectList copy()
          create a copy of this list.
 boolean delete(FigObject obj)
          delete the list item that points to the FigObject obj.
 boolean delete(ListNode node)
          delete 'node' from the list.
 boolean deleteAll()
           
 boolean deleteAllSLOW()
          delete all items from this list.
 java.util.Enumeration elements_old()
          return an Enumeration of all elements in this list.
 java.util.Enumeration elements()
           
 boolean empty()
          is this list empty?
 ListNode get_first()
          return the first node of this list
 ListNode get_last()
          return the last node of this list
 ListNode get_next(ListNode node)
          return the next node on this list and null for the last node
 ListNode get_prev(ListNode node)
          return the previous node on this list and null for the first node
 ListNode get_root()
          return the root node of this list
 boolean hasMoreElements()
           
 void insert(FigObject obj)
          insert an object into the list --- as the first object on the object's layer.
 java.lang.Object nextElement()
           
 void prepend(FigObject obj)
          prepend this object to the start of the list (independent of the object's layer).
 void print()
          Print the list objects.
 java.util.Enumeration reverseElements()
           
 ListNode search(java.awt.Point wp)
          search an object on this list that is nearest to Point wp and return the reference to the list node.
 ListNode search(java.awt.Point wp, int max_distance)
           
 ListNode search(java.awt.Point wp, ListNode node)
          search an object on this list that is nearest to Point wp (world coordinates) and return the reference to this object.
 ListNode search(java.awt.Point wp, ListNode node, int max_distance)
          starting from node, search for an object on this list with maximum distance "max_distance" from Point wp.
 void sort()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

ListNode root

otmp

ListNode otmp

name

java.lang.String name

enumerationNode

ListNode enumerationNode
Constructor Detail

FigObjectList

public FigObjectList()
constructor for an empty object list


FigObjectList

public FigObjectList(java.lang.String name)
constructor for an named empty object list

Parameters:
name - The name for this list.
Method Detail

get_root

public final ListNode get_root()
return the root node of this list


get_first

public final ListNode get_first()
return the first node of this list


get_last

public final ListNode get_last()
return the last node of this list


get_next

public final ListNode get_next(ListNode node)
return the next node on this list and null for the last node


get_prev

public final ListNode get_prev(ListNode node)
return the previous node on this list and null for the first node


append

public final void append(FigObject obj)
append an object to the list. This function appends the object at the last position, independent of the object's layer.

Parameters:
obj - The object to append.

prepend

public final void prepend(FigObject obj)
prepend this object to the start of the list (independent of the object's layer).


insert

public final void insert(FigObject obj)
insert an object into the list --- as the first object on the object's layer. Note that the list starts with the highest layer.

Parameters:
obj - The object to insert.

delete

public final boolean delete(ListNode node)
delete 'node' from the list.

Returns:
value: true if node could be deleted, false if node wasn't found on the list.

delete

public final boolean delete(FigObject obj)
delete the list item that points to the FigObject obj.


deleteAllSLOW

public final boolean deleteAllSLOW()
delete all items from this list.


deleteAll

public final boolean deleteAll()

copy

public final FigObjectList copy()
create a copy of this list.


search

public final ListNode search(java.awt.Point wp)
search an object on this list that is nearest to Point wp and return the reference to the list node.


search

public final ListNode search(java.awt.Point wp,
                             ListNode node)
search an object on this list that is nearest to Point wp (world coordinates) and return the reference to this object. Start the search beginning with 'node'.


search

public ListNode search(java.awt.Point wp,
                       ListNode node,
                       int max_distance)
starting from node, search for an object on this list with maximum distance "max_distance" from Point wp. Return the reference to the first matching list node, if any. Calculate the distance of the object to Point wp by calling object.minDistance()


search

public ListNode search(java.awt.Point wp,
                       int max_distance)

print

public void print()
Print the list objects.


empty

public boolean empty()
is this list empty?


elements_old

public java.util.Enumeration elements_old()
return an Enumeration of all elements in this list.


hasMoreElements

public boolean hasMoreElements()
Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()
Specified by:
nextElement in interface java.util.Enumeration

elements

public java.util.Enumeration elements()

reverseElements

public java.util.Enumeration reverseElements()

sort

public void sort()