home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Extras / OSpace / jgl.exe / jgl_2_0 / src / COM / objectspace / jgl / Set.java < prev    next >
Encoding:
Java Source  |  1997-03-14  |  1.6 KB  |  54 lines

  1. // Copyright(c) 1996,1997 ObjectSpace, Inc.
  2. // Portions Copyright(c) 1995, 1996 Hewlett-Packard Company.
  3.  
  4. package COM.objectspace.jgl;
  5.  
  6. /**
  7.  * Set is the interface that is implemented by all of the
  8.  * Generic Container Library sets.
  9.  * <p>
  10.  * @see COM.objectspace.jgl.HashSet
  11.  * @see COM.objectspace.jgl.OrderedSet
  12.  * @version 2.0.2
  13.  * @author ObjectSpace, Inc.
  14.  */
  15.  
  16. public interface Set extends Container
  17.   {
  18.   /**
  19.    * Return the first object that matches the given object, or null if no match exists.
  20.    * @param object The object to match against.
  21.    * @see COM.objectspace.jgl.Set#put
  22.    */
  23.   public Object get( Object object );
  24.  
  25.   /**
  26.    * If the object doesn't exist, add the object and return null, otherwise replace the
  27.    * first object that matches and return the old object.
  28.    * @param object The object to add.
  29.    * @see COM.objectspace.jgl.Set#get
  30.    */
  31.   public Object put( Object object );
  32.  
  33.   /**
  34.    * Remove all objects that match the given object.
  35.    * @param object The object to match for removals
  36.    * @return The number of objects removed.
  37.    */
  38.    public int remove( Object key );
  39.  
  40.   /**
  41.    * Remove at most a given number of objects that match the given object.
  42.    * @param object The object to match for removals
  43.    * @param count The maximum number of objects to remove.
  44.    * @return The number of objects removed.
  45.    */
  46.    public int remove( Object key, int count );
  47.  
  48.   /**
  49.    * Return the number of items that match a particular object.
  50.    * @param object The object to match against.
  51.    */
  52.   public int count( Object object );
  53.   }
  54.