directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 9963 - in incubator/directory/snickers/trunk: ber ber/src/java/org/apache/snickers/ber/digester ber/src/test/org/apache/snickers/ber/digester codec-stateful
Date Sun, 11 Apr 2004 05:15:33 GMT
Author: akarasulu
Date: Sat Apr 10 22:15:32 2004
New Revision: 9963

Added:
   incubator/directory/snickers/trunk/ber/maven.xml
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/BooleanStack.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/ByteStack.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/CharStack.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/DoubleStack.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/FloatStack.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/LongStack.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/ShortStack.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/BooleanStackTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/ByteStackTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/CharStackTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/DoubleStackTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/FloatStackTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/LongStackTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/ShortStackTest.java
   incubator/directory/snickers/trunk/codec-stateful/maven.xml
Modified:
   incubator/directory/snickers/trunk/ber/project.xml
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/BERDigester.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/IntStack.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/ObjectCreateRule.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/Rules.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/RulesBase.java
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/TagTree.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/IntStackTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/RulesBaseTest.java
   incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/TagTreeTest.java
Log:
o switched to using a primitives SNAPSHOT
o added primitive type stacks for
  - boolean
  - byte
  - char
  - short
  - int
  - long
  - float
  - double
o corrected wrong package name on IntStack


Added: incubator/directory/snickers/trunk/ber/maven.xml
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/maven.xml	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> 
+  
+<project 
+  default="jar:install" 
+  >
+  
+</project>

Modified: incubator/directory/snickers/trunk/ber/project.xml
==============================================================================
--- incubator/directory/snickers/trunk/ber/project.xml	(original)
+++ incubator/directory/snickers/trunk/ber/project.xml	Sat Apr 10 22:15:32 2004
@@ -49,7 +49,7 @@
     <dependency>
       <groupId>commons-primitives</groupId>
       <artifactId>commons-primitives</artifactId>
-      <version>1.1-dev</version>
+      <version>SNAPSHOT</version>
       <url>http://jakarta.apache.org/commons/primitives</url>
     </dependency>
 

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/BERDigester.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/BERDigester.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/BERDigester.java	Sat Apr 10 22:15:32 2004
@@ -19,17 +19,20 @@
 
 import java.nio.ByteBuffer ;
 
-import java.util.*;
+import java.util.List ;
+import java.util.HashSet ;
+import java.util.Iterator ;
+import java.util.Collections ;
+import java.util.EmptyStackException ;
 
 import org.apache.snickers.ber.Tuple ;
-import org.apache.snickers.ber.IntStack ;
 import org.apache.snickers.ber.TypeClass ;
 import org.apache.snickers.ber.BERDecoder ;
 import org.apache.snickers.ber.BERDecoderCallback ;
 
+import org.apache.commons.codec.DecoderException ;
 import org.apache.commons.codec.stateful.StatefulDecoder ;
-import org.apache.commons.codec.stateful.AbstractStatefulDecoder;
-import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.stateful.AbstractStatefulDecoder ;
 
 import org.apache.commons.collections.ArrayStack ;
 
@@ -57,6 +60,22 @@
     private BERDecoder decoder ;
     /** the object stack where rules push and pop ASN.1 POJO stubs */
     private ArrayStack objectStack ;
+    /** the primitive boolean stack where rules push and pop booleans */
+    private BooleanStack booleanStack ;
+    /** the primitive char stack where rules push and pop chars */
+    private CharStack charStack ;
+    /** the primitive float stack where rules push and pop floats */
+    private FloatStack floatStack ;
+    /** the primitive double stack where rules push and pop doubles */
+    private DoubleStack doubleStack ;
+    /** the primitive int stack where rules push and pop ints */
+    private IntStack intStack ;
+    /** the primitive byte stack where rules push and pop bytes */
+    private ByteStack byteStack ;
+    /** the primitive long stack where rules push and pop longs */
+    private LongStack longStack ;
+    /** the primitive short stack where rules push and shorts */
+    private ShortStack shortStack ;
     /** the tag stack used to store the nesting pattern */
     private IntStack tagStack ;
     /** the rules base used by this rulesBase */
@@ -93,6 +112,14 @@
         this.rules.setDigester( this ) ;
         this.tagStack = new IntStack() ;
         this.objectStack = new ArrayStack() ;
+        this.booleanStack = new BooleanStack() ;
+        this.charStack = new CharStack() ;
+        this.byteStack = new ByteStack() ;
+        this.shortStack = new ShortStack() ;
+        this.intStack = new IntStack() ;
+        this.longStack = new LongStack() ;
+        this.floatStack = new FloatStack() ;
+        this.doubleStack = new DoubleStack() ;
         this.decoder = new BERDecoder() ;
         this.decoder.setCallback( new DigesterCallback() ) ;
         this.monitor = new BERDigesterLoggingMonitor() ;
@@ -202,13 +229,25 @@
         root = null ;
         tagStack.clear() ;
         objectStack.clear() ;
+        booleanStack.clear() ;
+        byteStack.clear() ;
+        shortStack.clear() ;
+        intStack.clear() ;
+        longStack.clear() ;
+        floatStack.clear() ;
+        doubleStack.clear() ;
     }
