seda.sandStorm.core
Class ssLinkedList

java.lang.Object
  extended by seda.sandStorm.core.ssLinkedList

public class ssLinkedList
extends java.lang.Object

The ssLinkedList class is just that - a linked list abstraction that supports very efficient insertion and deletion, as well as an Enumeration interface. None of the methods in this linked list are synchronized. If you want synchronization, do it yourself.


Nested Class Summary
private  class ssLinkedList.ssLinkedListElement
          This inner class is the chaining mechanism for the linked list
 class ssLinkedList.ssLinkedListEnumeration
          A ssLinkedListEnumeration is a java.util.Enumeration over the ssLinkedList elements.
 
Field Summary
private  ssLinkedList.ssLinkedListElement first
           
private static int HEAP_ALLOC_NUM
           
private  ssLinkedList.ssLinkedListElement last
           
private static ssLinkedListEqualityComparator ll_equality_comparator
           
private  ssLinkedList.ssLinkedListElement[] lle_heap
           
private  int num_in_list
           
private  int num_in_lle_heap
           
private static int NUM_IT
          Test code for the ssLinkedList
 
Constructor Summary
ssLinkedList()
          Allocates a brand new ssLinkedList
 
Method Summary
 void add_to_head(java.lang.Object o)
          Adds an object to the head (start) of the linked list.
 void add_to_tail(java.lang.Object o)
          Adds an object to the tail (end) of the linked list.
private  ssLinkedList.ssLinkedListElement alloc_lle(java.lang.Object o)
           
 java.util.Enumeration elements()
          Returns a java.util.Enumeration enumeration over the elements of the linked list.
private  void free_lle(ssLinkedList.ssLinkedListElement lle)
           
 java.lang.Object get_comparator(java.lang.Object known, ssLinkedListComparator llc)
          Gets the first object to match according to the comparator function.
 java.lang.Object get_head()
          Gets the head object from the linked list.
 java.lang.Object get_item(java.lang.Object known)
          Returns the first object that is "equal" to the given object, based on the response of the Object.equals() method.
 java.lang.Object get_tail()
          Gets the tail object from the linked list.
static void main(java.lang.String[] args)
           
private static void printTime(long long1, long long3, int int5)
           
 void remove_all()
           
 java.lang.Object remove_comparator(java.lang.Object known, ssLinkedListComparator llc)
          Removes the first object to match according to the comparator function, and returns it.
 java.lang.Object remove_head()
          Removes the head object from the linked list, and returns it.
 java.lang.Object remove_item(java.lang.Object known)
          Removes the first object that is "equal" to the given object, based on the response of the Object.equals() method.
 java.lang.Object remove_tail()
          Removes the tail object from the linked list, and returns it.
 int size()
          Returns the number of elements in the list
 java.lang.String toString()
          Return a string representation, for debugging purposes
 java.lang.String toString(java.lang.String prefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

num_in_list

private int num_in_list

first

private ssLinkedList.ssLinkedListElement first

last

private ssLinkedList.ssLinkedListElement last

lle_heap

private ssLinkedList.ssLinkedListElement[] lle_heap

num_in_lle_heap

private int num_in_lle_heap

HEAP_ALLOC_NUM

private static final int HEAP_ALLOC_NUM
See Also:
Constant Field Values

ll_equality_comparator

private static ssLinkedListEqualityComparator ll_equality_comparator

NUM_IT

private static final int NUM_IT
Test code for the ssLinkedList

See Also:
Constant Field Values
Constructor Detail

ssLinkedList

public ssLinkedList()
Allocates a brand new ssLinkedList

Method Detail

alloc_lle

private ssLinkedList.ssLinkedListElement alloc_lle(java.lang.Object o)

free_lle

private void free_lle(ssLinkedList.ssLinkedListElement lle)

size

public int size()
Returns the number of elements in the list

Returns:
number of elements in the list

add_to_tail

public void add_to_tail(java.lang.Object o)
Adds an object to the tail (end) of the linked list.

Parameters:
o - the object to add

get_tail

public java.lang.Object get_tail()
Gets the tail object from the linked list.

Returns:
the tail, or null if there is nothing in the list.

remove_tail

public java.lang.Object remove_tail()
Removes the tail object from the linked list, and returns it.

Returns:
the tail, or null if there is nothing in the list.

add_to_head

public void add_to_head(java.lang.Object o)
Adds an object to the head (start) of the linked list.

Parameters:
o - the object to add

get_head

public java.lang.Object get_head()
Gets the head object from the linked list.

Returns:
the head, or null if there is nothing in the list.

remove_head

public java.lang.Object remove_head()
Removes the head object from the linked list, and returns it.

Returns:
the head, or null if there is nothing in the list.

remove_all

public void remove_all()

get_comparator

public java.lang.Object get_comparator(java.lang.Object known,
                                       ssLinkedListComparator llc)
Gets the first object to match according to the comparator function.

Returns:
the matching object, or null if there is nothing that matches.

remove_comparator

public java.lang.Object remove_comparator(java.lang.Object known,
                                          ssLinkedListComparator llc)
Removes the first object to match according to the comparator function, and returns it.

Returns:
the match, or null if there is nothing that matches.

get_item

public java.lang.Object get_item(java.lang.Object known)
Returns the first object that is "equal" to the given object, based on the response of the Object.equals() method.


remove_item

public java.lang.Object remove_item(java.lang.Object known)
Removes the first object that is "equal" to the given object, based on the response of the Object.equals() method.


elements

public java.util.Enumeration elements()
Returns a java.util.Enumeration enumeration over the elements of the linked list. If you modify the list while enumerating over it, you get what you deserve (i.e. undefined behaviour).

Returns:
the enumeration over the elements
See Also:
Enumeration

toString

public java.lang.String toString()
Return a string representation, for debugging purposes

Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.lang.String prefix)

printTime

private static void printTime(long long1,
                              long long3,
                              int int5)

main

public static void main(java.lang.String[] args)