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 / Container.java < prev    next >
Encoding:
Java Source  |  1997-03-14  |  2.3 KB  |  98 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. import java.util.Enumeration;
  7. import java.io.Serializable;
  8.  
  9. /**
  10.  * Container is the interface that is implemented by all of the
  11.  * Generic Container Library containers.
  12.  * <p>
  13.  * @see COM.objectspace.jgl.Array
  14.  * @see COM.objectspace.jgl.Deque
  15.  * @see COM.objectspace.jgl.DList
  16.  * @see COM.objectspace.jgl.HashMap
  17.  * @see COM.objectspace.jgl.HashSet
  18.  * @see COM.objectspace.jgl.OrderedMap
  19.  * @see COM.objectspace.jgl.OrderedSet
  20.  * @see COM.objectspace.jgl.PriorityQueue
  21.  * @see COM.objectspace.jgl.Queue
  22.  * @see COM.objectspace.jgl.SList
  23.  * @see COM.objectspace.jgl.Stack
  24.  * @version 2.0.2
  25.  * @author ObjectSpace, Inc.
  26.  */
  27.  
  28. public interface Container extends Cloneable, Serializable
  29.   {
  30.   /**
  31.    * Return a shallow copy of myself.
  32.    */
  33.   public Object clone();
  34.  
  35.   /**
  36.    * Return a string that describes me.
  37.    */
  38.   public String toString();
  39.  
  40.   /**
  41.    * Return true if I'm equal to a specified object.
  42.    * @param object The object to compare myself against.
  43.    * @return true if I'm equal to the specified object.
  44.    */
  45.   public boolean equals( Object object );
  46.  
  47.   /**
  48.    * Return the number of objects that I contain.
  49.    */
  50.   public int size();
  51.  
  52.   /**
  53.    * Return the maximum number of objects that I can contain.
  54.    */
  55.   public int maxSize();
  56.  
  57.   /**
  58.    * Return true if I contain no objects.
  59.    */
  60.   public boolean isEmpty();
  61.  
  62.   /**
  63.    * Remove all of my objects.
  64.    */
  65.   public void clear();
  66.  
  67.   /**
  68.    * Return an Enumeration of the components in this container
  69.    */
  70.   public Enumeration elements();
  71.  
  72.   /**
  73.    * Return an iterator positioned at my first item.
  74.    */
  75.   public ForwardIterator start();
  76.  
  77.   /**
  78.    * Return an iterator positioned immediately after my last item.
  79.    */
  80.   public ForwardIterator finish();
  81.  
  82.   /**
  83.    * Add an object to myself. If appropriate, return the object that 
  84.    * displaced it, otherwise return null.
  85.    */
  86.   public Object add( Object object );
  87.  
  88.   /**
  89.    * Remove the element at a particular position.
  90.    */
  91.   public Object remove( Enumeration pos );
  92.  
  93.   /**
  94.    * Remove the elements in the specified range.
  95.    */
  96.   public int remove( Enumeration first, Enumeration last );
  97.   }
  98.