-    
-    
+
+
+    // ------------------------------------------------------------------------
+    // Stack Operations
+    // ------------------------------------------------------------------------
+
+
     /**
-     * Return the current depth of the element stack.
+     * Return the current depth of the object stack.
      * 
-     * @return the size of the element stack
+     * @return the size of the object stack
      */
     public int getCount()
     {
@@ -217,10 +256,10 @@
     
     
     /**
-     * Return the top object on the stack without removing it.  If there are
-     * no objects on the stack, return <code>null</code>.
+     * Return the top object on the stack without removing it.
      * 
      * @return the top object
+     * @throws EmptyStackException if there are no objects on the stack
      */
     public Object peek() 
     {
@@ -234,6 +273,8 @@
      * 
      * @param n the element index
      * @return the element at the index
+     * @throws EmptyStackException if there are no objects on the stack
+     * @throws IndexOutOfBoundsException if the index is out of bounds
      */
     public Object peek( int n )
     {
@@ -245,6 +286,7 @@
      * Pop the top object off of the stack, and return it.
      * 
      * @return the top object off of the stack
+     * @throws EmptyStackException if there are no objects on the stack
      */
     public Object pop()
     {
@@ -266,8 +308,536 @@
 
         objectStack.push( object ) ;
     }
-              
-    
+
+
+    // ------------------------------------------------------------------------
+    // Primitive boolean Stack Operations
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Return the current depth of the boolean stack.
+     *
+     * @return the size of the boolean stack
+     */
+    public int getBooleanCount()
+    {
+        return booleanStack.size() ;
+    }
+
+
+    /**
+     * Return the top boolean on the stack without removing it.
+     *
+     * @return the top boolean
+     * @throws EmptyStackException if there are no more boolean elements left
+     */
+    public boolean peekBoolean()
+    {
+        return ( booleanStack.peek() ) ;
+    }
+
+
+    /**
+     * Return the n'th boolean down the stack, where 0 is the top element and
+     * [getCount()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if there are no more boolean elements left
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public boolean peekBoolean( int n )
+    {
+        return ( booleanStack.peek( n ) ) ;
+    }
+
+
+    /**
+     * Pop the top boolean off of the stack, and return it.
+     *
+     * @return the top boolean off of the stack
+     * @throws EmptyStackException if the stack is empty
+     */
+    public boolean popBoolean()
+    {
+        return ( booleanStack.pop() ) ;
+    }
+
+
+    /**
+     * Push a new boolean onto the top of the boolean stack.
+     *
+     * @param bit the boolean to push onto the stack
+     */
+    public void pushBoolean( boolean bit )
+    {
+        booleanStack.push( bit ) ;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Primitive char Stack Operations
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Return the current depth of the char stack.
+     *
+     * @return the size of the char stack
+     */
+    public int getCharCount()
+    {
+        return charStack.size() ;
+    }
+
+
+    /**
+     * Return the top char on the stack without removing it.
+     *
+     * @return the top char
+     * @throws EmptyStackException if there are no more char elements left
+     */
+    public char peekChar()
+    {
+        return ( charStack.peek() ) ;
+    }
+
+
+    /**
+     * Return the n'th char down the stack, where 0 is the top element and
+     * [getCount()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if there are no more char elements left
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public char peekChar( int n )
+    {
+        return ( charStack.peek( n ) ) ;
+    }
+
+
+    /**
+     * Pop the top char off of the stack, and return it.
+     *
+     * @return the top char off of the stack
+     * @throws EmptyStackException if the stack is empty
+     */
+    public char popChar()
+    {
+        return ( charStack.pop() ) ;
+    }
+
+
+    /**
+     * Push a new char onto the top of the char stack.
+     *
+     * @param ch the char to push onto the stack
+     */
+    public void pushChar( char ch )
+    {
+        charStack.push( ch ) ;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Primitive byte Stack Operations
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Return the current depth of the byte stack.
+     *
+     * @return the size of the byte stack
+     */
+    public int getByteCount()
+    {
+        return byteStack.size() ;
+    }
+
+
+    /**
+     * Return the top byte on the stack without removing it.
+     *
+     * @return the top byte
+     * @throws EmptyStackException if there are no more byte elements left
+     */
+    public byte peekByte()
+    {
+        return ( byteStack.peek() ) ;
+    }
+
+
+    /**
+     * Return the n'th byte down the stack, where 0 is the top element and
+     * [getCount()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if there are no more byte elements left
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public byte peekByte( int n )
+    {
+        return ( byteStack.peek( n ) ) ;
+    }
+
+
+    /**
+     * Pop the top byte off of the stack, and return it.
+     *
+     * @return the top byte off of the stack
+     * @throws EmptyStackException if the stack is empty
+     */
+    public byte popByte()
+    {
+        return ( byteStack.pop() ) ;
+    }
+
+
+    /**
+     * Push a new byte onto the top of the byte stack.
+     *
+     * @param bite the byte to push onto the stack
+     */
+    public void pushByte( byte bite )
+    {
+        byteStack.push( bite ) ;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Primitive short Stack Operations
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Return the current depth of the short stack.
+     *
+     * @return the size of the short stack
+     */
+    public int getShortCount()
+    {
+        return shortStack.size() ;
+    }
+
+
+    /**
+     * Return the top short on the stack without removing it.
+     *
+     * @return the top short
+     * @throws EmptyStackException if there are no more short elements left
+     */
+    public short peekShort()
+    {
+        return ( shortStack.peek() ) ;
+    }
+
+
+    /**
+     * Return the n'th short down the stack, where 0 is the top element and
+     * [getCount()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if there are no more short elements left
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public short peekShort( int n )
+    {
+        return ( shortStack.peek( n ) ) ;
+    }
+
+
+    /**
+     * Pop the top short off of the stack, and return it.
+     *
+     * @return the top short off of the stack
+     * @throws EmptyStackException if the stack is empty
+     */
+    public short popShort()
+    {
+        return ( shortStack.pop() ) ;
+    }
+
+
+    /**
+     * Push a new short onto the top of the short stack.
+     *
+     * @param element the short to push onto the stack
+     */
+    public void pushShort( short element )
+    {
+        shortStack.push( element ) ;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Primitive int Stack Operations
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Return the current depth of the int stack.
+     *
+     * @return the size of the int stack
+     */
+    public int getIntCount()
+    {
+        return intStack.size() ;
+    }
+
+
+    /**
+     * Return the top int on the stack without removing it.
+     *
+     * @return the top int
+     * @throws EmptyStackException if there are no more int elements left
+     */
+    public int peekInt()
+    {
+        return ( intStack.peek() ) ;
+    }
+
+
+    /**
+     * Return the n'th int down the stack, where 0 is the top element and
+     * [getCount()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if there are no more int elements left
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public int peekInt( int n )
+    {
+        return ( intStack.peek( n ) ) ;
+    }
+
+
+    /**
+     * Pop the top int off of the stack, and return it.
+     *
+     * @return the top int off of the stack
+     * @throws EmptyStackException if the stack is empty
+     */
+    public int popInt()
+    {
+        return ( intStack.pop() ) ;
+    }
+
+
+    /**
+     * Push a new int onto the top of the int stack.
+     *
+     * @param element the int to push onto the stack
+     */
+    public void pushInt( int element )
+    {
+        intStack.push( element ) ;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Primitive long Stack Operations
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Return the current depth of the long stack.
+     *
+     * @return the size of the long stack
+     */
+    public int getLongCount()
+    {
+        return longStack.size() ;
+    }
+
+
+    /**
+     * Return the top long on the stack without removing it.
+     *
+     * @return the top long
+     * @throws EmptyStackException if there are no more long elements left
+     */
+    public long peekLong()
+    {
+        return ( longStack.peek() ) ;
+    }
+
+
+    /**
+     * Return the n'th long down the stack, where 0 is the top element and
+     * [getCount()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if there are no more long elements left
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public long peekLong( int n )
+    {
+        return ( longStack.peek( n ) ) ;
+    }
+
+
+    /**
+     * Pop the top long off of the stack, and return it.
+     *
+     * @return the top long off of the stack
+     * @throws EmptyStackException if the stack is empty
+     */
+    public long popLong()
+    {
+        return ( longStack.pop() ) ;
+    }
+
+
+    /**
+     * Push a new long onto the top of the long stack.
+     *
+     * @param element the long to push onto the stack
+     */
+    public void pushLong( long element )
+    {
+        longStack.push( element ) ;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Primitive float Stack Operations
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Return the current depth of the float stack.
+     *
+     * @return the size of the float stack
+     */
+    public int getFloatCount()
+    {
+        return floatStack.size() ;
+    }
+
+
+    /**
+     * Return the top float on the stack without removing it.
+     *
+     * @return the top float
+     * @throws EmptyStackException if there are no more float elements left
+     */
+    public float peekFloat()
+    {
+        return ( floatStack.peek() ) ;
+    }
+
+
+    /**
+     * Return the n'th float down the stack, where 0 is the top element and
+     * [getCount()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if there are no more float elements left
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public float peekFloat( int n )
+    {
+        return ( floatStack.peek( n ) ) ;
+    }
+
+
+    /**
+     * Pop the top float off of the stack, and return it.
+     *
+     * @return the top float off of the stack
+     * @throws EmptyStackException if the stack is empty
+     */
+    public float popFloat()
+    {
+        return ( floatStack.pop() ) ;
+    }
+
+
+    /**
+     * Push a new float onto the top of the float stack.
+     *
+     * @param element the float to push onto the stack
+     */
+    public void pushFloat( float element )
+    {
+        floatStack.push( element ) ;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Primitive double Stack Operations
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Return the current depth of the double stack.
+     *
+     * @return the size of the double stack
+     */
+    public int getDoubleCount()
+    {
+        return doubleStack.size() ;
+    }
+
+
+    /**
+     * Return the top double on the stack without removing it.
+     *
+     * @return the top double
+     * @throws EmptyStackException if there are no more double elements left
+     */
+    public double peekDouble()
+    {
+        return ( doubleStack.peek() ) ;
+    }
+
+
+    /**
+     * Return the n'th double down the stack, where 0 is the top element and
+     * [getCount()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if there are no more double elements left
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public double peekDouble( int n )
+    {
+        return ( doubleStack.peek( n ) ) ;
+    }
+
+
+    /**
+     * Pop the top double off of the stack, and return it.
+     *
+     * @return the top double off of the stack
+     * @throws EmptyStackException if the stack is empty
+     */
+    public double popDouble()
+    {
+        return ( doubleStack.pop() ) ;
+    }
+
+
+    /**
+     * Push a new double onto the top of the double stack.
+     *
+     * @param element the double to push onto the stack
+     */
+    public void pushDouble( double element )
+    {
+        doubleStack.push( element ) ;
+    }
+
+
     /**
      * This method allows you to access the root object that has been
      * created after decoding.
@@ -333,9 +903,10 @@
 
         if ( useContextClassLoader) 
         {
-            ClassLoader classLoader = 
-                Thread.currentThread().getContextClassLoader() ;
-            if ( classLoader != null ) 
+            ClassLoader classLoader = Thread.currentThread()
+                    .getContextClassLoader() ;
+
+            if ( classLoader != null )
             {
                 return ( classLoader ) ;
             }
@@ -382,24 +953,6 @@
     }
 
 
-    /*
-     Methods of interest from the original rulesBase class:
-
- java.lang.String getMatch() 
-          Return the current rule match path 
-
- java.lang.Object peekParams() 
-          Return the top object on the parameters stack without removing it. 
- java.lang.Object peekParams(int n) 
-          Return the n'th object down the parameters stack, where 0 is the top 
-          element and [getCount()-1] is the bottom element. 
- java.lang.Object popParams() 
-          Pop the top object off of the parameters stack, and return it. 
- void pushParams(java.lang.Object object) 
-          Push a new object onto the top of the parameters stack. 
-    */
-    
-    
     // ------------------------------------------------------------------------
     // Event fireing routines that trigger rules
     // ------------------------------------------------------------------------

Added: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/BooleanStack.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/BooleanStack.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,197 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import org.apache.commons.collections.primitives.ArrayBooleanList;
+
+
+/**
+ * A primitive boolean based Stack.  The underlying backing store is an
+ * ArrayBooleanList where the front of the list is the bottom of the stack
+ * and the tail of the list is the top of the stack.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class BooleanStack
+{
+    /** the underlying dynamic primitive backing store */
+    private ArrayBooleanList list = new ArrayBooleanList() ;
+
+
+    /**
+     * Creates an empty primitive stack.
+     */
+    public BooleanStack()
+    {
+    }
+
+
+    /**
+     * Creates a stack prepopulating it with values.
+     *
+     * @param bits the array to add
+     */
+    public BooleanStack( boolean[] bits )
+    {
+        for ( int ii = 0; ii < bits.length; ii++ )
+        {    
+            list.add( bits[ii] ) ;
+        }
+    }
+    
+
+    /**
+     * Tests if this stack is empty.
+     * 
+     * @return true if and only if this stack is empty; false otherwise
+     */
+    public boolean empty()
+    {
+        return list.isEmpty() ;
+    }
+
+    
+    /**
+     * Looks at the top of this stack without removing it.
+     * 
+     * @return the value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public boolean peek()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.get( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Return the n'th boolean down the stack, where 0 is the top element and
+     * [size()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if the stack is empty
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public boolean peek( int n )
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+
+        return list.get( list.size() - n - 1 ) ;
+    }
+
+
+    /**
+     * Removes the value at the top of this stack and returns it.
+     * 
+     * @return value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public boolean pop()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.removeElementAt( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Pushes a value onto the top of this stack.
+     * 
+     * @param item the value to push onto this stack
+     * @return the item argument for call chaining
+     */
+    public boolean push( boolean item )
+    {
+        list.add( item ) ;
+        return item ;
+    }
+    
+
+    /**
+     * Returns the 1-based position where a value is on this stack. If the value
+     * occurs as an item in this stack, this method returns the distance from 
+     * the top of the stack of the occurrence nearest the top of the stack; the 
+     * topmost item on the stack is considered to be at distance 1. 
+     * 
+     * @param item the value to search for from the top down
+     * @return the 1-based position from the top of the stack where the int is 
+     *  located; the return value -1 indicates that the int is not on the stack
+     */
+    public int search( boolean item )
+    {
+        for ( int ii = list.size() - 1; ii >= 0; ii-- )
+        {
+            if ( list.get( ii ) == item )
+            {
+                return list.size() - ii ;
+            }
+        }
+        
+        
+        return -1 ;
+    }
+    
+    
+    /**
+     * Gets items from the stack where the index is zero based and the top of
+     * the stack is at an index of size()-1 with the bottom of the stack at an
+     * index of 0.
+     * 
+     * @param index the index into the stack treated as a list
+     * @return the value at the index
+     */
+    public boolean get( int index )
+    {
+        return list.get( index ) ;
+    }
+    
+    
+    /**
+     * Gets the size of this stack.
+     * 
+     * @return the size of this stack
+     */
+    public int size()
+    {
+        return list.size() ;
+    }
+    
+
+    /**
+     * Empties the contents of the stack.
+     */
+    public void clear()
+    {
+        list.clear() ;
+    }
+}

Added: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/ByteStack.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/ByteStack.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,197 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import org.apache.commons.collections.primitives.ArrayByteList ;
+
+
+/**
+ * A primitive byte based Stack.  The underlying backing store is an
+ * ArrayByteList where the front of the list is the bottom of the stack
+ * and the tail of the list is the top of the stack.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ByteStack
+{
+    /** the underlying dynamic primitive backing store */
+    private ArrayByteList list = new ArrayByteList() ;
+
+
+    /**
+     * Creates an empty primitive stack.
+     */
+    public ByteStack()
+    {
+    }
+
+
+    /**
+     * Creates a stack prepopulating it with values.
+     *
+     * @param numbas the array to add
+     */
+    public ByteStack( byte[] numbas )
+    {
+        for ( int ii = 0; ii < numbas.length; ii++ )
+        {    
+            list.add( numbas[ii] ) ;
+        }
+    }
+    
+
+    /**
+     * Tests if this stack is empty.
+     * 
+     * @return true if and only if this stack is empty; false otherwise
+     */
+    public boolean empty()
+    {
+        return list.isEmpty() ;
+    }
+
+    
+    /**
+     * Looks at the top of this stack without removing it.
+     * 
+     * @return the value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public byte peek()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.get( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Return the n'th byte down the stack, where 0 is the top element and
+     * [size()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if the stack is empty
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public byte peek( int n )
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+
+        return list.get( list.size() - n - 1 ) ;
+    }
+
+
+    /**
+     * Removes the value at the top of this stack and returns it.
+     * 
+     * @return value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public byte pop()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.removeElementAt( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Pushes a value onto the top of this stack.
+     * 
+     * @param item the value to push onto this stack
+     * @return the item argument for call chaining
+     */
+    public byte push( byte item )
+    {
+        list.add( item ) ;
+        return item ;
+    }
+    
+
+    /**
+     * Returns the 1-based position where a value is on this stack. If the value
+     * occurs as an item in this stack, this method returns the distance from 
+     * the top of the stack of the occurrence nearest the top of the stack; the 
+     * topmost item on the stack is considered to be at distance 1. 
+     * 
+     * @param item the value to search for from the top down
+     * @return the 1-based position from the top of the stack where the int is 
+     *  located; the return value -1 indicates that the int is not on the stack
+     */
+    public int search( byte item )
+    {
+        for ( int ii = list.size() - 1; ii >= 0; ii-- )
+        {
+            if ( list.get( ii ) == item )
+            {
+                return list.size() - ii ;
+            }
+        }
+        
+        
+        return -1 ;
+    }
+    
+    
+    /**
+     * Gets items from the stack where the index is zero based and the top of
+     * the stack is at an index of size()-1 with the bottom of the stack at an
+     * index of 0.
+     * 
+     * @param index the index into the stack treated as a list
+     * @return the value at the index
+     */
+    public byte get( int index )
+    {
+        return list.get( index ) ;
+    }
+    
+    
+    /**
+     * Gets the size of this stack.
+     * 
+     * @return the size of this stack
+     */
+    public int size()
+    {
+        return list.size() ;
+    }
+    
+
+    /**
+     * Empties the contents of the stack.
+     */
+    public void clear()
+    {
+        list.clear() ;
+    }
+}

Added: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/CharStack.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/CharStack.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,198 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import org.apache.commons.collections.primitives.ArrayByteList ;
+import org.apache.commons.collections.primitives.ArrayCharList;
+
+
+/**
+ * A primitive char based Stack.  The underlying backing store is an
+ * ArrayCharList where the front of the list is the bottom of the stack
+ * and the tail of the list is the top of the stack.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class CharStack
+{
+    /** the underlying dynamic primitive backing store */
+    private ArrayCharList list = new ArrayCharList() ;
+
+
+    /**
+     * Creates an empty primitive stack.
+     */
+    public CharStack()
+    {
+    }
+
+
+    /**
+     * Creates a stack prepopulating it with values.
+     *
+     * @param chars the array to add
+     */
+    public CharStack( char[] chars )
+    {
+        for ( int ii = 0; ii < chars.length; ii++ )
+        {    
+            list.add( chars[ii] ) ;
+        }
+    }
+    
+
+    /**
+     * Tests if this stack is empty.
+     * 
+     * @return true if and only if this stack is empty; false otherwise
+     */
+    public boolean empty()
+    {
+        return list.isEmpty() ;
+    }
+
+    
+    /**
+     * Looks at the top of this stack without removing it.
+     * 
+     * @return the value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public char peek()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.get( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Return the n'th char down the stack, where 0 is the top element and
+     * [size()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws java.util.EmptyStackException if the stack is empty
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public char peek( int n )
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+
+        return list.get( list.size() - n - 1 ) ;
+    }
+
+
+    /**
+     * Removes the value at the top of this stack and returns it.
+     * 
+     * @return value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public char pop()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.removeElementAt( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Pushes a value onto the top of this stack.
+     * 
+     * @param item the value to push onto this stack
+     * @return the item argument for call chaining
+     */
+    public char push( char item )
+    {
+        list.add( item ) ;
+        return item ;
+    }
+    
+
+    /**
+     * Returns the 1-based position where a value is on this stack. If the value
+     * occurs as an item in this stack, this method returns the distance from 
+     * the top of the stack of the occurrence nearest the top of the stack; the 
+     * topmost item on the stack is considered to be at distance 1. 
+     * 
+     * @param item the value to search for from the top down
+     * @return the 1-based position from the top of the stack where the int is 
+     *  located; the return value -1 indicates that the int is not on the stack
+     */
+    public int search( char item )
+    {
+        for ( int ii = list.size() - 1; ii >= 0; ii-- )
+        {
+            if ( list.get( ii ) == item )
+            {
+                return list.size() - ii ;
+            }
+        }
+        
+        
+        return -1 ;
+    }
+    
+    
+    /**
+     * Gets items from the stack where the index is zero based and the top of
+     * the stack is at an index of size()-1 with the bottom of the stack at an
+     * index of 0.
+     * 
+     * @param index the index into the stack treated as a list
+     * @return the value at the index
+     */
+    public char get( int index )
+    {
+        return list.get( index ) ;
+    }
+    
+    
+    /**
+     * Gets the size of this stack.
+     * 
+     * @return the size of this stack
+     */
+    public int size()
+    {
+        return list.size() ;
+    }
+    
+
+    /**
+     * Empties the contents of the stack.
+     */
+    public void clear()
+    {
+        list.clear() ;
+    }
+}

Added: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/DoubleStack.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/DoubleStack.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,197 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import org.apache.commons.collections.primitives.ArrayDoubleList ;
+
+
+/**
+ * A primitive double based Stack.  The underlying backing store is an
+ * ArrayDoubleList where the front of the list is the bottom of the stack
+ * and the tail of the list is the top of the stack.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DoubleStack
+{
+    /** the underlying dynamic primitive backing store */
+    private ArrayDoubleList list = new ArrayDoubleList() ;
+
+
+    /**
+     * Creates an empty primitive stack.
+     */
+    public DoubleStack()
+    {
+    }
+
+
+    /**
+     * Creates a stack prepopulating it with values.
+     *
+     * @param numbas the array to add
+     */
+    public DoubleStack( double[] numbas )
+    {
+        for ( int ii = 0; ii < numbas.length; ii++ )
+        {    
+            list.add( numbas[ii] ) ;
+        }
+    }
+    
+
+    /**
+     * Tests if this stack is empty.
+     * 
+     * @return true if and only if this stack is empty; false otherwise
+     */
+    public boolean empty()
+    {
+        return list.isEmpty() ;
+    }
+
+    
+    /**
+     * Looks at the top of this stack without removing it.
+     * 
+     * @return the value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public double peek()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.get( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Return the n'th double down the stack, where 0 is the top element and
+     * [size()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if the stack is empty
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public double peek( int n )
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+
+        return list.get( list.size() - n - 1 ) ;
+    }
+
+
+    /**
+     * Removes the value at the top of this stack and returns it.
+     * 
+     * @return value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public double pop()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.removeElementAt( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Pushes a value onto the top of this stack.
+     * 
+     * @param item the value to push onto this stack
+     * @return the item argument for call chaining
+     */
+    public double push( double item )
+    {
+        list.add( item ) ;
+        return item ;
+    }
+    
+
+    /**
+     * Returns the 1-based position where a value is on this stack. If the value
+     * occurs as an item in this stack, this method returns the distance from 
+     * the top of the stack of the occurrence nearest the top of the stack; the 
+     * topmost item on the stack is considered to be at distance 1. 
+     * 
+     * @param item the value to search for from the top down
+     * @return the 1-based position from the top of the stack where the int is 
+     *  located; the return value -1 indicates that the int is not on the stack
+     */
+    public int search( double item )
+    {
+        for ( int ii = list.size() - 1; ii >= 0; ii-- )
+        {
+            if ( list.get( ii ) == item )
+            {
+                return list.size() - ii ;
+            }
+        }
+        
+        
+        return -1 ;
+    }
+    
+    
+    /**
+     * Gets items from the stack where the index is zero based and the top of
+     * the stack is at an index of size()-1 with the bottom of the stack at an
+     * index of 0.
+     * 
+     * @param index the index into the stack treated as a list
+     * @return the value at the index
+     */
+    public double get( int index )
+    {
+        return list.get( index ) ;
+    }
+    
+    
+    /**
+     * Gets the size of this stack.
+     * 
+     * @return the size of this stack
+     */
+    public int size()
+    {
+        return list.size() ;
+    }
+    
+
+    /**
+     * Empties the contents of the stack.
+     */
+    public void clear()
+    {
+        list.clear() ;
+    }
+}

Added: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/FloatStack.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/FloatStack.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,197 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import org.apache.commons.collections.primitives.ArrayFloatList ;
+
+
+/**
+ * A primitive float based Stack.  The underlying backing store is an
+ * ArrayFloatList where the front of the list is the bottom of the stack
+ * and the tail of the list is the top of the stack.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class FloatStack
+{
+    /** the underlying dynamic primitive backing store */
+    private ArrayFloatList list = new ArrayFloatList() ;
+
+
+    /**
+     * Creates an empty primitive float stack.
+     */
+    public FloatStack()
+    {
+    }
+
+
+    /**
+     * Creates a stack prepopulating it with float values.
+     *
+     * @param numbas the float array to add
+     */
+    public FloatStack( float[] numbas )
+    {
+        for ( int ii = 0; ii < numbas.length; ii++ )
+        {    
+            list.add( numbas[ii] ) ;
+        }
+    }
+    
+
+    /**
+     * Tests if this stack is empty.
+     * 
+     * @return true if and only if this stack is empty; false otherwise
+     */
+    public boolean empty()
+    {
+        return list.isEmpty() ;
+    }
+
+    
+    /**
+     * Looks at the top of this stack without removing it.
+     * 
+     * @return the value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public float peek()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.get( list.size() - 1 ) ;
+    }
+
+
+    /**
+     * Return the n'th float down the stack, where 0 is the top element and
+     * [size()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if the stack is empty
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public float peek( int n )
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+
+        return list.get( list.size() - n - 1 ) ;
+    }
+
+
+    /**
+     * Removes the value at the top of this stack and returns it.
+     * 
+     * @return value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public float pop()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.removeElementAt( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Pushes a value onto the top of this stack.
+     * 
+     * @param item the value to push onto this stack
+     * @return the item argument for call chaining
+     */
+    public float push( float item )
+    {
+        list.add( item ) ;
+        return item ;
+    }
+    
+
+    /**
+     * Returns the 1-based position where a value is on this stack. If the value
+     * occurs as an item in this stack, this method returns the distance from 
+     * the top of the stack of the occurrence nearest the top of the stack; the 
+     * topmost item on the stack is considered to be at distance 1. 
+     * 
+     * @param item the value to search for from the top down
+     * @return the 1-based position from the top of the stack where the int is 
+     *  located; the return value -1 indicates that the int is not on the stack
+     */
+    public int search( float item )
+    {
+        for ( int ii = list.size() - 1; ii >= 0; ii-- )
+        {
+            if ( list.get( ii ) == item )
+            {
+                return list.size() - ii ;
+            }
+        }
+        
+        
+        return -1 ;
+    }
+    
+    
+    /**
+     * Gets items from the stack where the index is zero based and the top of
+     * the stack is at an index of size()-1 with the bottom of the stack at an
+     * index of 0.
+     * 
+     * @param index the index into the stack treated as a list
+     * @return the value at the index
+     */
+    public float get( int index )
+    {
+        return list.get( index ) ;
+    }
+    
+    
+    /**
+     * Gets the size of this stack.
+     * 
+     * @return the size of this stack
+     */
+    public int size()
+    {
+        return list.size() ;
+    }
+    
+
+    /**
+     * Empties the contents of the stack.
+     */
+    public void clear()
+    {
+        list.clear() ;
+    }
+}

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/IntStack.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/IntStack.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/IntStack.java	Sat Apr 10 22:15:32 2004
@@ -14,7 +14,7 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.ber.digester ;
 
 
 import java.util.EmptyStackException ;
@@ -78,6 +78,26 @@
     }
 
     
+    /**
+     * Return the n'th int down the stack, where 0 is the top element and
+     * [size()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if the stack is empty
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public int peek( int n )
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+
+        return list.get( list.size() - n - 1 ) ;
+    }
+
+
     /**
      * Removes the int at the top of this stack and returns that object as the 
      * value of this function.

Added: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/LongStack.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/LongStack.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,197 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import org.apache.commons.collections.primitives.ArrayLongList ;
+
+
+/**
+ * A primitive long based Stack.  The underlying backing store is an
+ * ArrayLongList where the front of the list is the bottom of the stack
+ * and the tail of the list is the top of the stack.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class LongStack
+{
+    /** the underlying dynamic primitive backing store */
+    private ArrayLongList list = new ArrayLongList() ;
+
+
+    /**
+     * Creates an empty primitive stack.
+     */
+    public LongStack()
+    {
+    }
+
+
+    /**
+     * Creates a stack prepopulating it with values.
+     *
+     * @param numbas the array to add
+     */
+    public LongStack( long[] numbas )
+    {
+        for ( int ii = 0; ii < numbas.length; ii++ )
+        {    
+            list.add( numbas[ii] ) ;
+        }
+    }
+    
+
+    /**
+     * Tests if this stack is empty.
+     * 
+     * @return true if and only if this stack is empty; false otherwise
+     */
+    public boolean empty()
+    {
+        return list.isEmpty() ;
+    }
+
+    
+    /**
+     * Looks at the top of this stack without removing it.
+     * 
+     * @return the value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public long peek()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.get( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Return the n'th long down the stack, where 0 is the top element and
+     * [size()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if the stack is empty
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public long peek( int n )
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+
+        return list.get( list.size() - n - 1 ) ;
+    }
+
+
+    /**
+     * Removes the value at the top of this stack and returns it.
+     * 
+     * @return value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public long pop()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.removeElementAt( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Pushes a value onto the top of this stack.
+     * 
+     * @param item the value to push onto this stack
+     * @return the item argument for call chaining
+     */
+    public long push( long item )
+    {
+        list.add( item ) ;
+        return item ;
+    }
+    
+
+    /**
+     * Returns the 1-based position where a value is on this stack. If the value
+     * occurs as an item in this stack, this method returns the distance from 
+     * the top of the stack of the occurrence nearest the top of the stack; the 
+     * topmost item on the stack is considered to be at distance 1. 
+     * 
+     * @param item the value to search for from the top down
+     * @return the 1-based position from the top of the stack where the int is 
+     *  located; the return value -1 indicates that the int is not on the stack
+     */
+    public int search( long item )
+    {
+        for ( int ii = list.size() - 1; ii >= 0; ii-- )
+        {
+            if ( list.get( ii ) == item )
+            {
+                return list.size() - ii ;
+            }
+        }
+        
+        
+        return -1 ;
+    }
+    
+    
+    /**
+     * Gets items from the stack where the index is zero based and the top of
+     * the stack is at an index of size()-1 with the bottom of the stack at an
+     * index of 0.
+     * 
+     * @param index the index into the stack treated as a list
+     * @return the value at the index
+     */
+    public long get( int index )
+    {
+        return list.get( index ) ;
+    }
+    
+    
+    /**
+     * Gets the size of this stack.
+     * 
+     * @return the size of this stack
+     */
+    public int size()
+    {
+        return list.size() ;
+    }
+    
+
+    /**
+     * Empties the contents of the stack.
+     */
+    public void clear()
+    {
+        list.clear() ;
+    }
+}

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/ObjectCreateRule.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/ObjectCreateRule.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/ObjectCreateRule.java	Sat Apr 10 22:15:32 2004
@@ -18,7 +18,7 @@
 
 
 import org.apache.snickers.ber.TypeClass ;
-import org.apache.commons.lang.exception.NestableRuntimeException;
+import org.apache.commons.lang.exception.NestableRuntimeException ;
 
 
 /**

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/Rules.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/Rules.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/Rules.java	Sat Apr 10 22:15:32 2004
@@ -20,8 +20,6 @@
 
 import java.util.List ;
 
-import org.apache.snickers.ber.IntStack;
-
 
 /**
  * Public interface defining a collection of Rule instances (and corresponding

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/RulesBase.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/RulesBase.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/RulesBase.java	Sat Apr 10 22:15:32 2004
@@ -21,8 +21,6 @@
 import java.util.ArrayList ;
 import java.util.Collections ;
 
-import org.apache.snickers.ber.IntStack;
-
 
 /**
  * A base Rules implementation using a fast pattern match.

Added: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/ShortStack.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/ShortStack.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,198 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import org.apache.commons.collections.primitives.ArrayLongList ;
+import org.apache.commons.collections.primitives.ArrayShortList;
+
+
+/**
+ * A primitive short based Stack.  The underlying backing store is an
+ * ArrayShortList where the front of the list is the bottom of the stack
+ * and the tail of the list is the top of the stack.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ShortStack
+{
+    /** the underlying dynamic primitive backing store */
+    private ArrayShortList list = new ArrayShortList() ;
+
+
+    /**
+     * Creates an empty primitive stack.
+     */
+    public ShortStack()
+    {
+    }
+
+
+    /**
+     * Creates a stack prepopulating it with values.
+     *
+     * @param numbas the array to add
+     */
+    public ShortStack( short[] numbas )
+    {
+        for ( int ii = 0; ii < numbas.length; ii++ )
+        {    
+            list.add( numbas[ii] ) ;
+        }
+    }
+    
+
+    /**
+     * Tests if this stack is empty.
+     * 
+     * @return true if and only if this stack is empty; false otherwise
+     */
+    public boolean empty()
+    {
+        return list.isEmpty() ;
+    }
+
+    
+    /**
+     * Looks at the top of this stack without removing it.
+     * 
+     * @return the value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public short peek()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.get( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Return the n'th short down the stack, where 0 is the top element and
+     * [size()-1] is the bottom element.
+     *
+     * @param n the element index
+     * @return the element at the index
+     * @throws EmptyStackException if the stack is empty
+     * @throws IndexOutOfBoundsException if the index is out of bounds
+     */
+    public short peek( int n )
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+
+        return list.get( list.size() - n - 1 ) ;
+    }
+
+
+    /**
+     * Removes the value at the top of this stack and returns it.
+     * 
+     * @return value at the top of this stack
+     * @throws java.util.EmptyStackException if this stack is empty
+     */
+    public short pop()
+    {
+        if ( list.isEmpty() )
+        {
+            throw new EmptyStackException() ;
+        }
+        
+        return list.removeElementAt( list.size() - 1 ) ;
+    }
+
+    
+    /**
+     * Pushes a value onto the top of this stack.
+     * 
+     * @param item the value to push onto this stack
+     * @return the item argument for call chaining
+     */
+    public short push( short item )
+    {
+        list.add( item ) ;
+        return item ;
+    }
+    
+
+    /**
+     * Returns the 1-based position where a value is on this stack. If the value
+     * occurs as an item in this stack, this method returns the distance from 
+     * the top of the stack of the occurrence nearest the top of the stack; the 
+     * topmost item on the stack is considered to be at distance 1. 
+     * 
+     * @param item the value to search for from the top down
+     * @return the 1-based position from the top of the stack where the int is 
+     *  located; the return value -1 indicates that the int is not on the stack
+     */
+    public int search( short item )
+    {
+        for ( int ii = list.size() - 1; ii >= 0; ii-- )
+        {
+            if ( list.get( ii ) == item )
+            {
+                return list.size() - ii ;
+            }
+        }
+        
+        
+        return -1 ;
+    }
+    
+    
+    /**
+     * Gets items from the stack where the index is zero based and the top of
+     * the stack is at an index of size()-1 with the bottom of the stack at an
+     * index of 0.
+     * 
+     * @param index the index into the stack treated as a list
+     * @return the value at the index
+     */
+    public short get( int index )
+    {
+        return list.get( index ) ;
+    }
+    
+    
+    /**
+     * Gets the size of this stack.
+     * 
+     * @return the size of this stack
+     */
+    public int size()
+    {
+        return list.size() ;
+    }
+    
+
+    /**
+     * Empties the contents of the stack.
+     */
+    public void clear()
+    {
+        list.clear() ;
+    }
+}

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/TagTree.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/TagTree.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/ber/digester/TagTree.java	Sat Apr 10 22:15:32 2004
@@ -23,8 +23,6 @@
 
 import org.apache.commons.lang.Validate ;
 
-import org.apache.snickers.ber.IntStack ;
-
 
 /**
  * A tree of tags.

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/BooleanStackTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/BooleanStackTest.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,185 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the BooleanStack class.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class BooleanStackTest extends TestCase
+{
+    BooleanStack stack = null ;
+    
+    
+    /**
+     * Runs the test. 
+     * 
+     * @param args nada
+     */
+    public static void main( String[] args )
+    {
+        junit.textui.TestRunner.run( BooleanStackTest.class ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp() ;
+        stack = new BooleanStack() ;
+    }
+    
+    
+    /**
+     * Constructor for IntStackTest.
+     * @param arg0
+     */
+    public BooleanStackTest( String arg0 )
+    {
+        super( arg0 ) ;
+    }
+
+    
+    public void testEmpty()
+    {
+        assertTrue( "Newly created stacks should be empty", stack.empty() ) ;
+        stack.push( true ) ;
+        assertFalse( "Stack with item should not be empty", stack.empty() ) ;
+        stack.pop() ;
+        assertTrue( "Stack last int popped should be empty", stack.empty() ) ;
+    }
+
+    
+    public void testPeek()
+    {
+        try
+        {
+            stack.peek() ;
+            throw new AssertionError( 
+                    "Peek should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( int ii = 0; ii < 10; ii++ )
+        {
+            if ( ii % 2 == 0 )
+            {
+                stack.push( false ) ;
+                assertFalse( stack.peek() ) ;
+            }
+            else
+            {
+                stack.push( true ) ;
+                assertTrue( stack.peek() ) ;
+            }
+        }
+    }
+
+    
+    public void testPop()
+    {
+        try
+        {
+            stack.pop() ;
+            throw new AssertionError( 
+                    "Pop should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( int ii = 0; ii < 10; ii++ )
+        {    
+            if ( ii % 2 == 0 )
+            {
+                stack.push( false ) ;
+                assertFalse( stack.pop() ) ;
+            }
+            else
+            {
+                stack.push( true ) ;
+                assertTrue( stack.pop() ) ;
+            }
+        }
+
+        for( int ii = 0; ii < 10; ii++ )
+        {    
+            if ( ii % 2 == 0 )
+            {
+                stack.push( false ) ;
+            }
+            else
+            {
+                stack.push( true ) ;
+            }
+        }
+
+        for( short ii = 10; ii < 0; ii-- )
+        {    
+            if ( ii % 2 == 0 )
+            {
+                stack.push( false ) ;
+                assertFalse( stack.pop() ) ;
+            }
+            else
+            {
+                stack.push( true ) ;
+                assertTrue( stack.pop() ) ;
+            }
+        }
+    }
+
+    
+    public void testPush()
+    {
+        stack.push( false ) ;
+        stack.push( false ) ;
+        stack.push( true ) ;
+        assertFalse( stack.empty() ) ;
+        assertTrue( stack.pop() ) ;
+        assertFalse( stack.pop() ) ;
+        assertFalse( stack.pop() ) ;
+    }
+
+    
+    public void testSearch()
+    {
+        stack.push( false ) ;
+        assertTrue( -1 == stack.search( true ) ) ;
+        stack.push( true ) ;
+        assertTrue( 2 == stack.search( false ) ) ;
+        stack.push( false ) ;
+        assertTrue( 1 == stack.search( false ) ) ;
+        stack.push( false ) ;
+        assertTrue( 3 == stack.search( true ) ) ;
+    }
+}

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/ByteStackTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/ByteStackTest.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,151 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the ByteStack class.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ByteStackTest extends TestCase
+{
+    ByteStack stack = null ;
+    
+    
+    /**
+     * Runs the test. 
+     * 
+     * @param args nada
+     */
+    public static void main( String[] args )
+    {
+        junit.textui.TestRunner.run( ByteStackTest.class ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp() ;
+        stack = new ByteStack() ;
+    }
+    
+    
+    /**
+     * Constructor for IntStackTest.
+     * @param arg0
+     */
+    public ByteStackTest( String arg0 )
+    {
+        super( arg0 ) ;
+    }
+
+    
+    public void testEmpty()
+    {
+        assertTrue( "Newly created stacks should be empty", stack.empty() ) ;
+        stack.push( ( byte ) 0 ) ;
+        assertFalse( "Stack with item should not be empty", stack.empty() ) ;
+        stack.pop() ;
+        assertTrue( "Stack last int popped should be empty", stack.empty() ) ;
+    }
+
+    
+    public void testPeek()
+    {
+        try
+        {
+            stack.peek() ;
+            throw new AssertionError( 
+                    "Peek should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( int ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ( byte ) ii ) ;
+            assertTrue( ii == stack.peek() ) ;
+        }
+    }
+
+    
+    public void testPop()
+    {
+        try
+        {
+            stack.pop() ;
+            throw new AssertionError( 
+                    "Pop should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( int ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ( byte ) ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+
+        for( int ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ( byte ) ii ) ;
+        }
+        for( int ii = 10; ii < 0; ii-- )
+        {    
+            stack.push( ( byte ) ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+    }
+
+    
+    public void testPush()
+    {
+        stack.push( ( byte ) 0 ) ;
+        stack.push( ( byte ) 0 ) ;
+        assertFalse( stack.empty() ) ;
+        assertTrue( 0 == stack.pop() ) ;
+        assertTrue( 0 == stack.pop() ) ;
+    }
+
+    
+    public void testSearch()
+    {
+        stack.push( ( byte ) 0 ) ;
+        stack.push( ( byte ) 1 ) ;
+        assertTrue( 2 == stack.search( ( byte ) 0 ) ) ;
+        stack.push( ( byte ) 0 ) ;
+        assertTrue( 1 == stack.search( ( byte ) 0 ) ) ;
+        stack.push( ( byte ) 0 ) ;
+        assertTrue( 3 == stack.search( ( byte ) 1 ) ) ;
+        assertTrue( -1 == stack.search( ( byte ) 44 ) ) ;
+    }
+}

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/CharStackTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/CharStackTest.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,151 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the CharStack class.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class CharStackTest extends TestCase
+{
+    CharStack stack = null ;
+    
+    
+    /**
+     * Runs the test. 
+     * 
+     * @param args nada
+     */
+    public static void main( String[] args )
+    {
+        junit.textui.TestRunner.run( CharStackTest.class ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp() ;
+        stack = new CharStack() ;
+    }
+    
+    
+    /**
+     * Constructor for IntStackTest.
+     * @param arg0
+     */
+    public CharStackTest( String arg0 )
+    {
+        super( arg0 ) ;
+    }
+
+    
+    public void testEmpty()
+    {
+        assertTrue( "Newly created stacks should be empty", stack.empty() ) ;
+        stack.push( 'A' ) ;
+        assertFalse( "Stack with item should not be empty", stack.empty() ) ;
+        stack.pop() ;
+        assertTrue( "Stack last int popped should be empty", stack.empty() ) ;
+    }
+
+    
+    public void testPeek()
+    {
+        try
+        {
+            stack.peek() ;
+            throw new AssertionError( 
+                    "Peek should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( char ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.peek() ) ;
+        }
+    }
+
+    
+    public void testPop()
+    {
+        try
+        {
+            stack.pop() ;
+            throw new AssertionError( 
+                    "Pop should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( char ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+
+        for( char ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+        }
+        for( char ii = 10; ii < 0; ii-- )
+        {    
+            stack.push( ( char ) ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+    }
+
+    
+    public void testPush()
+    {
+        stack.push( ( char ) 0 ) ;
+        stack.push( ( char ) 0 ) ;
+        assertFalse( stack.empty() ) ;
+        assertTrue( 0 == stack.pop() ) ;
+        assertTrue( 0 == stack.pop() ) ;
+    }
+
+    
+    public void testSearch()
+    {
+        stack.push( ( char ) 0 ) ;
+        stack.push( ( char ) 1 ) ;
+        assertTrue( 2 == stack.search( ( char ) 0 ) ) ;
+        stack.push( ( char ) 0 ) ;
+        assertTrue( 1 == stack.search( ( char ) 0 ) ) ;
+        stack.push( ( char ) 0 ) ;
+        assertTrue( 3 == stack.search( ( char ) 1 ) ) ;
+        assertTrue( -1 == stack.search( ( char ) 44 ) ) ;
+    }
+}

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/DoubleStackTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/DoubleStackTest.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,151 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the DoubleStack class.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DoubleStackTest extends TestCase
+{
+    DoubleStack stack = null ;
+    
+    
+    /**
+     * Runs the test. 
+     * 
+     * @param args nada
+     */
+    public static void main( String[] args )
+    {
+        junit.textui.TestRunner.run( DoubleStackTest.class ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp() ;
+        stack = new DoubleStack() ;
+    }
+    
+    
+    /**
+     * Constructor for IntStackTest.
+     * @param arg0
+     */
+    public DoubleStackTest( String arg0 )
+    {
+        super( arg0 ) ;
+    }
+
+    
+    public void testEmpty()
+    {
+        assertTrue( "Newly created stacks should be empty", stack.empty() ) ;
+        stack.push( 0.3 ) ;
+        assertFalse( "Stack with item should not be empty", stack.empty() ) ;
+        stack.pop() ;
+        assertTrue( "Stack last int popped should be empty", stack.empty() ) ;
+    }
+
+    
+    public void testPeek()
+    {
+        try
+        {
+            stack.peek() ;
+            throw new AssertionError( 
+                    "Peek should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( int ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ( double ) ii ) ;
+            assertTrue( ii == stack.peek() ) ;
+        }
+    }
+
+    
+    public void testPop()
+    {
+        try
+        {
+            stack.pop() ;
+            throw new AssertionError( 
+                    "Pop should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( double ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+
+        for( double ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+        }
+        for( double ii = 10; ii < 0; ii-- )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+    }
+
+    
+    public void testPush()
+    {
+        stack.push( ( double ) 0 ) ;
+        stack.push( ( double ) 0 ) ;
+        assertFalse( stack.empty() ) ;
+        assertTrue( 0 == stack.pop() ) ;
+        assertTrue( 0 == stack.pop() ) ;
+    }
+
+    
+    public void testSearch()
+    {
+        stack.push( ( double ) 0 ) ;
+        stack.push( ( double ) 1 ) ;
+        assertTrue( 2 == stack.search( ( double ) 0 ) ) ;
+        stack.push( ( double ) 0 ) ;
+        assertTrue( 1 == stack.search( ( double ) 0 ) ) ;
+        stack.push( ( double ) 0 ) ;
+        assertTrue( 3 == stack.search( ( double ) 1 ) ) ;
+        assertTrue( -1 == stack.search( ( double ) 44 ) ) ;
+    }
+}

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/FloatStackTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/FloatStackTest.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,151 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the FloatStack class.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class FloatStackTest extends TestCase
+{
+    FloatStack stack = null ;
+    
+    
+    /**
+     * Runs the test. 
+     * 
+     * @param args nada
+     */
+    public static void main( String[] args )
+    {
+        junit.textui.TestRunner.run( FloatStackTest.class ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp() ;
+        stack = new FloatStack() ;
+    }
+    
+    
+    /**
+     * Constructor for IntStackTest.
+     * @param arg0
+     */
+    public FloatStackTest( String arg0 )
+    {
+        super( arg0 ) ;
+    }
+
+    
+    public void testEmpty()
+    {
+        assertTrue( "Newly created stacks should be empty", stack.empty() ) ;
+        stack.push( 1.4f ) ;
+        assertFalse( "Stack with item should not be empty", stack.empty() ) ;
+        stack.pop() ;
+        assertTrue( "Stack last int popped should be empty", stack.empty() ) ;
+    }
+
+    
+    public void testPeek()
+    {
+        try
+        {
+            stack.peek() ;
+            throw new AssertionError( 
+                    "Peek should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( float ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.peek() ) ;
+        }
+    }
+
+    
+    public void testPop()
+    {
+        try
+        {
+            stack.pop() ;
+            throw new AssertionError( 
+                    "Pop should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( float ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+
+        for( float ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+        }
+        for( float ii = 10; ii < 0; ii-- )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+    }
+
+    
+    public void testPush()
+    {
+        stack.push( ( float ) 1.4f ) ;
+        stack.push( ( float ) 2.67f ) ;
+        assertFalse( stack.empty() ) ;
+        assertTrue( 2.67f == stack.pop() ) ;
+        assertTrue( 1.4f == stack.pop() ) ;
+    }
+
+    
+    public void testSearch()
+    {
+        stack.push( ( float ) 0 ) ;
+        stack.push( ( float ) 1 ) ;
+        assertTrue( 2 == stack.search( ( float ) 0 ) ) ;
+        stack.push( ( float ) 0 ) ;
+        assertTrue( 1 == stack.search( ( float ) 0 ) ) ;
+        stack.push( ( float ) 0 ) ;
+        assertTrue( 3 == stack.search( ( float ) 1 ) ) ;
+        assertTrue( -1 == stack.search( ( float ) 44 ) ) ;
+    }
+}

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/IntStackTest.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/IntStackTest.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/IntStackTest.java	Sat Apr 10 22:15:32 2004
@@ -14,7 +14,7 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.ber.digester ;
 
 
 import java.util.EmptyStackException ;

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/LongStackTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/LongStackTest.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,151 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the LongStack class.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class LongStackTest extends TestCase
+{
+    LongStack stack = null ;
+    
+    
+    /**
+     * Runs the test. 
+     * 
+     * @param args nada
+     */
+    public static void main( String[] args )
+    {
+        junit.textui.TestRunner.run( LongStackTest.class ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp() ;
+        stack = new LongStack() ;
+    }
+    
+    
+    /**
+     * Constructor for IntStackTest.
+     * @param arg0
+     */
+    public LongStackTest( String arg0 )
+    {
+        super( arg0 ) ;
+    }
+
+    
+    public void testEmpty()
+    {
+        assertTrue( "Newly created stacks should be empty", stack.empty() ) ;
+        stack.push( 1234223332233234322l ) ;
+        assertFalse( "Stack with item should not be empty", stack.empty() ) ;
+        stack.pop() ;
+        assertTrue( "Stack last int popped should be empty", stack.empty() ) ;
+    }
+
+    
+    public void testPeek()
+    {
+        try
+        {
+            stack.peek() ;
+            throw new AssertionError( 
+                    "Peek should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( int ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.peek() ) ;
+        }
+    }
+
+    
+    public void testPop()
+    {
+        try
+        {
+            stack.pop() ;
+            throw new AssertionError( 
+                    "Pop should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( long ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+
+        for( long ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+        }
+        for( long ii = 10; ii < 0; ii-- )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+    }
+
+    
+    public void testPush()
+    {
+        stack.push( 0L ) ;
+        stack.push( 0L ) ;
+        assertFalse( stack.empty() ) ;
+        assertTrue( 0L == stack.pop() ) ;
+        assertTrue( 0L == stack.pop() ) ;
+    }
+
+    
+    public void testSearch()
+    {
+        stack.push( 0L ) ;
+        stack.push( 1L ) ;
+        assertTrue( 2L == stack.search( 0L ) ) ;
+        stack.push( 0L ) ;
+        assertTrue( 1L == stack.search( 0L ) ) ;
+        stack.push( 0L ) ;
+        assertTrue( 3L == stack.search( 1L ) ) ;
+        assertTrue( -1L == stack.search( 44L ) ) ;
+    }
+}

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/RulesBaseTest.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/RulesBaseTest.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/RulesBaseTest.java	Sat Apr 10 22:15:32 2004
@@ -17,11 +17,9 @@
 package org.apache.snickers.ber.digester ;
 
 
-import junit.framework.* ;
+import junit.framework.TestCase ;
 
-import java.util.List;
-
-import org.apache.snickers.ber.IntStack;
+import java.util.List ;
 
 
 /**

Added: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/ShortStackTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/ShortStackTest.java	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,151 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.snickers.ber.digester ;
+
+
+import java.util.EmptyStackException ;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the ShortStack class.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ShortStackTest extends TestCase
+{
+    ShortStack stack = null ;
+    
+    
+    /**
+     * Runs the test. 
+     * 
+     * @param args nada
+     */
+    public static void main( String[] args )
+    {
+        junit.textui.TestRunner.run( ShortStackTest.class ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp() ;
+        stack = new ShortStack() ;
+    }
+    
+    
+    /**
+     * Constructor for IntStackTest.
+     * @param arg0
+     */
+    public ShortStackTest( String arg0 )
+    {
+        super( arg0 ) ;
+    }
+
+    
+    public void testEmpty()
+    {
+        assertTrue( "Newly created stacks should be empty", stack.empty() ) ;
+        stack.push( ( short ) 12342 ) ;
+        assertFalse( "Stack with item should not be empty", stack.empty() ) ;
+        stack.pop() ;
+        assertTrue( "Stack last int popped should be empty", stack.empty() ) ;
+    }
+
+    
+    public void testPeek()
+    {
+        try
+        {
+            stack.peek() ;
+            throw new AssertionError( 
+                    "Peek should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( int ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ( short ) ii ) ;
+            assertTrue( ii == stack.peek() ) ;
+        }
+    }
+
+    
+    public void testPop()
+    {
+        try
+        {
+            stack.pop() ;
+            throw new AssertionError( 
+                    "Pop should have thrown an EmptyStackException" ) ;
+        }
+        catch( EmptyStackException e )
+        {
+            assertNotNull( "EmptyStackException should not be null", e ) ;
+        }
+        
+        for( short ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+
+        for( short ii = 0; ii < 10; ii++ )
+        {    
+            stack.push( ii ) ;
+        }
+        for( short ii = 10; ii < 0; ii-- )
+        {    
+            stack.push( ii ) ;
+            assertTrue( ii == stack.pop() ) ;
+        }
+    }
+
+    
+    public void testPush()
+    {
+        stack.push( ( short ) 0 ) ;
+        stack.push( ( short ) 0 ) ;
+        assertFalse( stack.empty() ) ;
+        assertTrue( 0 == stack.pop() ) ;
+        assertTrue( 0 == stack.pop() ) ;
+    }
+
+    
+    public void testSearch()
+    {
+        stack.push( ( short ) 0 ) ;
+        stack.push( ( short ) 1 ) ;
+        assertTrue( 2 == stack.search( ( short ) 0 ) ) ;
+        stack.push( ( short ) 0 ) ;
+        assertTrue( 1 == stack.search( ( short ) 0 ) ) ;
+        stack.push( ( short ) 0 ) ;
+        assertTrue( 3 == stack.search( ( short ) 1 ) ) ;
+        assertTrue( -1 == stack.search( ( short ) 44 ) ) ;
+    }
+}

Modified: incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/TagTreeTest.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/TagTreeTest.java	(original)
+++ incubator/directory/snickers/trunk/ber/src/test/org/apache/snickers/ber/digester/TagTreeTest.java	Sat Apr 10 22:15:32 2004
@@ -17,9 +17,7 @@
 package org.apache.snickers.ber.digester ;
 
 
-import java.util.List;
-
-import org.apache.snickers.ber.IntStack;
+import java.util.List ;
 
 import junit.framework.TestCase ;
 

Added: incubator/directory/snickers/trunk/codec-stateful/maven.xml
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/trunk/codec-stateful/maven.xml	Sat Apr 10 22:15:32 2004
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> 
+  
+<project 
+  default="jar:install" 
+  >
+  
+</project>

Mime
View raw message