structure
Class SetList

java.lang.Object
  extended by structure.AbstractStructure
      extended by structure.AbstractSet
          extended by structure.SetList
All Implemented Interfaces:
Set, Structure

public class SetList
extends AbstractSet

An implementation of a set using lists.


Constructor Summary
SetList()
          Construct a new set list.
 
Method Summary
 void add(Object e)
          Add an element to set, if not already present.
 void addAll(Structure other)
          Compute the union of this set with other.
 void clear()
          Remove all the elements from the set.
 Object clone()
          Returns a shallow clone of this set.
 boolean contains(Object e)
          Returns true if value is an element of the set.
 boolean containsAll(Structure other)
          Determine if this set is a subset of other.
 boolean isEmpty()
          Determine if the set is empty.
 Iterator iterator()
          Construct an traversal to traverse the elements of the set.
 Object remove(Object e)
          Remove an element from the set.
 void removeAll(Structure other)
          Compute the difference between two sets.
 void retainAll(Structure other)
          Compute the intersection of this set and other.
 int size()
          Determine the number of elements in the set.
 String toString()
          Construct a string representation of the set.
 
Methods inherited from class structure.AbstractStructure
elements, hashCode, values
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface structure.Structure
elements, values
 

Constructor Detail

SetList

public SetList()
Construct a new set list.

Method Detail

clear

public void clear()
Remove all the elements from the set.


isEmpty

public boolean isEmpty()
Determine if the set is empty.

Specified by:
isEmpty in interface Structure
Overrides:
isEmpty in class AbstractStructure
Returns:
True iff there are no elements in set.

add

public void add(Object e)
Add an element to set, if not already present.

Parameters:
e - The new value to be added to set.

remove

public Object remove(Object e)
Remove an element from the set.

Parameters:
e - The element of the set to be removed.
Returns:
The value actually removed.

contains

public boolean contains(Object e)
Returns true if value is an element of the set.

Specified by:
contains in interface Structure
Overrides:
contains in class AbstractStructure
Parameters:
e - The element sought in set.
Returns:
True iff the element is in the set.

containsAll

public boolean containsAll(Structure other)
Determine if this set is a subset of other.

Specified by:
containsAll in interface Set
Overrides:
containsAll in class AbstractSet
Parameters:
other - The potential superset.

clone

public Object clone()
Returns a shallow clone of this set.

Overrides:
clone in class Object
Returns:
A new set with same values.

addAll

public void addAll(Structure other)
Compute the union of this set with other. This set not modified.

Specified by:
addAll in interface Set
Overrides:
addAll in class AbstractSet
Parameters:
other - The set to be unioned with this.

retainAll

public void retainAll(Structure other)
Compute the intersection of this set and other. Members of result are in both this and other.

Specified by:
retainAll in interface Set
Overrides:
retainAll in class AbstractSet
Parameters:
other - The other set to be intersected with this.

removeAll

public void removeAll(Structure other)
Compute the difference between two sets. Values of the result are members of this, but not other.

Specified by:
removeAll in interface Set
Overrides:
removeAll in class AbstractSet
Parameters:
other - The set whose values are to be eliminated from this.

iterator

public Iterator iterator()
Construct an traversal to traverse the elements of the set. Elements will not appear in any particular order.

Returns:
An traversal for inspecting members of the set.
See Also:
AbstractIterator, Iterator, Enumeration, Structure.elements()

size

public int size()
Determine the number of elements in the set.

Returns:
The number of elements in the set.

toString

public String toString()
Construct a string representation of the set.

Overrides:
toString in class Object
Returns:
A string representing the set.