geirm       01/04/16 15:39:21

  Modified:    collections build.xml
               collections/src/java/org/apache/commons/collections
                        ArrayStack.java
  Log:
  Applied Scott Sanders' patch restoring the peek(n) method.
  
  Revision  Changes    Path
  1.2       +2 -2      jakarta-commons/collections/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/build.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.xml 2001/04/14 15:39:03     1.1
  +++ build.xml 2001/04/16 22:39:20     1.2
  @@ -1,4 +1,4 @@
  -<!-- $Id: build.xml,v 1.1 2001/04/14 15:39:03 rwaldhoff Exp $ -->
  +<!-- $Id: build.xml,v 1.2 2001/04/16 22:39:20 geirm Exp $ -->
   <project name="commons-collections" default="test" basedir=".">
   
      <!-- patternset describing files to be copied from the doc directory -->
  @@ -140,7 +140,7 @@
                  bottom="&lt;small&gt;Copyright &amp;copy; 2001 Apache Software 
Foundation. Documenation generated ${TODAY}&lt;/small&gt;."
                  public="true"
                  version="true"
  -               author="false"
  +               author="true"
                  splitindex="false"
                  nodeprecated="true"
                  nodeprecatedlist="true"
  
  
  
  1.2       +23 -4     
jakarta-commons/collections/src/java/org/apache/commons/collections/ArrayStack.java
  
  Index: ArrayStack.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ArrayStack.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArrayStack.java   2001/04/14 19:32:37     1.1
  +++ ArrayStack.java   2001/04/16 22:39:21     1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ArrayStack.java,v
 1.1 2001/04/14 19:32:37 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/04/14 19:32:37 $
  + * $Header: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ArrayStack.java,v
 1.2 2001/04/16 22:39:21 geirm Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/04/16 22:39:21 $
    *
    * ====================================================================
    *
  @@ -75,7 +75,7 @@
    * worry about multiple thread contention.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2001/04/14 19:32:37 $
  + * @version $Revision: 1.2 $ $Date: 2001/04/16 22:39:21 $
    * @see java.util.Stack
    */
   
  @@ -110,6 +110,25 @@
   
       }
   
  +    /**
  +     * Return the n'th item down (zero-relative) from the top of this
  +     * stack without removing it.
  +     *
  +     * @param n Number of items down to go
  +     *
  +     * @exception EmptyStackException if there are not enough items on the
  +     *  stack to satisfy this request
  +     */
  +    public Object peek(int n) throws EmptyStackException {
  +        
  +        int m = (size() - n) - 1;
  +        if (m < 0)
  +            throw new EmptyStackException();
  +        else
  +            return (get(m));
  +        
  +    }
  +    
   
       /**
        * Pop the top item off of this stack and return it.
  
  
  

Reply via email to