org.ws4d.java.structures
Class LinkedSet

java.lang.Object
  extended by org.ws4d.java.structures.DataStructure
      extended by org.ws4d.java.structures.Set
          extended by org.ws4d.java.structures.HashSet
              extended by org.ws4d.java.structures.LinkedSet

public class LinkedSet
extends HashSet

This class is a hash set, in which the elements are linked together, ordered by their adding to the set. The last added object is added to the end of the sequence. Re-adding an already contained object won't change the order of the set. If touch ordering is set, accessed objects in the set will be moved to the end of the sequence.


Constructor Summary
LinkedSet()
          Constructor.
LinkedSet(DataStructure data)
          Constructor.
LinkedSet(int initialCapacity)
          Constructor.
LinkedSet(int initialCapacity, boolean touchOrdering)
          Constructor.
 
Method Summary
 java.lang.Object removeFirst()
          Removes the first element in the set.
 void touch(java.lang.Object obj)
          Moves the touched object to the end of the set if touch ordering is true and the given object is an element of the set.
 
Methods inherited from class org.ws4d.java.structures.HashSet
add, clear, contains, get, isEmpty, iterator, remove, size
 
Methods inherited from class org.ws4d.java.structures.Set
containsAll, equals, getClassShortName, hashCode
 
Methods inherited from class org.ws4d.java.structures.DataStructure
addAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkedSet

public LinkedSet()
Constructor.


LinkedSet

public LinkedSet(DataStructure data)
Constructor.

Parameters:
data -

LinkedSet

public LinkedSet(int initialCapacity)
Constructor.

Parameters:
initialCapacity -

LinkedSet

public LinkedSet(int initialCapacity,
                 boolean touchOrdering)
Constructor.

Parameters:
initialCapacity -
touchOrdering - access Ordering
Method Detail

touch

public void touch(java.lang.Object obj)
Moves the touched object to the end of the set if touch ordering is true and the given object is an element of the set.

Parameters:
obj -

removeFirst

public java.lang.Object removeFirst()
Removes the first element in the set.

Returns:
Returns oldest element. If no element is in set, it returns null.