home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / jgl_1_1 / jgl_1_1.exe / src / Container.java < prev    next >
Encoding:
Java Source  |  1996-09-10  |  1.8 KB  |  88 lines

  1. // Copyright(c) 1996 ObjectSpace, Inc.
  2. // Portions Copyright(c) 1995, 1996 Hewlett-Packard Company.
  3.  
  4. package jgl;
  5.  
  6. import java.util.Enumeration;
  7.  
  8. /**
  9.  * Container is the interface that is implemented by all of the
  10.  * Java Generic Library containers. 
  11.  * <p>
  12.  * @see jgl.Array
  13.  * @see jgl.Deque
  14.  * @see jgl.DList
  15.  * @see jgl.HashMap
  16.  * @see jgl.HashSet
  17.  * @see jgl.OrderedMap
  18.  * @see jgl.OrderedSet
  19.  * @see jgl.PriorityQueue
  20.  * @see jgl.Queue
  21.  * @see jgl.SList
  22.  * @see jgl.Stack
  23.  * @version 1.1
  24.  * @author ObjectSpace, Inc.
  25.  */
  26.  
  27. public interface Container extends Cloneable
  28.   {
  29.   /**
  30.    * Return a shallow copy of myself.
  31.    */
  32.   public Object clone();
  33.  
  34.   /**
  35.    * Return a string that describes me.
  36.    */
  37.   public String toString();
  38.  
  39.   /**
  40.    * Return true if I'm equal to a specified object.
  41.    * @param object The object to compare myself against.
  42.    * @return true if I'm equal to the specified object.
  43.    */
  44.   public boolean equals( Object object );
  45.   
  46.   /**
  47.    * Return the number of objects that I contain.
  48.    */
  49.   public int size();
  50.  
  51.   /**
  52.    * Return the maximum number of objects that I can contain.
  53.    */
  54.   public int maxSize();
  55.  
  56.   /**
  57.    * Return true if I contain no objects.
  58.    */
  59.   public boolean isEmpty();
  60.  
  61.   /**
  62.    * Remove all of my objects.
  63.    */
  64.   public void clear();
  65.  
  66.   /**
  67.    * Return an Enumeration of the components in this container
  68.    */
  69.   public Enumeration elements();
  70.  
  71.   /**
  72.    * Return an iterator positioned at my first item.
  73.    */
  74.   public ForwardIterator start();
  75.  
  76.   /**
  77.    * Return an iterator positioned immediately after my last item.
  78.    */
  79.   public ForwardIterator finish();
  80.  
  81.   /**
  82.    * Add an object to myself. If appropriate, return the object that it replaced, otherwise
  83.    * return null.
  84.    */
  85.   public Object add( Object object );
  86.   }
  87.  
  88.