jclass
Class SimpleSet

java.lang.Object
  |
  +--jclass.SimpleSet

public class SimpleSet
extends java.lang.Object

A class reprezenting a simple set of objects which allows also synchronized access. Inside a set there are no two equal objects. In order to be consistently handled by this class, the objects that are to be included here should implement the equals() and hashCode() methods properly.

Should implement reunion, intersection etc. !? ;)
Written: Radu Sion
Version: 0.15a
Source: SimpleSet.java

Visit Smart Software 

See Also:
Object.equals(java.lang.Object), Object.hashCode()

Constructor Summary
SimpleSet()
          Constructs a new empty set.
 
Method Summary
 void add(java.lang.Object oo)
          Adds a new object to the set ( no testings are done on the object )
 java.util.Enumeration elements()
          Returns an enumeration of the values in this set.
 boolean isEmpty()
          Tests if the set is empty
 boolean isInSet(java.lang.Object oo)
          Finds out if a certain object is inside the current set.
 void remove(java.lang.Object oo)
          Removes a given object from the set (no testings are done on the object)
 int size()
          Returns the current size (objects) of the set
 java.lang.String toString()
           
 java.util.Vector toVector()
          Returns a vector with the objects in this set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail
A NAME="SimpleSet()">

SimpleSet

public SimpleSet()
Constructs a new empty set.
Method Detail

isEmpty

public boolean isEmpty()
Tests if the set is empty

size

public int size()
Returns the current size (objects) of the set

isInSet

public boolean isInSet(java.lang.Object oo)
Finds out if a certain object is inside the current set.
Parameters:
oo - Object to look for

add

public void add(java.lang.Object oo)
Adds a new object to the set ( no testings are done on the object )
Parameters:
oo - The object to add to this set

remove

public void remove(java.lang.Object oo)
Removes a given object from the set (no testings are done on the object)
Parameters:
oo - The object to remove from this set

elements

public java.util.Enumeration elements()
Returns an enumeration of the values in this set. Use the Enumeration methods on the returned object to fetch the elements sequentially.

toVector

public java.util.Vector toVector()
Returns a vector with the objects in this set.
Returns:
A vector of objects

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object