directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: rev 22809 - in incubator/directory/snickers/branches/ber-decoder/modules/runtime/src: java/org/apache/snickers/encoding java/org/apache/snickers/encoding/ber test/org/apache/snickers/encoding/ber
Date Sat, 10 Jul 2004 18:54:21 GMT
Author: adc
Date: Sat Jul 10 11:54:20 2004
New Revision: 22809

Added:
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/Decoder.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderCallback.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderException.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderMonitor.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderMonitorAdapter.java
Removed:
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoderCallback.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/MutableTupleNode.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TagId.java
Modified:
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoder.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoderCallbackAdapter.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoderMonitor.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Length.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Tag.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Tuple.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TupleNode.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TupleStack.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TypeClass.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/AbstractDecoderTestCase.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/AbstractDecoderTestCaseTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERDecoderCallbackAdapterTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERDecoderTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERTestDecoder.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/ConstructedTLVTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/LengthTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/MultiByteLengthTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/MultiByteTagTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SimplePrimitiveTLVTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SingleByteLengthTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SingleByteTagTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TagTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TupleTest.java
   incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TypeClassTest.java
Log:
Striped out reliance on commons-codec (except for tests)

Added: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/Decoder.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/Decoder.java	Sat Jul 10 11:54:20 2004
@@ -0,0 +1,63 @@
+/**
+ *
+ * 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.encoding;
+
+import java.nio.ByteBuffer;
+
+
+/**
+ * A decoder which decodes encoded data as it arrives in peices while
+ * maintaining the state of the decode operation between the arrival of
+ * encoded chunks.
+ * <p/>
+ * As chunks of encoded data arrive the decoder processes each chunk of encoded
+ * data and maintains decoding state in between arrivals: it is hence stateful
+ * and should be associated with a single channel or encoded data producer.
+ * When an arbitrary unit of encoding, to be determined by the encoding scheme,
+ * has been decoded, the <code>decode()</code> method of the registered
+ * DecoderCallback is called.
+ *
+ * @author <a href="mailto:commons-dev@jakarta.apache.org">Jakarta Commons</a>
+ * @version $Rev: 20474 $
+ */
+public interface Decoder
+{
+    /**
+     * Decodes a peice of encoded data.  The nature of this call, synchronous
+     * verses asynchonous, with respect to driving the actual decoding of the
+     * encoded data argument is determined by an implementation.  A return from
+     * this method does not guarrantee any callbacks: zero or more callbacks
+     * may occur during this call.
+     *
+     * @param encoded an object representing a peice of encoded data
+     */
+    void decode( ByteBuffer encoded ) throws DecoderException;
+
+    /**
+     * Sets the callback for this Decoder.
+     *
+     * @param cb the callback to inform of a complete decode operation
+     */
+    void setCallback( DecoderCallback cb );
+
+    /**
+     * Monitors all kinds of events that occur during processing.
+     *
+     * @param monitor to set for this Decoder
+     */
+    void setDecoderMonitor( DecoderMonitor monitor );
+}

Added: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderCallback.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderCallback.java	Sat Jul 10 11:54:20 2004
@@ -0,0 +1,66 @@
+/**
+ *
+ * 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.encoding;
+
+import java.nio.ByteBuffer;
+
+import org.apache.snickers.encoding.ber.Tuple;
+
+
+/**
+ * Callback interface for stateful decoder callbacks.
+ *
+ * @author <a href="mailto:commons-dev@jakarta.apache.org">Jakarta Commons</a>
+ * @version $Rev: 9765 $
+ */
+public interface DecoderCallback
+{
+    /**
+     * Callback to deliver a fully decoded object.
+     *
+     * @param decoder the stateful decoder driving the callback
+     * @param tuple   the object that was decoded
+     */
+    void decodeOccurred( Decoder decoder, Tuple tuple );
+
+    /**
+     * Method used to receive notification that a TLV tuple has begun to be
+     * read.  The following tag properties of the TLV tuple are valid at this
+     * point:
+     * <ul>
+     * <li>id</li>
+     * <li>isPrimitive</li>
+     * <li>typeClass</li>
+     * <li>length</li>
+     * </ul>
+     *
+     * @param tlv the TLV tuple
+     */
+    void start( Tuple tlv );
+
+    /**
+     * Method used to provide the possibly partial contents of a TLV value.
+     *
+     * @param buffer the possibly partial contents of a TLV value
+     */
+    void contents( ByteBuffer buffer );
+
+    /**
+     * Method used to provide notification that a TLV tuple has been read.
+     */
+    void end();
+}

Added: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderException.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderException.java	Sat Jul 10 11:54:20 2004
@@ -0,0 +1,44 @@
+/**
+ *
+ * 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.encoding;
+
+
+/**
+ * @version $Revision: $ $Date: $
+ */
+public class DecoderException extends Exception
+{
+    public DecoderException()
+    {
+        super();
+    }
+
+    public DecoderException( String message )
+    {
+        super( message );
+    }
+
+    public DecoderException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public DecoderException( Throwable cause )
+    {
+        super( cause );
+    }
+}

Added: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderMonitor.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderMonitor.java	Sat Jul 10 11:54:20 2004
@@ -0,0 +1,81 @@
+/**
+ *
+ * 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.encoding;
+
+
+/**
+ * Monitors decoder activity.  This class borrowed some from the <code>
+ * org.xml.sax.ErrorHandler</code> interface and its documentation.  A monitor
+ * is a generalized callback for any sort of activity used for tracking both
+ * successes and failures.  So you'll realize similarities between monitors
+ * and callbacks especially where the callbackOccurred() method is concerned.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev: 9765 $
+ */
+public interface DecoderMonitor
+{
+    /**
+     * Receive notification of a recoverable error.  This callback is used to
+     * denote a failure to handle a unit of data to be encoded or decoded.  The
+     * entire [en|de]codable unit is lost but the [en|de]coding operation can
+     * still proceed.
+     *
+     * @param decoder   the decoder that had the error
+     * @param exception the error information encapsulated in an exception
+     */
+    void error( Decoder decoder, Exception exception );
+
+    /**
+     * Receive notification of a warning.  The decoder must continue to provide
+     * normal callbacks after invoking this method: it should still be possible
+     * for the application to process the encoded data through to the end.
+     *
+     * @param decoder   the decoder that had the error
+     * @param exception the warning information encapsulated in an exception
+     */
+    void fatalError( Decoder decoder, Exception exception );
+
+    /**
+     * Receive notification of a non-recoverable error.  The application must
+     * assume that the stream data is unusable after the decoder has invoked
+     * this method, and should continue (if at all) only for the sake of
+     * collecting addition error messages: in fact, decoders are free to stop
+     * reporting any other events once this method has been invoked.
+     *
+     * @param decoder   the decoder that had the failure
+     * @param exception the warning information encapsulated in an exception
+     */
+    void warning( Decoder decoder, Exception exception );
+
+    /**
+     * Monitors callbacks that deliver a fully decoded object.
+     *
+     * @param decoder the stateful decoder driving the callback
+     * @param decoded the object that was decoded
+     */
+    void callbackOccured( Decoder decoder, DecoderCallback cb, Object decoded );
+
+    /**
+     * Monitors changes to the callback.
+     *
+     * @param decoder the decoder whose callback was set
+     * @param oldcb   the unset old callback, or null if none was set
+     * @param newcb   the newly set callback, or null if callback is cleared
+     */
+    void callbackSet( Decoder decoder, DecoderCallback oldcb, DecoderCallback newcb );
+}

Added: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderMonitorAdapter.java
==============================================================================
--- (empty file)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/DecoderMonitorAdapter.java	Sat Jul 10 11:54:20 2004
@@ -0,0 +1,96 @@
+/**
+ *
+ * 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.encoding;
+
+
+/**
+ * A do nothing decoder monitor adapter.  At a bare minimum warning, error and
+ * fatal exceptions are reported to the console when using this adapter to
+ * prevent exceptions from being completely ignored.
+ *
+ * @author Apache Software Foundation
+ * @version $Rev: 9765 $
+ */
+public class DecoderMonitorAdapter implements DecoderMonitor
+{
+    /**
+     * Receive notification of a recoverable error.  This callback is used to
+     * denote a failure to handle a unit of data to be encoded or decoded.  The
+     * entire [en|de]codable unit is lost but the [en|de]coding operation can
+     * still proceed.
+     *
+     * @param decoder   the decoder that had the error
+     * @param exception the error information encapsulated in an exception
+     */
+    public void error( Decoder decoder, Exception exception )
+    {
+        System.err.println( "ERROR: " + exception.getMessage() );
+    }
+
+
+    /**
+     * Receive notification of a warning.  The decoder must continue to provide
+     * normal callbacks after invoking this method: it should still be possible
+     * for the application to process the encoded data through to the end.
+     *
+     * @param decoder   the decoder that had the error
+     * @param exception the warning information encapsulated in an exception
+     */
+    public void fatalError( Decoder decoder, Exception exception )
+    {
+        System.err.println( "FATAL: " + exception.getMessage() );
+    }
+
+
+    /**
+     * Receive notification of a non-recoverable error.  The application must
+     * assume that the stream data is unusable after the decoder has invoked
+     * this method, and should continue (if at all) only for the sake of
+     * collecting addition error messages: in fact, decoders are free to stop
+     * reporting any other events once this method has been invoked.
+     *
+     * @param decoder   the decoder that had the failure
+     * @param exception the warning information encapsulated in an exception
+     */
+    public void warning( Decoder decoder, Exception exception )
+    {
+        System.err.println( "WARN: " + exception.getMessage() );
+    }
+
+
+    /**
+     * Monitors callbacks that deliver a fully decoded object.
+     *
+     * @param decoder the stateful decoder driving the callback
+     * @param decoded the object that was decoded
+     */
+    public void callbackOccured( Decoder decoder, DecoderCallback cb, Object decoded )
+    {
+    }
+
+
+    /**
+     * Monitors changes to the callback.
+     *
+     * @param decoder the decoder whose callback was set
+     * @param oldcb   the unset old callback, or null if none was set
+     * @param newcb   the newly set callback, or null if callback is cleared
+     */
+    public void callbackSet( Decoder decoder, DecoderCallback oldcb, DecoderCallback newcb )
+    {
+    }
+}

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoder.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoder.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoder.java	Sat Jul 10 11:54:20 2004
@@ -14,14 +14,14 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber;
+package org.apache.snickers.encoding.ber;
 
 import java.nio.ByteBuffer;
 
-import org.apache.commons.codec.DecoderException;
-import org.apache.commons.codec.stateful.DecoderCallback;
-import org.apache.commons.codec.stateful.DecoderMonitor;
-import org.apache.commons.codec.stateful.StatefulDecoder;
+import org.apache.snickers.encoding.Decoder;
+import org.apache.snickers.encoding.DecoderCallback;
+import org.apache.snickers.encoding.DecoderException;
+import org.apache.snickers.encoding.DecoderMonitor;
 
 
 /**
@@ -56,7 +56,7 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class BERDecoder implements StatefulDecoder
+public class BERDecoder implements Decoder
 {
     public final State TAG_STATE = new TagState();
     public final State LENGTH_STATE = new LengthState();
@@ -88,7 +88,7 @@
 
     /**
      * Obtain the current state of the decoder.<p/>
-     *
+     * <p/>
      * This accessor is protected and is intended to be used by testing classes
      * that will subclass off of this decoder.  All other uses are strongly
      * discouraged.
@@ -102,7 +102,7 @@
     }
 
     /* (non-Javadoc)
-     * @see StatefulDecoder#setCallback(DecoderCallback)
+     * @see Decoder#setCallback(DecoderCallback)
      */
     public void setCallback( DecoderCallback cb )
     {
@@ -111,7 +111,7 @@
 
 
     /* (non-Javadoc)
-     * @see org.apache.commons.codec.stateful.StatefulDecoder#setDecoderMonitor(
+     * @see org.apache.commons.codec.stateful.Decoder#setDecoderMonitor(
      * org.apache.commons.codec.stateful.DecoderMonitor)
      */
     public void setDecoderMonitor( DecoderMonitor monitor )
@@ -123,24 +123,23 @@
      * Expects a ByteBuffer containing BER encoded data.
      *
      * @throws ClassCastException       if the encoded argument is not a ByteBuffer
-     * @throws IllegalArgumentException if the buffer is null or empty
+     * @throws IllegalArgumentException if the encoded is null or empty
      * @see org.apache.commons.codec.stateful.StatefulDecoder#decode(java.lang.Object)
      */
-    public void decode( Object encoded ) throws DecoderException
+    public void decode( ByteBuffer encoded ) throws DecoderException
     {
         if ( encoded == null ) throw new IllegalArgumentException( "Parameter 'encoded' is null" );
-        ByteBuffer buffer = (ByteBuffer) encoded;
 
         /*
          * This loop is used instead of costly recursion.  This requires each
-         * of the statewise decode methods to process bytes from the buffer.  If
+         * of the statewise decode methods to process bytes from the encoded.  If
          * they can process enough to switch state they do and return
          * immediately.  This loop makes sure the next processing state is
          * handled if there is more data for that state.
          */
-        while ( buffer.hasRemaining() )
+        while ( encoded.hasRemaining() )
         {
-            state.decode( buffer );
+            state.decode( encoded );
         }
     }
 

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoderCallbackAdapter.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoderCallbackAdapter.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoderCallbackAdapter.java	Sat Jul 10 11:54:20 2004
@@ -14,11 +14,12 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber;
+package org.apache.snickers.encoding.ber;
 
 import java.nio.ByteBuffer;
 
-import org.apache.commons.codec.stateful.StatefulDecoder;
+import org.apache.snickers.encoding.Decoder;
+import org.apache.snickers.encoding.DecoderCallback;
 
 
 /**
@@ -27,7 +28,7 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class BERDecoderCallbackAdapter implements BERDecoderCallback
+public class BERDecoderCallbackAdapter implements DecoderCallback
 {
     /**
      * Method used to receive notification that a TLV tuple has begun to be
@@ -68,9 +69,9 @@
      * Callback to deliver a fully decoded object.
      *
      * @param decoder the stateful decoder driving the callback
-     * @param decoded the object that was decoded
+     * @param tuple   the object that was decoded
      */
-    public void decodeOccurred( StatefulDecoder decoder, Object decoded )
+    public void decodeOccurred( Decoder decoder, Tuple tuple )
     {
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoderMonitor.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoderMonitor.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/BERDecoderMonitor.java	Sat Jul 10 11:54:20 2004
@@ -14,37 +14,37 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
-import org.apache.commons.codec.stateful.DecoderMonitor ;
+import org.apache.snickers.encoding.DecoderMonitor;
 
 
 /**
- * A monitor designed for extended BER decoder functionality with greater 
+ * A monitor designed for extended BER decoder functionality with greater
  * detail to specific BER decoder events.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public interface BERDecoderMonitor extends DecoderMonitor
 {
     /**
-     * Method used to receive notification that a tag was decoded.  The 
+     * Method used to receive notification that a tag was decoded.  The
      * following tag properties of the TLV tuple are valid at this point:
      * <ul>
      * <li>id</li>
      * <li>isPrimitive</li>
      * <li>typeClass</li>
      * </ul>
-     * 
+     *
      * @param tlv the TLV tuple
      */
-    void tagDecoded( Tuple tlv ) ;
-    
+    void tagDecoded( Tuple tlv );
+
     /**
-     * Method used to receive notification that a length was decoded.  The 
+     * Method used to receive notification that a length was decoded.  The
      * following properties of the TLV tuple are valid at this point:
      * <ul>
      * <li>id</li>
@@ -52,8 +52,8 @@
      * <li>typeClass</li>
      * <li>length</li>
      * </ul>
-     * 
+     *
      * @param tlv the TLV tuple
      */
-    void lengthDecoded( Tuple tlv ) ;
+    void lengthDecoded( Tuple tlv );
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Length.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Length.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Length.java	Sat Jul 10 11:54:20 2004
@@ -14,38 +14,52 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
-import java.nio.ByteBuffer ;
+import java.nio.ByteBuffer;
 
-import org.apache.commons.codec.DecoderException ;
+import org.apache.snickers.encoding.DecoderException;
 
 
 /**
  * The length component of a BER TLV Tuple.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class Length
 {
-    /** used to mark length as indefinite */
-    public static final int INDEFINITE = -2 ;
-    /** used to mark length as undefined */
-    public static final int UNDEFINED = -1 ;
-    /** the end long form terminate bit flag mask */
-    public static final int END_MASK = 0x80 ;
-
-    /** the value for this tlv length */
-    private int value = UNDEFINED ;
-    /** the number of octets needed to complete this length component */
-    private int numOctets = UNDEFINED ;
-    /** whether or not this length has been fixated */
-    private boolean isFixated = false ;
-    /** a byte buffer used to collect the arriving length octets */
-    private final ByteBuffer buf = ByteBuffer.allocate( 5 ) ;
+    /**
+     * used to mark length as indefinite
+     */
+    public static final int INDEFINITE = -2;
+    /**
+     * used to mark length as undefined
+     */
+    public static final int UNDEFINED = -1;
+    /**
+     * the end long form terminate bit flag mask
+     */
+    public static final int END_MASK = 0x80;
+
+    /**
+     * the value for this tlv length
+     */
+    private int value = UNDEFINED;
+    /**
+     * the number of octets needed to complete this length component
+     */
+    private int numOctets = UNDEFINED;
+    /**
+     * whether or not this length has been fixated
+     */
+    private boolean isFixated = false;
+    /**
+     * a byte buffer used to collect the arriving length octets
+     */
+    private final ByteBuffer buf = ByteBuffer.allocate( 5 );
 
 
     /**
@@ -55,7 +69,7 @@
      */
     public boolean isFixated()
     {
-        return isFixated ;
+        return isFixated;
     }
 
 
@@ -65,10 +79,10 @@
      */
     void clear()
     {
-        isFixated = false ;
-        value = 0 ;
-        numOctets = 1 ;
-        buf.clear() ;
+        isFixated = false;
+        value = 0;
+        numOctets = 1;
+        buf.clear();
     }
 
 
@@ -81,9 +95,9 @@
      */
     void fixate() throws DecoderException
     {
-        buf.flip() ;
-        value = getLength( buf ) ;
-        isFixated = true ;
+        buf.flip();
+        value = getLength( buf );
+        isFixated = true;
     }
 
 
@@ -97,10 +111,10 @@
     {
         if ( isFixated )
         {
-            throw new IllegalStateException( "data added to fixated length" ) ;
+            throw new IllegalStateException( "data added to fixated length" );
         }
 
-        buf.put( octet ) ;
+        buf.put( octet );
 
         if ( buf.position() == 1 )
         {
@@ -108,11 +122,11 @@
             if ( END_MASK == ( octet & END_MASK ) && ( octet & 0x7F ) > 0 )
             {
                 // capture number of octets we need to compute length
-                numOctets = octet & 0x7F ;
+                numOctets = octet & 0x7F;
             }
             else
             {
-                fixate() ;
+                fixate();
             }
         }
         
@@ -122,7 +136,7 @@
          */
         else if ( buf.position() >= numOctets + 1 )
         {
-            fixate() ;
+            fixate();
         }
     }
 
@@ -134,7 +148,7 @@
      */
     public int getLength()
     {
-        return value ;
+        return value;
     }
 
 
@@ -145,7 +159,7 @@
      */
     public int size()
     {
-        return buf.position() ;
+        return buf.position();
     }
 
 
@@ -165,35 +179,35 @@
              * we need to switch to another data type to return because after
              * 5 bytes the int can no longer hold the number.
              */
-            throw new DecoderException( "Length number is too large." ) ;
+            throw new DecoderException( "Length number is too large." );
         }
 
-        byte octet = octets.get() ;
+        byte octet = octets.get();
         
         // if we are using the short form then just return the first octet
         if ( ( octet & END_MASK ) == 0 )
         {
-            return octet ;
+            return octet;
         }
         // using the indefinate form
         else if ( ( octet & 0x7F ) == 0 )
         {
-            return INDEFINITE ;
+            return INDEFINITE;
         }
         
         // using the long form so we calculate the length from all octets
-        int length = 0 ;
+        int length = 0;
     
         // calculate tag value w/ long tag format
         
-        int shift = 0 ;
+        int shift = 0;
         do
         {
-            length |= ( 0xFF & ( int ) octets.get() ) << shift ;
-            shift += 8 ;
+            length |= ( 0xFF & (int) octets.get() ) << shift;
+            shift += 8;
         }
-        while ( octets.hasRemaining() ) ;
+        while ( octets.hasRemaining() );
 
-        return length ;
+        return length;
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Tag.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Tag.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Tag.java	Sat Jul 10 11:54:20 2004
@@ -14,10 +14,11 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber;
+package org.apache.snickers.encoding.ber;
 
+import java.nio.BufferOverflowException;
 
-import org.apache.commons.codec.DecoderException;
+import org.apache.snickers.encoding.DecoderException;
 
 
 /**
@@ -85,7 +86,7 @@
     /**
      * buffer backed by a Java int to collect the arriving tag octets
      */
-    private final TagId buf = new TagId();
+    private final TagBuffer buf = new TagBuffer();
 
 
     /**
@@ -354,5 +355,98 @@
     public final static boolean isConstructed( int octet )
     {
         return ( octet & CONSTRUCTED_FLAG ) == CONSTRUCTED_FLAG;
+    }
+
+
+    /**
+     * Collects up to 4 tag octets.
+     */
+    protected class TagBuffer
+    {
+        /**
+         * the store the tag octets
+         */
+        private byte[] buffer = new byte[4];
+
+        /**
+         * the number of octets currently stored
+         */
+        private int _size = 0;
+
+
+        /**
+         * Puts an octet into this collector.
+         *
+         * @param octet the octet to put into the collector.
+         */
+        public void put( byte octet )
+        {
+            if ( _size == 4 ) throw new BufferOverflowException();
+
+            buffer[_size++] = octet;
+        }
+
+
+        /**
+         * Clears all the tag octets resetting the tag and size to zero.
+         */
+        public void clear()
+        {
+            buffer[0] = buffer[1] = buffer[2] = buffer[3] = 0;
+            _size = 0;
+        }
+
+
+        /**
+         * Gets the number of octets stored by this TagId
+         *
+         * @return
+         */
+        public int size()
+        {
+            return _size;
+        }
+
+
+        /**
+         * Gets a unique integer value representing the tag octets.
+         *
+         * @return the integer value of the tag.
+         */
+        public int getIntValue()
+        {
+            return (int) ( ( buffer[0] << 24 ) | ( buffer[1] << 16 ) | ( buffer[2] << 8 ) | buffer[3] );
+        }
+
+
+        /**
+         * Gets the 4 octets for the tag.
+         *
+         * @return
+         */
+        public byte[] toArray()
+        {
+            byte[] octets = new byte[_size];
+
+            for ( int i = 0; i < _size; i++ ) octets[i] = buffer[i];
+
+            return octets;
+        }
+
+
+        /**
+         * Gets the byte at a specific index.
+         *
+         * @param index
+         * @return
+         * @throws IndexOutOfBoundsException
+         */
+        public byte get( int index )
+        {
+            if ( index >= _size ) throw new IndexOutOfBoundsException( "accesing index " + index + " with a size of " + _size );
+
+            return buffer[index];
+        }
+
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Tuple.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Tuple.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/Tuple.java	Sat Jul 10 11:54:20 2004
@@ -14,7 +14,7 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber;
+package org.apache.snickers.encoding.ber;
 
 
 import java.nio.ByteBuffer;
@@ -435,7 +435,7 @@
     {
         if ( tagLength >= 6 )
         {
-            throw new IllegalArgumentException( "cannot support id's as large as " + id + " unless we start using longs for the id" ) ;
+            throw new IllegalArgumentException( "cannot support id's as large as " + id + " unless we start using longs for the id" );
         }
 
         octets.put( (byte) typeClass.getValue() );
@@ -453,7 +453,7 @@
 
         octets.put( 0, (byte) ( octets.get( 0 ) | Tag.SHORT_MASK ) );
 
-        for ( int i = 0; i < tagLength-1; i++ )
+        for ( int i = 0; i < tagLength - 1; i++ )
         {
             int shift = ( tagLength - i - 2 ) * 7;
             octets.put( (byte) ( id >> shift & Tag.LONG_MASK | ( shift == 0 ? 0 : BIT_7 ) ) );

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TupleNode.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TupleNode.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TupleNode.java	Sat Jul 10 11:54:20 2004
@@ -14,42 +14,41 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
-import java.util.List ;
-import java.util.Iterator ;
-
-import java.nio.ByteBuffer ;
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+import java.util.List;
 
 
 /**
  * A TLV Tuple tree node modeled in the likeness of a TreeNode.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public interface TupleNode
 {
     /**
-     * Gets the parent tuple node to this node or null if a parent does not 
-     * exist.  The analogous method on the <code>TreeNode</code> interface 
+     * Gets the parent tuple node to this node or null if a parent does not
+     * exist.  The analogous method on the <code>TreeNode</code> interface
      * would be <code>getParent()</code>.
-     * 
+     *
      * @return the parent node or null if one does not exist
      */
-    TupleNode getParentTupleNode() ;
-    
+    TupleNode getParentTupleNode();
+
     /**
      * Gets an iterator over this node's children.  The analogous interface on
      * the <code>TreeNode</code> interface would be <code>children</code> which
      * returns an <code>Enumeration</code> instead of an <code>Iterator</code>.
-     *  
+     *
      * @return an iterator over this node's children
      */
-    Iterator getChildren() ;
-    
+    Iterator getChildren();
+
     /**
      * Gets a tuple node at an index.  The analogous interface on <code>TreeNode
      * </code> would be the <code>getChildAt</code> method.
@@ -57,64 +56,64 @@
      * @param index the index of the child to get
      * @return the child node at the specified index
      */
-    TupleNode getChildTupleNodeAt( int index ) ;
-    
+    TupleNode getChildTupleNodeAt( int index );
+
     /**
-     * Gets the chunked value buffer fragments collected within this node.  
-     * 
+     * Gets the chunked value buffer fragments collected within this node.
+     *
      * @return the value buffer parts for this node
      */
-    List getValueChunks() ;
-    
+    List getValueChunks();
+
     /**
      * Gets the index of a child if the child node if it exists.  The analog
-     * within <code>TreeNode<code> takes a <code>TreeNode</code> instead of a 
+     * within <code>TreeNode<code> takes a <code>TreeNode</code> instead of a
      * <code>TupleNode</code>.
-     * 
+     *
      * @param node the child node to get the index for
      * @return the index of the child node or -1 if the node does not exist
      */
-    int getIndex( TupleNode node ) ;
-    
+    int getIndex( TupleNode node );
+
     /**
-     * Gets the number of child nodes contained.  This is the same as in 
+     * Gets the number of child nodes contained.  This is the same as in
      * <code>TreeNode.getChildCount()</code> as well.
-     * 
+     *
      * @return the number of child nodes contained.
      */
-    int getChildCount() ;
-    
+    int getChildCount();
+
     /**
-     * Gets the number of child nodes contained.  This is the same as in 
+     * Gets the number of child nodes contained.  This is the same as in
      * <code>TreeNode.size()</code> as well.
-     * 
+     *
      * @return the number of children
      */
-    int size() ;
-    
+    int size();
+
     /**
      * Gets the Tuple this node represents.   This is the analogous to <code>
      * TreeNode.getUserObject()</code>.
-     * 
-     * @return the tuple this node represents or null if one has not been 
-     * assigned
+     *
+     * @return the tuple this node represents or null if one has not been
+     *         assigned
      */
-    Tuple getTuple() ;
-    
+    Tuple getTuple();
+
     /**
-     * Recursively encodes the tree rooted at this node. 
-     * 
+     * Recursively encodes the tree rooted at this node.
+     *
      * @param buf the buffer populated with the BER encoded tlv tree contents
      */
-    void encode( ByteBuffer buf ) ;
-    
+    void encode( ByteBuffer buf );
+
     /**
      * Checks to see if two trees are equal.  Note that the order of children
-     * within the tree as well as the tuples and their contents make a 
+     * within the tree as well as the tuples and their contents make a
      * difference to <code>equals()</code>.
-     * 
+     *
      * @param obj the object to compare this node to
      * @return true if the obj and this node are exact replicas of one another
      */
-    boolean equals( Object obj ) ;
+    boolean equals( Object obj );
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TupleStack.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TupleStack.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TupleStack.java	Sat Jul 10 11:54:20 2004
@@ -14,14 +14,14 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.snickers.ber;
+package org.apache.snickers.encoding.ber;
 
 import java.nio.ByteBuffer;
 import java.util.Stack;
 
-import org.apache.commons.codec.stateful.DecoderCallback;
-import org.apache.commons.codec.stateful.DecoderMonitor;
-import org.apache.commons.codec.stateful.DecoderMonitorAdapter;
+import org.apache.snickers.encoding.DecoderCallback;
+import org.apache.snickers.encoding.DecoderMonitor;
+import org.apache.snickers.encoding.DecoderMonitorAdapter;
 
 
 /**
@@ -37,7 +37,7 @@
     /**
      * this decoder's callback
      */
-    private BERDecoderCallback BERcallback = new BERDecoderCallbackAdapter();
+    private DecoderCallback BERcallback = new BERDecoderCallbackAdapter();
 
     /**
      * the monitor used by this decoder
@@ -86,7 +86,7 @@
     {
         this.callback = callback;
 
-        if ( callback instanceof BERDecoderCallback ) BERcallback = (BERDecoderCallback) callback;
+        if ( callback instanceof DecoderCallback ) BERcallback = (DecoderCallback) callback;
     }
 
     /**

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TypeClass.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TypeClass.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/encoding/ber/TypeClass.java	Sat Jul 10 11:54:20 2004
@@ -14,7 +14,7 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber;
+package org.apache.snickers.encoding.ber;
 
 
 import java.util.List;
@@ -34,8 +34,7 @@
  * <li>PRIVATE</li>
  * </ul>
  *
- * @author <a href="mailto:directory-dev@incubator.apache.org">
- *         Apache Directory Project</a>
+ * @author <a href="mailto:directory-dev@incubator.apache.org" Apache Directory Project</a>
  * @version $Rev$
  */
 public class TypeClass extends ValuedEnum

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/AbstractDecoderTestCase.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/AbstractDecoderTestCase.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/AbstractDecoderTestCase.java	Sat Jul 10 11:54:20 2004
@@ -14,42 +14,51 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
-import java.nio.ByteBuffer ;
-import java.util.ArrayList ;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
 
-import org.apache.commons.codec.binary.Binary ;
-import org.apache.commons.codec.DecoderException ;
-import org.apache.commons.codec.stateful.DecoderMonitor ;
-import org.apache.commons.codec.stateful.DecoderCallback ;
-import org.apache.commons.codec.stateful.StatefulDecoder ;
+import junit.framework.TestCase;
 
-import org.apache.commons.lang.exception.ExceptionUtils ;
-
-import junit.framework.TestCase ;
+import org.apache.commons.codec.binary.Binary;
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.snickers.encoding.Decoder;
+import org.apache.snickers.encoding.DecoderCallback;
+import org.apache.snickers.encoding.DecoderException;
+import org.apache.snickers.encoding.DecoderMonitor;
 
 
 /**
  * Tests the BER decoder.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev: 9766 $
  */
-public abstract class AbstractDecoderTestCase extends TestCase 
-    implements BERDecoderCallback, DecoderMonitor
+public abstract class AbstractDecoderTestCase extends TestCase
+        implements DecoderCallback, DecoderMonitor
 {
-    /** list of encountered TLV's as we recieve completed decode callbacks */
-    protected ArrayList tlvList = new ArrayList() ;
-    /** the decoder that is constructed every time */
-    protected BERTestDecoder decoder = null ;
-    /** value accumulator */
-    ByteBuffer buffer = ByteBuffer.allocate(11111) ;
-    /** stack counter */
+    /**
+     * list of encountered TLV's as we recieve completed decode callbacks
+     */
+    protected ArrayList tlvList = new ArrayList();
+    /**
+     * the decoder that is constructed every time
+     */
+    protected BERTestDecoder decoder = null;
+    /**
+     * value accumulator
+     */
+    ByteBuffer buffer = ByteBuffer.allocate( 11111 );
+    /**
+     * stack counter
+     */
     int level;
-    /** expected state */
+    /**
+     * expected state
+     */
     BERDecoder.State expectedState;
 
     /*
@@ -57,37 +66,39 @@
      */
     protected void setUp() throws Exception
     {
-        super.setUp() ;
-        decoder = new BERTestDecoder() ;
-        decoder.setCallback( this ) ;
-        decoder.setDecoderMonitor( this ) ;
+        super.setUp();
+        decoder = new org.apache.snickers.encoding.ber.BERTestDecoder();
+        decoder.setCallback( this );
+        decoder.setDecoderMonitor( this );
         level = 0;
         buffer.clear();
     }
 
-    
+
     /*
      * @see TestCase#tearDown()
      */
     protected void tearDown() throws Exception
     {
-        super.tearDown() ;
-        tlvList.clear() ;
-        decoder = null ;
+        super.tearDown();
+        tlvList.clear();
+        decoder = null;
     }
 
-    
+
     /**
      * Constructor for BERDecoderTest.
+     *
      * @param arg0
      */
     public AbstractDecoderTestCase( String arg0 )
     {
-        super( arg0 ) ;
+        super( arg0 );
     }
 
     /**
      * Set the expected state when tuple is decoded
+     *
      * @param expectedState the xpected state when tuple is decoded
      */
     public void setExpectedState( BERDecoder.State expectedState )
@@ -96,113 +107,111 @@
     }
 
     /**
-     * Fragments an array of bytes into multiple arrays 'attempting' to keep 
-     * them the same size however the last fragment will be an array 
+     * Fragments an array of bytes into multiple arrays 'attempting' to keep
+     * them the same size however the last fragment will be an array
      * bites.length%size which may or may not be of the requested fragment size.
-     * However it will never be greater.  Use this method to break appart TLV 
+     * However it will never be greater.  Use this method to break appart TLV
      * byte arrays to feed them into the decoder for testing.
-     * 
+     *
      * @param bites the bites to fragment
-     * @param size the maximum size of a fragment
+     * @param size  the maximum size of a fragment
      * @return the array of byte[] fragments
      */
     public byte[][] fragment( byte[] bites, int size )
     {
-        byte[][] fragments = null ;
-        
+        byte[][] fragments = null;
+
         if ( size <= 0 )
-        {    
-            throw new IllegalArgumentException( 
-                    "fragment size should be 1 or more but was " + size ) ;
-        }
-        
-        int wholeFrags = bites.length/size ;
-        int partialFragSize = bites.length % size ; 
+        {
+            throw new IllegalArgumentException( "fragment size should be 1 or more but was " + size );
+        }
+
+        int wholeFrags = bites.length / size;
+        int partialFragSize = bites.length % size;
 
         /*
          * Allocate what we need depending on the size of our remainder
          */
-        if ( partialFragSize == 0 ) 
+        if ( partialFragSize == 0 )
         {
-            fragments = new byte[wholeFrags][] ;
+            fragments = new byte[wholeFrags][];
         }
         else
         {
-            fragments = new byte[wholeFrags+1][] ;
-            fragments[wholeFrags] = new byte[partialFragSize] ;
+            fragments = new byte[wholeFrags + 1][];
+            fragments[wholeFrags] = new byte[partialFragSize];
         }
-        
+
         for ( int ii = 0; ii < wholeFrags; ii++ )
         {
-            fragments[ii] = new byte[size] ;
-            System.arraycopy( bites, ii * size, fragments[ii], 0, size ) ;
+            fragments[ii] = new byte[size];
+            System.arraycopy( bites, ii * size, fragments[ii], 0, size );
         }
-        
+
         if ( partialFragSize != 0 )
         {
-            int srcPos = wholeFrags * size ;
-            byte[] src = fragments[wholeFrags] ;
-            System.arraycopy( bites, srcPos, src, 0, partialFragSize ) ;
+            int srcPos = wholeFrags * size;
+            byte[] src = fragments[wholeFrags];
+            System.arraycopy( bites, srcPos, src, 0, partialFragSize );
         }
-        
-        return fragments ;
+
+        return fragments;
     }
-    
-    
+
+
     /**
-     * Fragments a byte buffer into multiple buffer 'attempting' to keep 
-     * them the same size however the last fragment will be an array 
+     * Fragments a byte buffer into multiple buffer 'attempting' to keep
+     * them the same size however the last fragment will be an array
      * bites.length%size which may or may not be of the requested fragment size.
-     * However it will never be greater.  Use this method to break appart TLV 
+     * However it will never be greater.  Use this method to break appart TLV
      * bytes to feed them into the decoder for testing.
-     * 
+     *
      * @param bites the bites to fragment
-     * @param size the maximum size of a fragment
+     * @param size  the maximum size of a fragment
      * @return the buffer fragment
      */
     public ByteBuffer[] fragment( ByteBuffer bites, int size )
     {
-        bites = bites.duplicate() ;
-        ByteBuffer[] fragments = null ;
-        
+        bites = bites.duplicate();
+        ByteBuffer[] fragments = null;
+
         if ( size <= 0 )
-        {    
-            throw new IllegalArgumentException( 
-                    "fragment size should be 1 or more but was " + size ) ;
-        }
-        
-        int wholeFrags = bites.remaining()/size ;
-        int partialFragSize = bites.remaining() % size ; 
+        {
+            throw new IllegalArgumentException( "fragment size should be 1 or more but was " + size );
+        }
+
+        int wholeFrags = bites.remaining() / size;
+        int partialFragSize = bites.remaining() % size;
 
         /*
          * Allocate what we need depending on the size of our remainder
          */
-        if ( partialFragSize == 0 ) 
+        if ( partialFragSize == 0 )
         {
-            fragments = new ByteBuffer[wholeFrags] ;
+            fragments = new ByteBuffer[wholeFrags];
         }
         else
         {
-            fragments = new ByteBuffer[wholeFrags+1] ;
-            fragments[wholeFrags] = ByteBuffer.allocate( partialFragSize ) ;
+            fragments = new ByteBuffer[wholeFrags + 1];
+            fragments[wholeFrags] = ByteBuffer.allocate( partialFragSize );
         }
-        
+
         for ( int ii = 0; ii < wholeFrags; ii++ )
         {
-            fragments[ii] = ( ByteBuffer ) bites.slice().limit( size ) ;
-            bites.position( bites.position() + size ) ;
+            fragments[ii] = (ByteBuffer) bites.slice().limit( size );
+            bites.position( bites.position() + size );
         }
-        
+
         if ( partialFragSize != 0 )
         {
-            fragments[wholeFrags].put( bites ) ;
-            fragments[wholeFrags].flip() ;
+            fragments[wholeFrags].put( bites );
+            fragments[wholeFrags].flip();
         }
-        
-        return fragments ;
+
+        return fragments;
     }
-    
-    
+
+
     /**
      * BER decodes a string of 0's and 1's.
      * 
@@ -212,20 +221,20 @@
      */
     public Tuple decode( String bitString ) throws DecoderException
     {
-        byte [] bites = Binary.fromAscii( bitString.getBytes() ) ;
-        ByteBuffer buf = ByteBuffer.wrap( bites ) ;
-        int lastSize = tlvList.size() ;
-        decoder.decode( buf ) ;
-        
+        byte[] bites = Binary.fromAscii( bitString.getBytes() );
+        ByteBuffer buf = ByteBuffer.wrap( bites );
+        int lastSize = tlvList.size();
+        decoder.decode( buf );
+
         if ( tlvList.isEmpty() || tlvList.size() == lastSize )
         {
-            return decoder.getCurrentTuple() ;
+            return decoder.getCurrentTuple();
         }
-        
-        return ( Tuple ) tlvList.get( tlvList.size() - 1 ) ;
+
+        return (Tuple) tlvList.get( tlvList.size() - 1 );
     }
 
-    
+
     /**
      * BER decodes a single byte.
      * 
@@ -235,20 +244,20 @@
      */
     public Tuple decode( byte bite ) throws DecoderException
     {
-        byte [] bites = { bite } ;
-        ByteBuffer buf = ByteBuffer.wrap( bites ) ;
-        int lastSize = tlvList.size() ;
-        decoder.decode( buf ) ;
-        
+        byte[] bites = {bite};
+        ByteBuffer buf = ByteBuffer.wrap( bites );
+        int lastSize = tlvList.size();
+        decoder.decode( buf );
+
         if ( tlvList.isEmpty() || tlvList.size() == lastSize )
         {
-            return decoder.getCurrentTuple() ;
+            return decoder.getCurrentTuple();
         }
-        
-        return ( Tuple ) tlvList.get( tlvList.size() - 1 ) ;
+
+        return (Tuple) tlvList.get( tlvList.size() - 1 );
     }
 
-    
+
     /**
      * BER decodes a byte array.
      * 
@@ -258,19 +267,19 @@
      */
     public Tuple decode( byte[] bites ) throws DecoderException
     {
-        ByteBuffer buf = ByteBuffer.wrap( bites ) ;
-        int lastSize = tlvList.size() ;
-        decoder.decode( buf ) ;
-        
+        ByteBuffer buf = ByteBuffer.wrap( bites );
+        int lastSize = tlvList.size();
+        decoder.decode( buf );
+
         if ( tlvList.isEmpty() || tlvList.size() == lastSize )
         {
-            return decoder.getCurrentTuple() ;
+            return decoder.getCurrentTuple();
         }
-        
-        return ( Tuple ) tlvList.get( tlvList.size() - 1 ) ;
+
+        return (Tuple) tlvList.get( tlvList.size() - 1 );
     }
 
-    
+
     /**
      * BER decodes a byte buffer.
      * 
@@ -280,18 +289,18 @@
      */
     public Tuple decode( ByteBuffer bites ) throws DecoderException
     {
-        int lastSize = tlvList.size() ;
-        decoder.decode( bites ) ;
-        
+        int lastSize = tlvList.size();
+        decoder.decode( bites );
+
         if ( tlvList.isEmpty() || tlvList.size() == lastSize )
         {
-            return decoder.getCurrentTuple() ;
+            return decoder.getCurrentTuple();
         }
-        
-        return ( Tuple ) tlvList.get( tlvList.size() - 1 ) ;
+
+        return (Tuple) tlvList.get( tlvList.size() - 1 );
     }
 
-    
+
     /**
      * First BER encodes then BER decodes a Tuple.
      * 
@@ -301,21 +310,21 @@
      */
     public Tuple decode( Tuple tlv, ByteBuffer value ) throws DecoderException
     {
-        ArrayList list = new ArrayList() ;
-        list.add( value ) ;
-        ByteBuffer buf = tlv.toEncodedBuffer( list ) ;
-        int lastSize = tlvList.size() ;
-        decoder.decode( buf ) ;
-        
+        ArrayList list = new ArrayList();
+        list.add( value );
+        ByteBuffer buf = tlv.toEncodedBuffer( list );
+        int lastSize = tlvList.size();
+        decoder.decode( buf );
+
         if ( tlvList.isEmpty() || tlvList.size() == lastSize )
         {
-            return decoder.getCurrentTuple() ;
+            return decoder.getCurrentTuple();
         }
-        
-        return ( Tuple ) tlvList.get( tlvList.size() - 1 ) ;
+
+        return (Tuple) tlvList.get( tlvList.size() - 1 );
     }
 
-    
+
     /**
      * First BER encodes then BER decodes a train of Tuples.
      * 
@@ -323,106 +332,106 @@
      * @return a copy of the decoded tuple or the partially decoded current tlv
      * @throws DecoderException if there are errors while decoding
      */
-    public Tuple decode( Tuple[] tlvs, ByteBuffer[] values ) 
-        throws DecoderException
+    public Tuple decode( Tuple[] tlvs, ByteBuffer[] values )
+            throws DecoderException
     {
-        int lastSize = tlvList.size() ;
+        int lastSize = tlvList.size();
 
         for ( int ii = 0; ii < tlvs.length; ii++ )
         {
-            decode( tlvs[ii], values[ii] ) ;
+            decode( tlvs[ii], values[ii] );
         }
-        
+
         if ( tlvList.isEmpty() || tlvList.size() == lastSize )
         {
-            return decoder.getCurrentTuple() ;
+            return decoder.getCurrentTuple();
         }
-        
-        return ( Tuple ) tlvList.get( tlvList.size() - 1 ) ;
+
+        return (Tuple) tlvList.get( tlvList.size() - 1 );
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.commons.codec.stateful.DecoderCallback#decodeOccurred(
-     * org.apache.commons.codec.stateful.StatefulDecoder, java.lang.Object)
+     * org.apache.commons.codec.stateful.Decoder, java.lang.Object)
      */
-    public void decodeOccurred( StatefulDecoder decoder, Object decoded )
+    public void decodeOccurred( Decoder decoder, Tuple decoded )
     {
-        tlvList.add( decoded ) ;
-        assertEquals( expectedState, this.decoder.getState() ) ;
-        buffer.flip() ;
+        tlvList.add( decoded );
+        assertEquals( expectedState, this.decoder.getState() );
+        buffer.flip();
     }
-    
-    
+
+
     /* (non-Javadoc)
      * @see org.apache.commons.codec.stateful.DecoderMonitor#callbackOccured(
-     * org.apache.commons.codec.stateful.StatefulDecoder, 
+     * org.apache.commons.codec.stateful.Decoder,
      * org.apache.commons.codec.stateful.DecoderCallback, java.lang.Object)
      */
-    public void callbackOccured( StatefulDecoder decoder, DecoderCallback cb,
-								 Object decoded )
+    public void callbackOccured( Decoder decoder, DecoderCallback cb,
+                                 Object decoded )
     {
-        assertEquals( this, cb ) ;
-        assertEquals( this.decoder, decoder ) ;
-        Tuple t = ( Tuple ) decoded ;
-        assertNotNull( t ) ;
+        assertEquals( this, cb );
+        assertEquals( this.decoder, decoder );
+        Tuple t = (Tuple) decoded;
+        assertNotNull( t );
         if ( t.isPrimitive )
-        {    
-            assertTrue( this.decoder.getCurrentTuple().equals( decoded ) ) ;
+        {
+            assertTrue( this.decoder.getCurrentTuple().equals( decoded ) );
         }
     }
 
-    
+
     /* (non-Javadoc)
      * @see org.apache.commons.codec.stateful.DecoderMonitor#callbackSet(
-     * org.apache.commons.codec.stateful.StatefulDecoder, 
+     * org.apache.commons.codec.stateful.Decoder,
      * org.apache.commons.codec.stateful.DecoderCallback, 
      * org.apache.commons.codec.stateful.DecoderCallback)
      */
-    public void callbackSet( StatefulDecoder decoder, DecoderCallback oldcb,
-							 DecoderCallback newcb )
+    public void callbackSet( Decoder decoder, DecoderCallback oldcb,
+                             DecoderCallback newcb )
     {
-        assertEquals( this, newcb ) ;
+        assertEquals( this, newcb );
     }
 
 
     /* (non-Javadoc)
      * @see org.apache.commons.codec.stateful.DecoderMonitor#error(
-     * org.apache.commons.codec.stateful.StatefulDecoder, java.lang.Exception)
+     * org.apache.commons.codec.stateful.Decoder, java.lang.Exception)
      */
-    public void error( StatefulDecoder decoder, Exception exception )
+    public void error( Decoder decoder, Exception exception )
     {
-        fail( ExceptionUtils.getFullStackTrace( exception ) ) ;
+        fail( ExceptionUtils.getFullStackTrace( exception ) );
     }
 
-    
+
     /* (non-Javadoc)
      * @see org.apache.commons.codec.stateful.DecoderMonitor#fatalError(
-     * org.apache.commons.codec.stateful.StatefulDecoder, java.lang.Exception)
+     * org.apache.commons.codec.stateful.Decoder, java.lang.Exception)
      */
-    public void fatalError( StatefulDecoder decoder, Exception exception )
+    public void fatalError( Decoder decoder, Exception exception )
     {
-        fail( ExceptionUtils.getFullStackTrace( exception ) ) ;
+        fail( ExceptionUtils.getFullStackTrace( exception ) );
     }
 
-    
+
     /* (non-Javadoc)
      * @see org.apache.commons.codec.stateful.DecoderMonitor#monitorSet(
-     * org.apache.commons.codec.stateful.StatefulDecoder, 
+     * org.apache.commons.codec.stateful.Decoder,
      * org.apache.commons.codec.stateful.DecoderMonitor)
      */
-    public void monitorSet( StatefulDecoder decoder, DecoderMonitor oldmon )
+    public void monitorSet( Decoder decoder, DecoderMonitor oldmon )
     {
-        assertEquals( this, oldmon ) ;
+        assertEquals( this, oldmon );
     }
 
-    
+
     /* (non-Javadoc)
      * @see org.apache.commons.codec.stateful.DecoderMonitor#warning(
-     * org.apache.commons.codec.stateful.StatefulDecoder, java.lang.Exception)
+     * org.apache.commons.codec.stateful.Decoder, java.lang.Exception)
      */
-    public void warning( StatefulDecoder decoder, Exception exception )
+    public void warning( Decoder decoder, Exception exception )
     {
-        assertNotNull( exception ) ;
+        assertNotNull( exception );
     }
 
     /**

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/AbstractDecoderTestCaseTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/AbstractDecoderTestCaseTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/AbstractDecoderTestCaseTest.java	Sat Jul 10 11:54:20 2004
@@ -14,41 +14,41 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
 import java.nio.ByteBuffer;
 
-import org.apache.commons.lang.ArrayUtils ;
+import org.apache.commons.lang.ArrayUtils;
 
 
 /**
  * Tests the base test class functions.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class AbstractDecoderTestCaseTest extends AbstractDecoderTestCase
 {
-    
+
     public AbstractDecoderTestCaseTest()
     {
-        super ( AbstractDecoderTestCaseTest.class.getName() ) ; 
+        super( AbstractDecoderTestCaseTest.class.getName() );
     }
 
     public void testFragment()
     {
-        byte[] all = new byte[3] ;
-        assertEquals( 1, fragment(all, 3).length) ;
+        byte[] all = new byte[3];
+        assertEquals( 1, fragment( all, 3 ).length );
         try
         {
-            fragment(ArrayUtils.EMPTY_BYTE_ARRAY, 0) ;
-            fail( "should have thrown exception before reaching this line" ) ;
+            fragment( ArrayUtils.EMPTY_BYTE_ARRAY, 0 );
+            fail( "should have thrown exception before reaching this line" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 
@@ -57,12 +57,12 @@
      */
     public void testDecodebyte() throws Exception
     {
-        decode( ( byte ) 1 ) ;
-        decode( ( byte ) 1 ) ;
+        decode( (byte) 1 );
+        decode( (byte) 1 );
         setExpectedState( decoder.VALUE_STATE );
-        Tuple t = decode( ( byte ) 1 ) ;
-        assertEquals( 1, t.id ) ;
-        assertEquals( 1, t.length ) ;
+        Tuple t = decode( (byte) 1 );
+        assertEquals( 1, t.id );
+        assertEquals( 1, t.length );
     }
 
     /*
@@ -70,49 +70,49 @@
      */
     public void testDecodeTupleArray() throws Exception
     {
-        Tuple [] tuples = new Tuple[2] ;
-        tuples[0] = new Tuple( 1, 0 ) ;
-        tuples[1] = new Tuple( 1, 0 ) ;
-        
-        ByteBuffer[] buffers = new ByteBuffer[2] ; 
-        buffers[0] = ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY ) ;
-        buffers[1] = ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        Tuple[] tuples = new Tuple[2];
+        tuples[0] = new Tuple( 1, 0 );
+        tuples[1] = new Tuple( 1, 0 );
+
+        ByteBuffer[] buffers = new ByteBuffer[2];
+        buffers[0] = ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY );
+        buffers[1] = ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY );
         setExpectedState( decoder.LENGTH_STATE );
-        decode( tuples, buffers ) ;
+        decode( tuples, buffers );
         setExpectedState( decoder.LENGTH_STATE );
-        decode( tuples[0], ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY ) ) ;
+        decode( tuples[0], ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY ) );
     }
 
     public void testCallbackOccured() throws Exception
     {
-        decoder.setDecoderMonitor( this ) ;
-        Tuple [] tuples = new Tuple[2] ;
-        tuples[0] = new Tuple(1, 0) ;
-        tuples[1] = new Tuple(1, 0) ;
-        ByteBuffer[] buffers = new ByteBuffer[2] ; 
-        buffers[0] = ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY ) ;
-        buffers[1] = ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY ) ;
+        decoder.setDecoderMonitor( this );
+        Tuple[] tuples = new Tuple[2];
+        tuples[0] = new Tuple( 1, 0 );
+        tuples[1] = new Tuple( 1, 0 );
+        ByteBuffer[] buffers = new ByteBuffer[2];
+        buffers[0] = ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY );
+        buffers[1] = ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY );
         setExpectedState( decoder.LENGTH_STATE );
-        decode(tuples, buffers) ;
-        callbackOccured(decoder, this, tuples[1]) ;
+        decode( tuples, buffers );
+        callbackOccured( decoder, this, tuples[1] );
     }
 
     public void testCallbackSet()
     {
-        decoder.setCallback(this) ;
-        callbackSet(decoder, this, this) ;
+        decoder.setCallback( this );
+        callbackSet( decoder, this, this );
     }
 
     public void testError()
     {
         try
         {
-            error( decoder, new Exception() ) ;
-            fail("should not get here") ;
+            error( decoder, new Exception() );
+            fail( "should not get here" );
         }
         catch ( Throwable e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 
@@ -120,30 +120,30 @@
     {
         try
         {
-            fatalError( decoder, new Exception() ) ;
-            fail("should not get here") ;
+            fatalError( decoder, new Exception() );
+            fail( "should not get here" );
         }
         catch ( Throwable e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 
     public void testMonitorSet()
     {
-        monitorSet( decoder, this ) ;
+        monitorSet( decoder, this );
     }
 
     public void testWarning()
     {
         try
         {
-            warning( decoder, new Exception() ) ;
-            fail("should not get here") ;
+            warning( decoder, new Exception() );
+            fail( "should not get here" );
         }
         catch ( Throwable e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERDecoderCallbackAdapterTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERDecoderCallbackAdapterTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERDecoderCallbackAdapterTest.java	Sat Jul 10 11:54:20 2004
@@ -14,27 +14,27 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
-import junit.framework.TestCase ;
+import junit.framework.TestCase;
 
 
 /**
  * Tests for the adapter to pass clover coverage.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class BERDecoderCallbackAdapterTest extends TestCase
 {
-    BERDecoderCallbackAdapter adapter = null ;
-    
+    BERDecoderCallbackAdapter adapter = null;
 
-    public static void main(String[] args)
+
+    public static void main( String[] args )
     {
-        junit.textui.TestRunner.run(BERDecoderCallbackAdapterTest.class);
+        junit.textui.TestRunner.run( BERDecoderCallbackAdapterTest.class );
     }
 
     /*
@@ -43,7 +43,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        adapter = new BERDecoderCallbackAdapter() ;
+        adapter = new BERDecoderCallbackAdapter();
     }
 
     /*
@@ -52,16 +52,17 @@
     protected void tearDown() throws Exception
     {
         super.tearDown();
-        adapter = null ;
+        adapter = null;
     }
 
     /**
      * Constructor for BERDecoderCallbackAdapter.
+     *
      * @param arg0
      */
-    public BERDecoderCallbackAdapterTest(String arg0)
+    public BERDecoderCallbackAdapterTest( String arg0 )
     {
-        super(arg0);
+        super( arg0 );
     }
 
     public void testStartDecoded()
@@ -76,12 +77,12 @@
 
     public void testEndDecoded()
     {
-        adapter.end() ;
+        adapter.end();
     }
 
     public void testDecodeOccurred()
     {
-        adapter.decodeOccurred( null, null ) ;
+        adapter.decodeOccurred( null, null );
     }
 
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERDecoderTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERDecoderTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERDecoderTest.java	Sat Jul 10 11:54:20 2004
@@ -14,18 +14,17 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
-import java.nio.ByteBuffer ;
-import java.util.ArrayList ;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
 
-import org.apache.commons.lang.ArrayUtils ;
-import org.apache.commons.lang.RandomStringUtils ;
-
-import org.apache.commons.codec.stateful.DecoderCallback ;
-import org.apache.commons.codec.stateful.StatefulDecoder ;
-import org.apache.commons.codec.stateful.DecoderMonitorAdapter ;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.snickers.encoding.Decoder;
+import org.apache.snickers.encoding.DecoderCallback;
+import org.apache.snickers.encoding.DecoderMonitorAdapter;
 
 
 /**
@@ -33,262 +32,276 @@
  * round trip encode - decode functionality.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class BERDecoderTest extends AbstractDecoderTestCase
 {
-    private static final ByteBuffer EMPTY_BUFFER = 
-        ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY ) ;
-    
-    
+    private static final ByteBuffer EMPTY_BUFFER =
+            ByteBuffer.wrap( ArrayUtils.EMPTY_BYTE_ARRAY );
+
+
     public BERDecoderTest()
     {
-        super( BERDecoderTest.class.getName() ) ;
+        super( BERDecoderTest.class.getName() );
     }
-    
-    
+
+
     public void testBasisCases() throws Exception
     {
-        decoder.setDecoderMonitor( new DecoderMonitorAdapter() ) ;
+        decoder.setDecoderMonitor( new DecoderMonitorAdapter() );
 
         try
         {
-            decoder.decode( null ) ;
-            fail("IllegalArgumentException should have been thrown");
+            decoder.decode( null );
+            fail( "IllegalArgumentException should have been thrown" );
         }
-        catch (IllegalArgumentException iae)
+        catch ( IllegalArgumentException iae )
         {
         }
 
-        decoder.decode( EMPTY_BUFFER ) ;
+        decoder.decode( EMPTY_BUFFER );
     }
-    
-    
+
+
     public void testPrimitives() throws Exception
     {
-        Tuple decoded = null ;
-        Tuple t = new Tuple( 45, 0, true, TypeClass.APPLICATION ) ;
+        Tuple decoded = null;
+        Tuple t = new Tuple( 45, 0, true, TypeClass.APPLICATION );
 
         setExpectedState( decoder.LENGTH_STATE );
-        assertTrue( decode( t, EMPTY_BUFFER ).equals( t ) ) ;
-        
-        t = new Tuple( 45, "Hello world!".length(), true, TypeClass.APPLICATION ) ;
+        assertTrue( decode( t, EMPTY_BUFFER ).equals( t ) );
+
+        t = new Tuple( 45, "Hello world!".length(), true, TypeClass.APPLICATION );
         setExpectedState( decoder.VALUE_STATE );
-        decoded = decode( t, ByteBuffer.wrap( "Hello world!".getBytes() ) ) ;
-        assertTrue( decoded.equals( t ) ) ;
-        assertEquals( "Hello world!", toString( buffer ) ) ;
+        decoded = decode( t, ByteBuffer.wrap( "Hello world!".getBytes() ) );
+        assertTrue( decoded.equals( t ) );
+        assertEquals( "Hello world!", toString( buffer ) );
 
-        String mesg = RandomStringUtils.randomAlphanumeric(1000) ;
-        t = new Tuple( 1234233, mesg.length(), true, TypeClass.APPLICATION ) ;
+        String mesg = RandomStringUtils.randomAlphanumeric( 1000 );
+        t = new Tuple( 1234233, mesg.length(), true, TypeClass.APPLICATION );
 
         setExpectedState( decoder.VALUE_STATE );
-        decoded = decode( t, ByteBuffer.wrap( mesg.getBytes() ) ) ;
-        assertTrue( decoded.equals( t ) ) ;
-        assertEquals( mesg, toString( buffer ) ) ;
-    }
-    
-    
-    String toString(ByteBuffer buf)
-    {
-        buf = buf.slice() ;
-        byte[] bites = new byte[buf.remaining()] ;
-        buf.get( bites ) ;
-        return new String( bites ) ; 
+        decoded = decode( t, ByteBuffer.wrap( mesg.getBytes() ) );
+        assertTrue( decoded.equals( t ) );
+        assertEquals( mesg, toString( buffer ) );
     }
-    
-    
+
+
+    String toString( ByteBuffer buf )
+    {
+        buf = buf.slice();
+        byte[] bites = new byte[buf.remaining()];
+        buf.get( bites );
+        return new String( bites );
+    }
+
+
     public void testConstructedIndefinate() throws Exception
     {
-        Tuple top = new Tuple( 1, TypeClass.APPLICATION ) ;
+        Tuple top = new Tuple( 1, TypeClass.APPLICATION );
         Tuple t0 = new Tuple( 2, "Hello".length(),
-                true, TypeClass.APPLICATION ) ;
+                true, TypeClass.APPLICATION );
         Tuple t1 = new Tuple( 3, "World".length(),
-                true, TypeClass.APPLICATION ) ;
-        Tuple terminator = new Tuple( 0, 0, true, TypeClass.UNIVERSAL ) ;
+                true, TypeClass.APPLICATION );
+        Tuple terminator = new Tuple( 0, 0, true, TypeClass.UNIVERSAL );
 
         setExpectedState( decoder.VALUE_STATE );
-        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
+        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) );
+
+        Tuple decoded = decode( t0, ByteBuffer.wrap( "Hello".getBytes() ) );
+        assertTrue( decoded.equals( t0 ) );
+        assertEquals( "Hello", toString( buffer ) );
+
+        decoded = decode( t1, ByteBuffer.wrap( "World".getBytes() ) );
+        assertTrue( decoded.equals( t1 ) );
+        assertEquals( "World", toString( buffer ) );
 
-        Tuple decoded = decode( t0, ByteBuffer.wrap( "Hello".getBytes() ) ) ; 
-        assertTrue( decoded.equals( t0 ) ) ;
-        assertEquals( "Hello", toString( buffer ) ) ;
-        
-        decoded = decode( t1, ByteBuffer.wrap( "World".getBytes() ) ) ; 
-        assertTrue( decoded.equals( t1 ) ) ;
-        assertEquals( "World", toString( buffer ) ) ;
-        
         setExpectedState( decoder.LENGTH_STATE );
-        decoded = decode( terminator, EMPTY_BUFFER ) ;
-        assertTrue( decoded.equals( top ) ) ;
+        decoded = decode( terminator, EMPTY_BUFFER );
+        assertTrue( decoded.equals( top ) );
     }
-    
-    
+
+
     public void testConstructedLongLengthForm() throws Exception
     {
-        String str0 = RandomStringUtils.randomAlphanumeric(128) ;
-        Tuple t0 = new Tuple( 2, 128, true, TypeClass.APPLICATION ) ;
-        String str1 = RandomStringUtils.randomAlphanumeric(128) ;
-        Tuple t1 = new Tuple( 3, 128, true, TypeClass.APPLICATION ) ;
-        Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
-        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
+        String str0 = RandomStringUtils.randomAlphanumeric( 128 );
+        Tuple t0 = new Tuple( 2, 128, true, TypeClass.APPLICATION );
+        String str1 = RandomStringUtils.randomAlphanumeric( 128 );
+        Tuple t1 = new Tuple( 3, 128, true, TypeClass.APPLICATION );
+        Tuple top = new Tuple( 1, t0.size() + t1.size() );
+        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) );
 
         setExpectedState( decoder.VALUE_STATE );
-        Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
-        assertTrue( decoded.equals( t0 ) ) ;
-        assertEquals( str0, toString( buffer ) ) ;
+        Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) );
+        assertTrue( decoded.equals( t0 ) );
+        assertEquals( str0, toString( buffer ) );
         
         // automatically set to top because after t1 is delivered top is 
-        decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ; 
-        assertTrue( decoded.equals( top ) ) ;
+        decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) );
+        assertTrue( decoded.equals( top ) );
     }
 
 
     public void testConstructedShortLengthForm() throws Exception
     {
-        Tuple t0 = new Tuple( 2, "Hello".length(), true, 
-                TypeClass.APPLICATION ) ;
-        Tuple t1 = new Tuple( 3, "World".length(), true, 
-                TypeClass.APPLICATION ) ;
-        Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
-        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
+        Tuple t0 = new Tuple( 2, "Hello".length(), true,
+                TypeClass.APPLICATION );
+        Tuple t1 = new Tuple( 3, "World".length(), true,
+                TypeClass.APPLICATION );
+        Tuple top = new Tuple( 1, t0.size() + t1.size() );
+        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) );
 
         setExpectedState( decoder.VALUE_STATE );
-        Tuple decoded = decode( t0, ByteBuffer.wrap( "Hello".getBytes() ) ) ;
-        assertTrue( decoded.equals( t0 ) ) ;
-        assertEquals( "Hello", toString( buffer ) ) ;
+        Tuple decoded = decode( t0, ByteBuffer.wrap( "Hello".getBytes() ) );
+        assertTrue( decoded.equals( t0 ) );
+        assertEquals( "Hello", toString( buffer ) );
         
         // automatically set to top because after t1 is delivered top is 
-        decoded = decode( t1, ByteBuffer.wrap( "World".getBytes() ) ) ; 
-        assertTrue( decoded.equals( top ) ) ;
+        decoded = decode( t1, ByteBuffer.wrap( "World".getBytes() ) );
+        assertTrue( decoded.equals( top ) );
     }
-    
-    
+
+
     public void testFragmentedValue() throws Exception
     {
-        String str0 = RandomStringUtils.randomAlphanumeric(20) ;
-        Tuple t0 = new Tuple( 2, str0.length(), true, TypeClass.APPLICATION ) ;
-        String str1 = RandomStringUtils.randomAlphanumeric(20) ;
-        Tuple t1 = new Tuple( 3, str1.length(), true, TypeClass.APPLICATION ) ;
-        Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
-        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
-
-        ArrayList list = new ArrayList() ;
-        list.add( ByteBuffer.wrap( str0.getBytes() ) ) ;
-        ByteBuffer all = t0.toEncodedBuffer( list ) ;
-        ByteBuffer[] fragments = fragment( all, 10 ) ;
-        Tuple decoded = null ;
-        
+        String str0 = RandomStringUtils.randomAlphanumeric( 20 );
+        Tuple t0 = new Tuple( 2, str0.length(), true, TypeClass.APPLICATION );
+        String str1 = RandomStringUtils.randomAlphanumeric( 20 );
+        Tuple t1 = new Tuple( 3, str1.length(), true, TypeClass.APPLICATION );
+        Tuple top = new Tuple( 1, t0.size() + t1.size() );
+        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) );
+
+        ArrayList list = new ArrayList();
+        list.add( ByteBuffer.wrap( str0.getBytes() ) );
+        ByteBuffer all = t0.toEncodedBuffer( list );
+        ByteBuffer[] fragments = fragment( all, 10 );
+        Tuple decoded = null;
+
         setExpectedState( decoder.VALUE_STATE );
         for ( int ii = 0; ii < fragments.length; ii++ )
         {
-            decoded = decode( fragments[ii] ) ;
+            decoded = decode( fragments[ii] );
         }
-        
-        assertTrue( decoded.equals( t0 ) ) ;
-        assertEquals( str0, toString( buffer ) ) ;
+
+        assertTrue( decoded.equals( t0 ) );
+        assertEquals( str0, toString( buffer ) );
         
         // automatically set to top because after t1 is delivered top is 
-        decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ; 
-        assertTrue( decoded.equals( top ) ) ;
+        decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) );
+        assertTrue( decoded.equals( top ) );
     }
-    
-    
+
+
     public void testFireTagDecoded() throws Exception
     {
-        decoder.setDecoderMonitor( new BERMonitor() ) ;
-        String str0 = RandomStringUtils.randomAlphanumeric(20) ;
-        Tuple t0 = new Tuple( 2, str0.length() ) ;
-        String str1 = RandomStringUtils.randomAlphanumeric(20) ;
-        Tuple t1 = new Tuple( 3, str1.length() ) ;
-        Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
-        Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ; 
-        assertTrue( decoded.equals( t0 ) ) ;
+        decoder.setDecoderMonitor( new BERMonitor() );
+        String str0 = RandomStringUtils.randomAlphanumeric( 20 );
+        Tuple t0 = new Tuple( 2, str0.length() );
+        String str1 = RandomStringUtils.randomAlphanumeric( 20 );
+        Tuple t1 = new Tuple( 3, str1.length() );
+        Tuple top = new Tuple( 1, t0.size() + t1.size() );
+        Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) );
+        assertTrue( decoded.equals( t0 ) );
         
         // automatically set to top because after t1 is delivered top is 
-        decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ; 
-        
-        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
-        
-        decoder.setDecoderMonitor(null) ;
-        decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ; 
-        assertTrue( decoded.equals( t0 ) ) ;
-
-        tlvList.clear() ;
-        decoder.setDecoderMonitor(null) ;
-        decoder.setCallback(null) ;
-        decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
-        assertTrue(tlvList.isEmpty()) ;
+        decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) );
+
+        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) );
+
+        decoder.setDecoderMonitor( null );
+        decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) );
+        assertTrue( decoded.equals( t0 ) );
+
+        tlvList.clear();
+        decoder.setDecoderMonitor( null );
+        decoder.setCallback( null );
+        decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) );
+        assertTrue( tlvList.isEmpty() );
     }
 
 
     public void testFireTagDecoded2() throws Exception
     {
-        decoder.setDecoderMonitor( null ) ;
-        String str0 = RandomStringUtils.randomAlphanumeric(20) ;
-        Tuple t0 = new Tuple( 2, str0.length() ) ;
-        String str1 = RandomStringUtils.randomAlphanumeric(20) ;
-        Tuple t1 = new Tuple( 3, str1.length() ) ;
-        Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
-        Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ; 
-        assertTrue( decoded.equals( t0 ) ) ;
+        decoder.setDecoderMonitor( null );
+        String str0 = RandomStringUtils.randomAlphanumeric( 20 );
+        Tuple t0 = new Tuple( 2, str0.length() );
+        String str1 = RandomStringUtils.randomAlphanumeric( 20 );
+        Tuple t1 = new Tuple( 3, str1.length() );
+        Tuple top = new Tuple( 1, t0.size() + t1.size() );
+        Tuple decoded = decode( t0, ByteBuffer.wrap( str0.getBytes() ) );
+        assertTrue( decoded.equals( t0 ) );
         
         // automatically set to top because after t1 is delivered top is 
-        decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ; 
-        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
+        decoded = decode( t1, ByteBuffer.wrap( str1.getBytes() ) );
+        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) );
     }
 
 
     public void testFireTagDecoded3() throws Exception
     {
-        decoder.setDecoderMonitor( new BERMonitor() ) ;
-        decoder.setCallback( null ) ;
-        String str0 = RandomStringUtils.randomAlphanumeric(20) ;
-        Tuple t0 = new Tuple( 2, str0.length() ) ;
-        String str1 = RandomStringUtils.randomAlphanumeric(20) ;
-        Tuple t1 = new Tuple( 3, str1.length() ) ;
-        Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
-        decode( t0, ByteBuffer.wrap( str0.getBytes() ) ) ;
+        decoder.setDecoderMonitor( new BERMonitor() );
+        decoder.setCallback( null );
+        String str0 = RandomStringUtils.randomAlphanumeric( 20 );
+        Tuple t0 = new Tuple( 2, str0.length() );
+        String str1 = RandomStringUtils.randomAlphanumeric( 20 );
+        Tuple t1 = new Tuple( 3, str1.length() );
+        Tuple top = new Tuple( 1, t0.size() + t1.size() );
+        decode( t0, ByteBuffer.wrap( str0.getBytes() ) );
         
         // automatically set to top because after t1 is delivered top is 
-        decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ; 
-        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
+        decode( t1, ByteBuffer.wrap( str1.getBytes() ) );
+        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) );
     }
 
 
     public void testFireTagDecoded4() throws Exception
     {
-        decoder.setDecoderMonitor( null ) ;
-        decoder.setCallback( null ) ;
-        String str0 = RandomStringUtils.randomAlphanumeric(20) ;
-        Tuple t0 = new Tuple( 2, str0.length() ) ;
-        String str1 = RandomStringUtils.randomAlphanumeric(20) ;
-        Tuple t1 = new Tuple( 3, str1.length() ) ;
-        Tuple top = new Tuple( 1, t0.size() + t1.size() ) ;
+        decoder.setDecoderMonitor( null );
+        decoder.setCallback( null );
+        String str0 = RandomStringUtils.randomAlphanumeric( 20 );
+        Tuple t0 = new Tuple( 2, str0.length() );
+        String str1 = RandomStringUtils.randomAlphanumeric( 20 );
+        Tuple t1 = new Tuple( 3, str1.length() );
+        Tuple top = new Tuple( 1, t0.size() + t1.size() );
         decode( t0, ByteBuffer.wrap( str0.getBytes() ) );
         
         // automatically set to top because after t1 is delivered top is 
-        decode( t1, ByteBuffer.wrap( str1.getBytes() ) ) ;
-        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) ) ;
+        decode( t1, ByteBuffer.wrap( str1.getBytes() ) );
+        assertTrue( decode( top, EMPTY_BUFFER ).equals( top ) );
     }
 
 
     class BERMonitor implements BERDecoderMonitor
     {
-        public void callbackOccured(StatefulDecoder decoder,
-                DecoderCallback cb, Object decoded) { }
-        
-        public void error(StatefulDecoder decoder, Exception exception) { }
-        
-        public void callbackSet(StatefulDecoder decoder, DecoderCallback oldcb,
-                DecoderCallback newcb) { }
-        
-        public void fatalError(StatefulDecoder decoder, Exception exception){}
-        
-        public void lengthDecoded( Tuple tlv ) { }
-        
-        public void tagDecoded( Tuple tlv ) { }
-        
-        public void warning( StatefulDecoder decoder, Exception exception ) { }
+        public void callbackOccured( Decoder decoder,
+                                     DecoderCallback cb, Object decoded )
+        {
+        }
+
+        public void error( Decoder decoder, Exception exception )
+        {
+        }
+
+        public void callbackSet( Decoder decoder, DecoderCallback oldcb,
+                                 DecoderCallback newcb )
+        {
+        }
+
+        public void fatalError( Decoder decoder, Exception exception )
+        {
+        }
+
+        public void lengthDecoded( Tuple tlv )
+        {
+        }
+
+        public void tagDecoded( Tuple tlv )
+        {
+        }
+
+        public void warning( Decoder decoder, Exception exception )
+        {
+        }
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERTestDecoder.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERTestDecoder.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/BERTestDecoder.java	Sat Jul 10 11:54:20 2004
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.snickers.ber;
+package org.apache.snickers.encoding.ber;
 
 /**
  * @version $Revision: $ $Date: $

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/ConstructedTLVTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/ConstructedTLVTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/ConstructedTLVTest.java	Sat Jul 10 11:54:20 2004
@@ -14,14 +14,14 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
 /**
  * Performs constructed tlv tests.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class ConstructedTLVTest extends AbstractDecoderTestCase
@@ -32,42 +32,42 @@
      */
     public ConstructedTLVTest( String arg0 )
     {
-        super( arg0 ) ;
+        super( arg0 );
     }
 
 
     public void testConstructedDefinateTLV() throws Exception
     {
         // decode tag
-        Tuple outter = decode( "01100001" ) ;
-        assertEquals( 1, outter.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( false, outter.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, outter.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple outter = decode( "01100001" );
+        assertEquals( 1, outter.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( false, outter.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, outter.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        outter = decode( "00000011" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
+        outter = decode( "00000011" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
 
         // decode tag
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        tlv = decode( "00000001" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlv.length ) ;
+        tlv = decode( "00000001" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 1, tlv.length );
 
         // decode value
         setExpectedState( decoder.VALUE_STATE );
-        tlv = decode( "01010101" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
-        assertEquals( 2, tlvList.size() ) ;
+        tlv = decode( "01010101" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
+        assertEquals( 2, tlvList.size() );
     }
 
 
@@ -76,94 +76,94 @@
         // --------------------------------------------------------------------
 
         // decode tag
-        Tuple outter = decode( "01100001" ) ;
-        assertEquals( 1, outter.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( false, outter.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, outter.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple outter = decode( "01100001" );
+        assertEquals( 1, outter.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( false, outter.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, outter.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        outter = decode( "10000000" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
+        outter = decode( "10000000" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
 
 
         // --------------------------------------------------------------------
 
 
         // decode tag
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        tlv = decode( "00000001" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlv.length ) ;
-        assertEquals( 0, tlvList.size() ) ;
+        tlv = decode( "00000001" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 1, tlv.length );
+        assertEquals( 0, tlvList.size() );
 
         // decode value
         setExpectedState( decoder.VALUE_STATE );
-        tlv = decode( "01010101" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlvList.size() ) ;
-        assertEquals( 0x0055, 0x00ff & buffer.get( 0 ) ) ;
+        tlv = decode( "01010101" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
+        assertEquals( 1, tlvList.size() );
+        assertEquals( 0x0055, 0x00ff & buffer.get( 0 ) );
 
 
         // --------------------------------------------------------------------
 
 
         // decode tag
-        tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 1, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 1, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        tlv = decode( "00000001" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlv.length ) ;
+        tlv = decode( "00000001" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 1, tlv.length );
 
         // decode value
-        tlv = decode( "01010101" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
-        assertEquals( 2, tlvList.size() ) ;
-        assertEquals( 0x0055, 0x00ff & buffer.get( 0 ) ) ;
+        tlv = decode( "01010101" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
+        assertEquals( 2, tlvList.size() );
+        assertEquals( 0x0055, 0x00ff & buffer.get( 0 ) );
 
 
         // --------------------------------------------------------------------
 
 
         // decode tag
-        tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 2, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 2, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        tlv = decode( "00000001" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlv.length ) ;
+        tlv = decode( "00000001" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 1, tlv.length );
 
         // decode value
-        tlv = decode( "01010101" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
-        assertEquals( 3, tlvList.size() ) ;
-        assertEquals( 0x0055, 0x00ff & buffer.get( 0 ) ) ;
+        tlv = decode( "01010101" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
+        assertEquals( 3, tlvList.size() );
+        assertEquals( 0x0055, 0x00ff & buffer.get( 0 ) );
 
-        decode( "00000000" ) ;
+        decode( "00000000" );
         setExpectedState( decoder.LENGTH_STATE );
-        decode( "00000000" ) ;
+        decode( "00000000" );
 
-        assertEquals( 4, tlvList.size() ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
+        assertEquals( 4, tlvList.size() );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
     }
 
 
@@ -171,30 +171,30 @@
     {
         try
         {
-            decode( "00000000" ) ;
-            decode( "00000000" ) ;
-            fail( "should throw an exception before getting here" ) ;
+            decode( "00000000" );
+            decode( "00000000" );
+            fail( "should throw an exception before getting here" );
         }
-        catch( Throwable e )
+        catch ( Throwable e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 
 
     public void testIllegalStateNoMonitor() throws Exception
     {
-        decoder.setDecoderMonitor( null ) ;
+        decoder.setDecoderMonitor( null );
 
         try
         {
-            decode( "00000000" ) ;
-            decode( "00000000" ) ;
-            fail( "should throw an exception before getting here" ) ;
+            decode( "00000000" );
+            decode( "00000000" );
+            fail( "should throw an exception before getting here" );
         }
-        catch( Throwable e )
+        catch ( Throwable e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/LengthTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/LengthTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/LengthTest.java	Sat Jul 10 11:54:20 2004
@@ -14,19 +14,19 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
-import junit.framework.TestCase ;
+import java.nio.ByteBuffer;
 
-import java.nio.ByteBuffer ;
+import junit.framework.TestCase;
 
 
 /**
  * Tests the Length class.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class LengthTest extends TestCase
@@ -53,31 +53,31 @@
      */
     public void testGetLength() throws Exception
     {
-        ByteBuffer list = ByteBuffer.allocate( 8 ) ;
-        list.put( (byte) 0x1 ) ;
-        list.put( (byte) 0x1 ) ;
-        list.put( (byte) 0x1 ) ;
-        list.put( (byte) 0x1 ) ;
-        list.put( (byte) 0x1 ) ;
-        list.put( (byte) 0x1 ) ;
-        list.put( (byte) 0x1 ) ;
-        list.put( (byte) 0x1 ) ;
-        
+        ByteBuffer list = ByteBuffer.allocate( 8 );
+        list.put( (byte) 0x1 );
+        list.put( (byte) 0x1 );
+        list.put( (byte) 0x1 );
+        list.put( (byte) 0x1 );
+        list.put( (byte) 0x1 );
+        list.put( (byte) 0x1 );
+        list.put( (byte) 0x1 );
+        list.put( (byte) 0x1 );
+
         try
         {
-            Length.getLength( list ) ;
-            fail( "should fail before we get here" ) ;
+            Length.getLength( list );
+            fail( "should fail before we get here" );
         }
         catch ( Throwable t )
         {
-            assertNotNull( t ) ;
+            assertNotNull( t );
         }
-        
-        
-        list.clear() ;
-        list.put(( byte ) 0x7 ) ;
-        list.flip() ;
-        assertEquals( 7, Length.getLength( list ) ) ;
+
+
+        list.clear();
+        list.put( (byte) 0x7 );
+        list.flip();
+        assertEquals( 7, Length.getLength( list ) );
     }
 
     public void testSize()
@@ -91,22 +91,22 @@
     {
     }
 
-    
+
     public void testGetOctets2() throws Exception
     {
-        byte[] bites = { (byte) 0x00, (byte) 0xff } ;
-        
-        Length length = new Length() ;
-        length.add( bites[0] ) ;
-        
+        byte[] bites = {(byte) 0x00, (byte) 0xff};
+
+        Length length = new Length();
+        length.add( bites[0] );
+
         try
         {
-            length.add( bites[1] ) ;
-            fail( "should never get here due to illegal state" ) ;
+            length.add( bites[1] );
+            fail( "should never get here due to illegal state" );
         }
-        catch ( Throwable t ) 
+        catch ( Throwable t )
         {
-            assertNotNull( t ) ;
+            assertNotNull( t );
         }
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/MultiByteLengthTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/MultiByteLengthTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/MultiByteLengthTest.java	Sat Jul 10 11:54:20 2004
@@ -14,14 +14,14 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
 /**
  * Tests single byte length encodings in a BER TLV.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class MultiByteLengthTest extends AbstractDecoderTestCase
@@ -33,114 +33,114 @@
      */
     public MultiByteLengthTest( String name )
     {
-        super( name ) ;
+        super( name );
     }
 
 
     public void testLength128() throws Exception
     {
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "10000001" ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "10000000" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 128, tlv.length ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "10000001" );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "10000000" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 128, tlv.length );
     }
 
 
     public void testLength129() throws Exception
     {
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "10000001" ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "10000001" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 129, tlv.length ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "10000001" );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "10000001" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 129, tlv.length );
     }
 
 
     public void testLength255() throws Exception
     {
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "10000001" ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "11111111" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 255, tlv.length ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "10000001" );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "11111111" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 255, tlv.length );
     }
 
 
     public void testLength32768() throws Exception
     {
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "10000010" ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "00000000" ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "10000000" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 32768, tlv.length ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "10000010" );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "00000000" );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "10000000" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 32768, tlv.length );
     }
 
 
     public void testLength65535() throws Exception
     {
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "10000010" ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "11111111" ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "11111111" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 65535, tlv.length ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "10000010" );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "11111111" );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "11111111" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 65535, tlv.length );
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/MultiByteTagTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/MultiByteTagTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/MultiByteTagTest.java	Sat Jul 10 11:54:20 2004
@@ -14,7 +14,7 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
 /**
@@ -22,21 +22,31 @@
  * ability to handle these most simple tlvs.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class MultiByteTagTest extends AbstractDecoderTestCase
 {
-    /** precalculated left shift of 1 by 14 places */
-    private static final int BIT_13 = 1 << 14 ;
-    /** precalculated left shift of 1 by 16 places */
-    private static final int BIT_15 = 1 << 16 ;
-    /** precalculated left shift of 1 by 21 places */
-    private static final int BIT_20 = 1 << 21 ;
-    /** precalculated left shift of 1 by 24 places */
-    private static final int BIT_23 = 1 << 24 ;
-    /** precalculated left shift of 1 by 28 places */
-    private static final int BIT_27 = 1 << 28 ;
+    /**
+     * precalculated left shift of 1 by 14 places
+     */
+    private static final int BIT_13 = 1 << 14;
+    /**
+     * precalculated left shift of 1 by 16 places
+     */
+    private static final int BIT_15 = 1 << 16;
+    /**
+     * precalculated left shift of 1 by 21 places
+     */
+    private static final int BIT_20 = 1 << 21;
+    /**
+     * precalculated left shift of 1 by 24 places
+     */
+    private static final int BIT_23 = 1 << 24;
+    /**
+     * precalculated left shift of 1 by 28 places
+     */
+    private static final int BIT_27 = 1 << 28;
 
 
     /**
@@ -44,116 +54,114 @@
      */
     public MultiByteTagTest( String arg0 )
     {
-        super( arg0 ) ;
+        super( arg0 );
     }
 
 
     public void testId31() throws Exception
     {
-        Tuple tlv = decode( "00011111" + "01011111") ;
+        Tuple tlv = decode( "00011111" + "01011111" );
 
-        assertEquals( 31, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        assertEquals( 31, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId100() throws Exception
     {
-        Tuple tlv = decode( "01100100" + "01011111" ) ;
+        Tuple tlv = decode( "01100100" + "01011111" );
 
-        assertEquals( 100, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        assertEquals( 100, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId127() throws Exception
     {
-        Tuple tlv =  decode( "01111111" + "01011111" ) ;
+        Tuple tlv = decode( "01111111" + "01011111" );
 
-        assertEquals( 127, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        assertEquals( 127, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId128() throws Exception
     {
-        Tuple tlv = decode( "00000000" + "10000001" + "01011111" ) ;
+        Tuple tlv = decode( "00000000" + "10000001" + "01011111" );
 
-        assertEquals( 128, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        assertEquals( 128, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId129() throws Exception
     {
-        Tuple tlv = decode( "00000001" + "10000001" + "01011111" ) ;
+        Tuple tlv = decode( "00000001" + "10000001" + "01011111" );
 
-        assertEquals( 129, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        assertEquals( 129, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
-
-
     public void testIdShift14() throws Exception
     {
-        Tuple tlv = decode( "00000000" + "10000000" + "10000001" + "01011111" ) ;
+        Tuple tlv = decode( "00000000" + "10000000" + "10000001" + "01011111" );
 
-        assertEquals( BIT_13, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        assertEquals( BIT_13, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testIdShift14Minus1() throws Exception
     {
-        Tuple tlv = decode( "01111111" + "11111111" + "01011111" ) ;
+        Tuple tlv = decode( "01111111" + "11111111" + "01011111" );
 
-        assertEquals( BIT_13 - 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        assertEquals( BIT_13 - 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testIdShift14Plus1() throws Exception
     {
-        Tuple tlv = decode( "00000001" + "10000000" + "10000001" + "01011111" ) ;
+        Tuple tlv = decode( "00000001" + "10000000" + "10000001" + "01011111" );
 
-        assertEquals( BIT_13 + 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        assertEquals( BIT_13 + 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testIdShift21Minus1() throws Exception
     {
-        Tuple tlv = decode( "01111111" + "11111111" + "11111111" + "01011111" ) ;
+        Tuple tlv = decode( "01111111" + "11111111" + "11111111" + "01011111" );
 
-        assertEquals( BIT_20 - 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        assertEquals( BIT_20 - 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SimplePrimitiveTLVTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SimplePrimitiveTLVTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SimplePrimitiveTLVTest.java	Sat Jul 10 11:54:20 2004
@@ -14,7 +14,7 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 import java.nio.ByteBuffer;
 
@@ -23,7 +23,7 @@
  * Performs simple primitive tlv tests.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class SimplePrimitiveTLVTest extends AbstractDecoderTestCase
@@ -34,131 +34,131 @@
      */
     public SimplePrimitiveTLVTest( String arg0 )
     {
-        super( arg0 ) ;
+        super( arg0 );
     }
 
 
     public void testSingleSimpleTLV() throws Exception
     {
         // decode tag
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        tlv = decode( "00000001" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlv.length ) ;
+        tlv = decode( "00000001" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 1, tlv.length );
 
         // decode value
         this.setExpectedState( decoder.VALUE_STATE );
-        tlv = decode( "01010101" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlvList.size() ) ;
-        assertEquals( 0x0055, 0x00ff & buffer.get() ) ;
+        tlv = decode( "01010101" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
+        assertEquals( 1, tlvList.size() );
+        assertEquals( 0x0055, 0x00ff & buffer.get() );
     }
 
 
     public void testMultipleSimpleTLV() throws Exception
     {
         // decode tag
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        tlv = decode( "00000001" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlv.length ) ;
+        tlv = decode( "00000001" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 1, tlv.length );
 
         // decode value
         this.setExpectedState( decoder.VALUE_STATE );
-        tlv = decode( "01010101" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlvList.size() ) ;
-        assertEquals( 0x0055, 0x00ff & buffer.get() ) ;
+        tlv = decode( "01010101" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
+        assertEquals( 1, tlvList.size() );
+        assertEquals( 0x0055, 0x00ff & buffer.get() );
 
 
         // decode tag
-        tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 1, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 1, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        tlv = decode( "00000001" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlv.length ) ;
+        tlv = decode( "00000001" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 1, tlv.length );
 
         // decode value
         this.setExpectedState( decoder.VALUE_STATE );
-        tlv = decode( "01010101" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
-        assertEquals( 2, tlvList.size() ) ;
-        assertEquals( 0x0055, 0x00ff & buffer.get() ) ;
+        tlv = decode( "01010101" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
+        assertEquals( 2, tlvList.size() );
+        assertEquals( 0x0055, 0x00ff & buffer.get() );
 
 
         // decode tag
-        tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 2, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 2, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        tlv = decode( "00000001" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlv.length ) ;
+        tlv = decode( "00000001" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 1, tlv.length );
 
         // decode value
         this.setExpectedState( decoder.VALUE_STATE );
-        tlv = decode( "01010101" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
-        assertEquals( 3, tlvList.size() ) ;
-        assertEquals( 0x0055, 0x00ff & buffer.get() ) ;
+        tlv = decode( "01010101" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
+        assertEquals( 3, tlvList.size() );
+        assertEquals( 0x0055, 0x00ff & buffer.get() );
     }
 
 
     public void testSingleSimpleLongTLV() throws Exception
     {
         // decode tag
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
         // decode length
-        tlv = decode( "10000001" ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
-
-        tlv = decode( "00000111" ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 7, tlv.length ) ;
+        tlv = decode( "10000001" );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
+
+        tlv = decode( "00000111" );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 7, tlv.length );
 
         // decode value
         this.setExpectedState( decoder.VALUE_STATE );
         tlv = decode( "01010101" + "01010101" + "01010101" + "01010101"
-                + "01010101" + "01010101" + "01010101" ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlvList.size() ) ;
-        assertEquals( 7, buffer.limit() ) ;
+                + "01010101" + "01010101" + "01010101" );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
+        assertEquals( 1, tlvList.size() );
+        assertEquals( 7, buffer.limit() );
 
-        ByteBuffer value = buffer.duplicate() ;
-        for ( int ii = 0 ; ii < 7; ii++ )
+        ByteBuffer value = buffer.duplicate();
+        for ( int ii = 0; ii < 7; ii++ )
         {
-            assertEquals( 0x0055, 0x00ff & value.get( ii ) ) ;
+            assertEquals( 0x0055, 0x00ff & value.get( ii ) );
         }
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SingleByteLengthTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SingleByteLengthTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SingleByteLengthTest.java	Sat Jul 10 11:54:20 2004
@@ -14,14 +14,14 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
 /**
  * Tests single byte length encodings in a BER TLV.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class SingleByteLengthTest extends AbstractDecoderTestCase
@@ -33,59 +33,60 @@
      */
     public SingleByteLengthTest( String name )
     {
-        super( name ) ;
+        super( name );
     }
 
 
     /**
      * This encoding's tuple should complete
+     *
      * @throws Exception
      */
     public void testLength0() throws Exception
     {
         this.setExpectedState( decoder.LENGTH_STATE );
-        Tuple tlv = decode( "00000000" + "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 1, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
-        assertEquals( 0, tlv.length ) ;
+        Tuple tlv = decode( "00000000" + "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 1, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
+        assertEquals( 0, tlv.length );
     }
 
 
     public void testLength1() throws Exception
     {
-        Tuple tlv = decode( "00000001" + "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 1, tlv.length ) ;
+        Tuple tlv = decode( "00000001" + "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 1, tlv.length );
     }
 
 
     public void testLength3() throws Exception
     {
-        Tuple tlv = decode( "00000011" + "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 3, tlv.length ) ;
+        Tuple tlv = decode( "00000011" + "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 3, tlv.length );
     }
 
 
     public void testLength127() throws Exception
     {
-        Tuple tlv = decode( "01111111" + "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.VALUE_STATE, decoder.getState() ) ;
-        assertEquals( 127, tlv.length ) ;
+        Tuple tlv = decode( "01111111" + "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.VALUE_STATE, decoder.getState() );
+        assertEquals( 127, tlv.length );
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SingleByteTagTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SingleByteTagTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/SingleByteTagTest.java	Sat Jul 10 11:54:20 2004
@@ -14,7 +14,7 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
 /**
@@ -22,7 +22,7 @@
  * ability to handle these most simple tlvs.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class SingleByteTagTest extends AbstractDecoderTestCase
@@ -33,51 +33,51 @@
      */
     public SingleByteTagTest( String arg0 )
     {
-        super( arg0 ) ;
+        super( arg0 );
     }
 
 
     public void testAppTypeClass() throws Exception
     {
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testPrivTypeClass() throws Exception
     {
-        Tuple tlv = decode( "11000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.PRIVATE, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "11000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.PRIVATE, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testCtxTypeClass() throws Exception
     {
-        Tuple tlv = decode( "10000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.CONTEXT_SPECIFIC, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "10000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.CONTEXT_SPECIFIC, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testUniTypeClass() throws Exception
     {
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
 
     }
 
@@ -85,364 +85,364 @@
     {
         try
         {
-            Tuple tlv = decode( "00000001" ) ;
+            Tuple tlv = decode( "00000001" );
         }
-        catch( IllegalStateException e )
+        catch ( IllegalStateException e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 
     public void testId1() throws Exception
     {
-        Tuple tlv = decode( "01000001" ) ;
-        assertEquals( 1, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000001" );
+        assertEquals( 1, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId2() throws Exception
     {
-        Tuple tlv = decode( "01000010" ) ;
-        assertEquals( 2, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000010" );
+        assertEquals( 2, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId3() throws Exception
     {
-        Tuple tlv = decode( "01000011" ) ;
-        assertEquals( 3, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000011" );
+        assertEquals( 3, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId4() throws Exception
     {
-        Tuple tlv = decode( "01000100" ) ;
-        assertEquals( 4, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000100" );
+        assertEquals( 4, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId5() throws Exception
     {
-        Tuple tlv = decode( "01000101" ) ;
-        assertEquals( 5, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000101" );
+        assertEquals( 5, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId6() throws Exception
     {
-        Tuple tlv = decode( "01000110" ) ;
-        assertEquals( 6, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000110" );
+        assertEquals( 6, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId7() throws Exception
     {
-        Tuple tlv = decode( "01000111" ) ;
-        assertEquals( 7, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01000111" );
+        assertEquals( 7, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId8() throws Exception
     {
-        Tuple tlv = decode( "01001000" ) ;
-        assertEquals( 8, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01001000" );
+        assertEquals( 8, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId9() throws Exception
     {
-        Tuple tlv = decode( "01001001" ) ;
-        assertEquals( 9, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01001001" );
+        assertEquals( 9, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId10() throws Exception
     {
-        Tuple tlv = decode( "01001010" ) ;
-        assertEquals( 10, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01001010" );
+        assertEquals( 10, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId11() throws Exception
     {
-        Tuple tlv = decode( "01001011" ) ;
-        assertEquals( 11, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01001011" );
+        assertEquals( 11, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId12() throws Exception
     {
-        Tuple tlv = decode( "01001100" ) ;
-        assertEquals( 12, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01001100" );
+        assertEquals( 12, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId13() throws Exception
     {
-        Tuple tlv = decode( "01001101" ) ;
-        assertEquals( 13, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01001101" );
+        assertEquals( 13, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId14() throws Exception
     {
-        Tuple tlv = decode( "01001110" ) ;
-        assertEquals( 14, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01001110" );
+        assertEquals( 14, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId15() throws Exception
     {
-        Tuple tlv = decode( "01001111" ) ;
-        assertEquals( 15, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01001111" );
+        assertEquals( 15, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId16() throws Exception
     {
-        Tuple tlv = decode( "01010000" ) ;
-        assertEquals( 16, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01010000" );
+        assertEquals( 16, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId17() throws Exception
     {
-        Tuple tlv = decode( "01010001" ) ;
-        assertEquals( 17, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01010001" );
+        assertEquals( 17, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId18() throws Exception
     {
-        Tuple tlv = decode( "01010010" ) ;
-        assertEquals( 18, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01010010" );
+        assertEquals( 18, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId19() throws Exception
     {
-        Tuple tlv = decode( "01010011" ) ;
-        assertEquals( 19, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01010011" );
+        assertEquals( 19, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId20() throws Exception
     {
-        Tuple tlv = decode( "01010100" ) ;
-        assertEquals( 20, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01010100" );
+        assertEquals( 20, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId21() throws Exception
     {
-        Tuple tlv = decode( "01010101" ) ;
-        assertEquals( 21, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01010101" );
+        assertEquals( 21, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId22() throws Exception
     {
-        Tuple tlv = decode( "01010110" ) ;
-        assertEquals( 22, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01010110" );
+        assertEquals( 22, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId23() throws Exception
     {
-        Tuple tlv = decode( "01010111" ) ;
-        assertEquals( 23, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01010111" );
+        assertEquals( 23, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId24() throws Exception
     {
-        Tuple tlv = decode( "01011000" ) ;
-        assertEquals( 24, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01011000" );
+        assertEquals( 24, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId25() throws Exception
     {
-        Tuple tlv = decode( "01011001" ) ;
-        assertEquals( 25, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01011001" );
+        assertEquals( 25, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId26() throws Exception
     {
-        Tuple tlv = decode( "01011010" ) ;
-        assertEquals( 26, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01011010" );
+        assertEquals( 26, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId27() throws Exception
     {
-        Tuple tlv = decode( "01011011" ) ;
-        assertEquals( 27, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01011011" );
+        assertEquals( 27, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId28() throws Exception
     {
-        Tuple tlv = decode( "01011100" ) ;
-        assertEquals( 28, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01011100" );
+        assertEquals( 28, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId29() throws Exception
     {
-        Tuple tlv = decode( "01011101" ) ;
-        assertEquals( 29, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01011101" );
+        assertEquals( 29, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testId30() throws Exception
     {
-        Tuple tlv = decode( "01011110" ) ;
-        assertEquals( 30, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( true, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01011110" );
+        assertEquals( 30, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( true, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 
 
     public void testIdOverLimit() throws Exception
     {
         // this is the long form
-        Tuple tlv = decode( "01011111" ) ;
+        Tuple tlv = decode( "01011111" );
 
-        assertEquals( null, tlv ) ;
-        assertEquals( 0, tlvList.size() ) ;
+        assertEquals( null, tlv );
+        assertEquals( 0, tlvList.size() );
 
         // state did not switch since we are still reading the long tag
-        assertEquals( decoder.TAG_STATE, decoder.getState() ) ;
+        assertEquals( decoder.TAG_STATE, decoder.getState() );
     }
 
 
     public void testIsConstructed() throws Exception
     {
-        Tuple tlv = decode( "01111110" ) ;
-        assertEquals( 30, tlv.id ) ;
-        assertEquals( 0, tlvList.size() ) ;
-        assertEquals( false, tlv.isPrimitive ) ;
-        assertEquals( TypeClass.APPLICATION, tlv.typeClass ) ;
-        assertEquals( decoder.LENGTH_STATE, decoder.getState() ) ;
+        Tuple tlv = decode( "01111110" );
+        assertEquals( 30, tlv.id );
+        assertEquals( 0, tlvList.size() );
+        assertEquals( false, tlv.isPrimitive );
+        assertEquals( TypeClass.APPLICATION, tlv.typeClass );
+        assertEquals( decoder.LENGTH_STATE, decoder.getState() );
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TagTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TagTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TagTest.java	Sat Jul 10 11:54:20 2004
@@ -14,41 +14,41 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
-import org.apache.commons.lang.ArrayUtils ;
+import java.nio.BufferOverflowException;
 
-import junit.framework.TestCase ;
+import junit.framework.TestCase;
 
-import java.nio.BufferOverflowException;
+import org.apache.commons.lang.ArrayUtils;
 
 
 /**
  * Tests the BER utility functions.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class TagTest extends TestCase
 {
-    private static final int BIT_0 = 0x01 ;
-    private static final int BIT_1 = 0x02 ;
-    private static final int BIT_2 = 0x04 ;
-    private static final int BIT_3 = 0x08 ;
-    private static final int BIT_4 = 0x10 ;
-    private static final int BIT_5 = 0x20 ;
-    private static final int BIT_6 = 0x40 ;
-    private static final int BIT_7 = 0x80 ;
+    private static final int BIT_0 = 0x01;
+    private static final int BIT_1 = 0x02;
+    private static final int BIT_2 = 0x04;
+    private static final int BIT_3 = 0x08;
+    private static final int BIT_4 = 0x10;
+    private static final int BIT_5 = 0x20;
+    private static final int BIT_6 = 0x40;
+    private static final int BIT_7 = 0x80;
+
 
-    
     public static void main( String[] args )
     {
-        junit.textui.TestRunner.run( TagTest.class ) ;
+        junit.textui.TestRunner.run( TagTest.class );
     }
 
-    
+
     /*
      * @see TestCase#setUp()
      */
@@ -57,7 +57,7 @@
         super.setUp();
     }
 
-    
+
     /*
      * @see TestCase#tearDown()
      */
@@ -66,187 +66,188 @@
         super.tearDown();
     }
 
-    
+
     /**
      * Constructor for TagTest.
+     *
      * @param arg0
      */
-    public TagTest(String arg0)
+    public TagTest( String arg0 )
     {
-        super(arg0);
+        super( arg0 );
     }
-    
-    
+
+
     public void getTypeClass()
     {
-        assertEquals( TypeClass.UNIVERSAL, TypeClass.getTypeClass( 0 ) ) ;
+        assertEquals( TypeClass.UNIVERSAL, TypeClass.getTypeClass( 0 ) );
     }
-    
-    
+
+
     public void testIsPrimitive() throws Exception
     {
-        byte octet = BIT_5 ;
-        
-        assertFalse( Tag.isPrimitive( octet ) ) ;
-        assertFalse( Tag.isPrimitive( BIT_5 ) ) ;
-        
-        assertTrue( Tag.isPrimitive( 0 ) ) ;
-        assertTrue( Tag.isPrimitive( BIT_0 ) ) ;
-        assertTrue( Tag.isPrimitive( BIT_1 ) ) ;
-        assertTrue( Tag.isPrimitive( BIT_2 ) ) ;
-        assertTrue( Tag.isPrimitive( BIT_3 ) ) ;
-        assertTrue( Tag.isPrimitive( BIT_4 ) ) ;
-        assertTrue( Tag.isPrimitive( BIT_6 ) ) ;
-        assertTrue( Tag.isPrimitive( BIT_7 ) ) ;
+        byte octet = BIT_5;
+
+        assertFalse( Tag.isPrimitive( octet ) );
+        assertFalse( Tag.isPrimitive( BIT_5 ) );
+
+        assertTrue( Tag.isPrimitive( 0 ) );
+        assertTrue( Tag.isPrimitive( BIT_0 ) );
+        assertTrue( Tag.isPrimitive( BIT_1 ) );
+        assertTrue( Tag.isPrimitive( BIT_2 ) );
+        assertTrue( Tag.isPrimitive( BIT_3 ) );
+        assertTrue( Tag.isPrimitive( BIT_4 ) );
+        assertTrue( Tag.isPrimitive( BIT_6 ) );
+        assertTrue( Tag.isPrimitive( BIT_7 ) );
     }
 
 
     public void testIsConstructed() throws Exception
     {
-        byte octet = BIT_5 ;
-        
-        assertTrue( Tag.isConstructed( octet ) ) ;
-        assertTrue( Tag.isConstructed( BIT_5 ) ) ;
-        
-        assertFalse( Tag.isConstructed( 0 ) ) ;
-        assertFalse( Tag.isConstructed( BIT_0 ) ) ;
-        assertFalse( Tag.isConstructed( BIT_1 ) ) ;
-        assertFalse( Tag.isConstructed( BIT_2 ) ) ;
-        assertFalse( Tag.isConstructed( BIT_3 ) ) ;
-        assertFalse( Tag.isConstructed( BIT_4 ) ) ;
-        assertFalse( Tag.isConstructed( BIT_6 ) ) ;
-        assertFalse( Tag.isConstructed( BIT_7 ) ) ;
+        byte octet = BIT_5;
+
+        assertTrue( Tag.isConstructed( octet ) );
+        assertTrue( Tag.isConstructed( BIT_5 ) );
+
+        assertFalse( Tag.isConstructed( 0 ) );
+        assertFalse( Tag.isConstructed( BIT_0 ) );
+        assertFalse( Tag.isConstructed( BIT_1 ) );
+        assertFalse( Tag.isConstructed( BIT_2 ) );
+        assertFalse( Tag.isConstructed( BIT_3 ) );
+        assertFalse( Tag.isConstructed( BIT_4 ) );
+        assertFalse( Tag.isConstructed( BIT_6 ) );
+        assertFalse( Tag.isConstructed( BIT_7 ) );
     }
-    
-    
+
+
     public void testGetTagId() throws Exception
     {
-        byte[] octets = new byte[1] ;
-        
-        for ( int ii = 0 ; ii < 128; ii++ )
-        {
-            octets[0] = ( byte ) ii ;
-            
-            if ( ii < 31 ) 
+        byte[] octets = new byte[1];
+
+        for ( int ii = 0; ii < 128; ii++ )
+        {
+            octets[0] = (byte) ii;
+
+            if ( ii < 31 )
             {
-                assertEquals( Tag.getTagId( octets ), ii ) ;
+                assertEquals( Tag.getTagId( octets ), ii );
             }
             else
             {
-                assertTrue( Tag.getTagId( octets ) != ii ) ;
+                assertTrue( Tag.getTagId( octets ) != ii );
             }
         }
-        
-        octets = new byte[2] ;
-        octets[0] = 31 ;
-        octets[1] = 0 ;
-        
-        for ( int ii = 31 ; ii < 255; ii++ )
-        {
-            octets[1] = ( byte ) ii ;
-            
-            if ( ii < 128 ) 
+
+        octets = new byte[2];
+        octets[0] = 31;
+        octets[1] = 0;
+
+        for ( int ii = 31; ii < 255; ii++ )
+        {
+            octets[1] = (byte) ii;
+
+            if ( ii < 128 )
             {
-                assertEquals( Tag.getTagId( octets ), ii ) ;
+                assertEquals( Tag.getTagId( octets ), ii );
             }
             else
             {
-                assertTrue( Tag.getTagId( octets ) != ii ) ;
+                assertTrue( Tag.getTagId( octets ) != ii );
             }
         }
-        
-        octets = new byte[3] ;
-        octets[0] = 31 ;
-        octets[1] = 0 ;
-        octets[2] = 0 ;
-        
-        for ( int ii = 128 ; ii < 20000; ii++ )
+
+        octets = new byte[3];
+        octets[0] = 31;
+        octets[1] = 0;
+        octets[2] = 0;
+
+        for ( int ii = 128; ii < 20000; ii++ )
         {
-            octets[1] = ( byte ) ( ( ii >> 7 ) & Tag.LONG_MASK ) ;
-            octets[2] = ( byte ) ( ii & Tag.LONG_MASK ) ;
+            octets[1] = (byte) ( ( ii >> 7 ) & Tag.LONG_MASK );
+            octets[2] = (byte) ( ii & Tag.LONG_MASK );
 
-            if ( ii < 16384 ) 
+            if ( ii < 16384 )
             {
-                assertEquals( Tag.getTagId( octets ), ii ) ;
+                assertEquals( Tag.getTagId( octets ), ii );
             }
             else
             {
-                assertTrue( Tag.getTagId( octets ) != ii ) ;
+                assertTrue( Tag.getTagId( octets ) != ii );
             }
         }
 
-        octets = new byte[4] ;
-        octets[0] = 31 ;
-        octets[1] = 0 ; // shift 0
-        octets[2] = 0 ; // shift 7
-        octets[3] = 0 ; // shift 14
-
-        for ( int ii = 16384 ; ii < 2100000 ; ii++ )
-        {
-            octets[1] = ( byte ) ( ( ii >> 14 ) & Tag.LONG_MASK ) ;
-            octets[2] = ( byte ) ( ( ii >> 7 ) & Tag.LONG_MASK ) ;
-            octets[3] = ( byte ) ( ii & Tag.LONG_MASK ) ;
+        octets = new byte[4];
+        octets[0] = 31;
+        octets[1] = 0; // shift 0
+        octets[2] = 0; // shift 7
+        octets[3] = 0; // shift 14
+
+        for ( int ii = 16384; ii < 2100000; ii++ )
+        {
+            octets[1] = (byte) ( ( ii >> 14 ) & Tag.LONG_MASK );
+            octets[2] = (byte) ( ( ii >> 7 ) & Tag.LONG_MASK );
+            octets[3] = (byte) ( ii & Tag.LONG_MASK );
 
-            if ( ii < 2097152 ) 
+            if ( ii < 2097152 )
             {
-                assertEquals( Tag.getTagId( octets ), ii ) ;
+                assertEquals( Tag.getTagId( octets ), ii );
             }
             else
             {
-                assertTrue( Tag.getTagId( octets ) != ii ) ;
+                assertTrue( Tag.getTagId( octets ) != ii );
             }
         }
-        
+
         try
         {
-            Tag.getTagId( new byte[5] ) ;
-            fail( "should fail before getting here" ) ;
+            Tag.getTagId( new byte[5] );
+            fail( "should fail before getting here" );
         }
         catch ( Throwable t )
         {
-            assertNotNull( t ) ;
+            assertNotNull( t );
         }
 
 
         try
         {
-            Tag.getTagId( new byte[12] ) ;
-            fail( "should fail before getting here" ) ;
+            Tag.getTagId( new byte[12] );
+            fail( "should fail before getting here" );
         }
         catch ( Throwable t )
         {
-            assertNotNull( t ) ;
+            assertNotNull( t );
         }
     }
-    
-    
+
+
     public void testTagLimits() throws Exception
     {
-        byte[] bites = { (byte) 0xff, (byte) 0xff, (byte) 0x8f, (byte) 0x0f } ;
+        byte[] bites = {(byte) 0xff, (byte) 0xff, (byte) 0x8f, (byte) 0x0f};
 
-        Tag tag = new Tag() ;
-        tag.add( bites[0] ) ;
-        tag.add( bites[1] ) ;
-        tag.add( bites[2] ) ;
-        tag.add( bites[3] ) ;
-
-        byte[] octets = tag.getOctets() ;
-        assertTrue( ArrayUtils.isEquals( bites, octets ) ) ;
-
-        byte[] tooMany = { (byte) 0xff, (byte) 0xff, (byte) 0x8f, (byte) 0x8f, (byte) 0x0f } ;
-
-        tag = new Tag() ;
-        tag.add( tooMany[0] ) ;
-        tag.add( tooMany[1] ) ;
-        tag.add( tooMany[2] ) ;
-        tag.add( tooMany[3] ) ;
+        Tag tag = new Tag();
+        tag.add( bites[0] );
+        tag.add( bites[1] );
+        tag.add( bites[2] );
+        tag.add( bites[3] );
+
+        byte[] octets = tag.getOctets();
+        assertTrue( ArrayUtils.isEquals( bites, octets ) );
+
+        byte[] tooMany = {(byte) 0xff, (byte) 0xff, (byte) 0x8f, (byte) 0x8f, (byte) 0x0f};
+
+        tag = new Tag();
+        tag.add( tooMany[0] );
+        tag.add( tooMany[1] );
+        tag.add( tooMany[2] );
+        tag.add( tooMany[3] );
 
         try
         {
-            tag.add( tooMany[4] ) ;
-            fail( "should never get here due to exception" ) ;
+            tag.add( tooMany[4] );
+            fail( "should never get here due to exception" );
         }
-        catch( BufferOverflowException e )
+        catch ( BufferOverflowException e )
         {
         }
     }
@@ -254,33 +255,33 @@
 
     public void testGetOctets() throws Exception
     {
-        byte[] bites = { (byte) 0xff, (byte) 0xff, (byte) 0x0f } ;
-        
-        Tag tag = new Tag() ;
-        tag.add( bites[0] ) ;
-        tag.add( bites[1] ) ;
-        tag.add( bites[2] ) ;
-        
-        byte[] octets = tag.getOctets() ;
-        assertTrue( ArrayUtils.isEquals( bites, octets ) ) ;
+        byte[] bites = {(byte) 0xff, (byte) 0xff, (byte) 0x0f};
+
+        Tag tag = new Tag();
+        tag.add( bites[0] );
+        tag.add( bites[1] );
+        tag.add( bites[2] );
+
+        byte[] octets = tag.getOctets();
+        assertTrue( ArrayUtils.isEquals( bites, octets ) );
     }
-    
-    
+
+
     public void testGetOctets2() throws Exception
     {
-        byte[] bites = { (byte) 0x00, (byte) 0xff } ;
-        
-        Tag tag = new Tag() ;
-        tag.add( bites[0] ) ;
-        
+        byte[] bites = {(byte) 0x00, (byte) 0xff};
+
+        Tag tag = new Tag();
+        tag.add( bites[0] );
+
         try
         {
-            tag.add( bites[1] ) ;
-            fail( "should never get here due to illegal state" ) ;
+            tag.add( bites[1] );
+            fail( "should never get here due to illegal state" );
         }
-        catch ( Throwable t ) 
+        catch ( Throwable t )
         {
-            assertNotNull( t ) ;
+            assertNotNull( t );
         }
     }
 
@@ -288,54 +289,54 @@
     public void testGetIntEncodedTag()
     {
         assertEquals( 0x01000000,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 1, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 1, false ) );
 
         assertEquals( 0x0F000000,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 15, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 15, false ) );
 
         assertEquals( 0x1E000000,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 30, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 30, false ) );
 
         assertEquals( 0x1F1F0000,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 31, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 31, false ) );
 
         assertEquals( 0x1F7E0000,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 126, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 126, false ) );
 
         assertEquals( 0x1F7F0000,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 127, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 127, false ) );
 
         assertEquals( 0x1F810000,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 128, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 128, false ) );
 
         assertEquals( 0x1F810100,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 129, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, 129, false ) );
 
         assertEquals( 0x3FFF7E00,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, (1<<14)-2, true ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, ( 1 << 14 ) - 2, true ) );
 
         assertEquals( 0x1FFF7F00,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, (1<<14)-1, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, ( 1 << 14 ) - 1, false ) );
 
         assertEquals( 0xDF818000,
-                Tag.getIntEncodedTag( TypeClass.PRIVATE, (1<<14), false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.PRIVATE, ( 1 << 14 ), false ) );
 
         assertEquals( 0x5F818001,
-                Tag.getIntEncodedTag( TypeClass.APPLICATION, (1<<14)+1, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.APPLICATION, ( 1 << 14 ) + 1, false ) );
 
         assertEquals( 0x9FFFFF7E,
                 Tag.getIntEncodedTag( TypeClass.CONTEXT_SPECIFIC,
-                        (1<<21)-2, false ) ) ;
+                        ( 1 << 21 ) - 2, false ) );
 
         assertEquals( 0x1FFFFF7F,
-                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, (1<<21)-1, false ) ) ;
+                Tag.getIntEncodedTag( TypeClass.UNIVERSAL, ( 1 << 21 ) - 1, false ) );
 
         try
         {
-            Tag.getIntEncodedTag( TypeClass.UNIVERSAL, (1<<21), false ) ;
-            fail( "should never get here due to an exception" ) ;
+            Tag.getIntEncodedTag( TypeClass.UNIVERSAL, ( 1 << 21 ), false );
+            fail( "should never get here due to an exception" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
         }
     }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TupleTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TupleTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TupleTest.java	Sat Jul 10 11:54:20 2004
@@ -14,40 +14,49 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collections;
 
-import org.apache.commons.lang.ArrayUtils ;
-import org.apache.commons.codec.binary.Binary ;
+import org.apache.commons.codec.binary.Binary;
 
 
 /**
  * Tests Tuple class.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class TupleTest extends AbstractDecoderTestCase
 {
-    /** precalculated left shift of 1 by 14 places */
-    private static final int BIT_13 = 1 << 14 ;
-    /** precalculated left shift of 1 by 16 places */
-    private static final int BIT_15 = 1 << 16 ;
-    /** precalculated left shift of 1 by 21 places */
-    private static final int BIT_20 = 1 << 21 ;
-    /** precalculated left shift of 1 by 24 places */
-    private static final int BIT_23 = 1 << 24 ;
-    /** precalculated left shift of 1 by 28 places */
-    private static final int BIT_27 = 1 << 28 ;
+    /**
+     * precalculated left shift of 1 by 14 places
+     */
+    private static final int BIT_13 = 1 << 14;
+    /**
+     * precalculated left shift of 1 by 16 places
+     */
+    private static final int BIT_15 = 1 << 16;
+    /**
+     * precalculated left shift of 1 by 21 places
+     */
+    private static final int BIT_20 = 1 << 21;
+    /**
+     * precalculated left shift of 1 by 24 places
+     */
+    private static final int BIT_23 = 1 << 24;
+    /**
+     * precalculated left shift of 1 by 28 places
+     */
+    private static final int BIT_27 = 1 << 28;
 
-    public static void main(String[] args)
+    public static void main( String[] args )
     {
-        junit.textui.TestRunner.run(TupleTest.class);
+        junit.textui.TestRunner.run( TupleTest.class );
     }
 
     /*
@@ -68,11 +77,12 @@
 
     /**
      * Constructor for TupleTest.
+     *
      * @param arg0
      */
-    public TupleTest(String arg0)
+    public TupleTest( String arg0 )
     {
-        super(arg0);
+        super( arg0 );
     }
 
     /*
@@ -80,7 +90,7 @@
      */
     public void testTuple()
     {
-        assertNotNull( new Tuple() ) ;
+        assertNotNull( new Tuple() );
     }
 
     /*
@@ -88,11 +98,11 @@
      */
     public void testTupleint()
     {
-        Tuple t0 = new Tuple( 0, 0 ) ;
-        assertEquals( 0, t0.id ) ;
-        Tuple t1 = new Tuple( 1, 0 ) ;
-        assertEquals( 1, t1.id ) ;
-        assertFalse( t0.equals(t1) ) ;
+        Tuple t0 = new Tuple( 0, 0 );
+        assertEquals( 0, t0.id );
+        Tuple t1 = new Tuple( 1, 0 );
+        assertEquals( 1, t1.id );
+        assertFalse( t0.equals( t1 ) );
     }
 
     /*
@@ -100,13 +110,13 @@
      */
     public void testTupleintint()
     {
-        Tuple t0 = new Tuple( 0, 0 ) ;
-        assertEquals( 0, t0.id ) ;
-        assertEquals( 0, t0.length ) ;
-        Tuple t1 = new Tuple( 0, 1 ) ;
-        assertEquals( 0, t1.id ) ;
-        assertEquals( 1, t1.length ) ;
-        assertFalse( t0.equals(t1) ) ;
+        Tuple t0 = new Tuple( 0, 0 );
+        assertEquals( 0, t0.id );
+        assertEquals( 0, t0.length );
+        Tuple t1 = new Tuple( 0, 1 );
+        assertEquals( 0, t1.id );
+        assertEquals( 1, t1.length );
+        assertFalse( t0.equals( t1 ) );
     }
 
     /*
@@ -114,15 +124,15 @@
      */
     public void testTupleintintTypeClass()
     {
-        Tuple t0 = new Tuple( 0, 0, TypeClass.PRIVATE ) ;
-        assertEquals( 0, t0.id ) ;
-        assertEquals( 0, t0.length ) ;
-        assertEquals( TypeClass.PRIVATE, t0.getTypeClass() ) ;
-        Tuple t1 = new Tuple( 0, 1, null ) ;
-        assertEquals( 0, t1.id ) ;
-        assertEquals( 1, t1.length ) ;
-        assertFalse( t0.equals(t1) ) ;
-        assertEquals( TypeClass.APPLICATION, t1.getTypeClass() ) ;
+        Tuple t0 = new Tuple( 0, 0, TypeClass.PRIVATE );
+        assertEquals( 0, t0.id );
+        assertEquals( 0, t0.length );
+        assertEquals( TypeClass.PRIVATE, t0.getTypeClass() );
+        Tuple t1 = new Tuple( 0, 1, null );
+        assertEquals( 0, t1.id );
+        assertEquals( 1, t1.length );
+        assertFalse( t0.equals( t1 ) );
+        assertEquals( TypeClass.APPLICATION, t1.getTypeClass() );
     }
 
     /*
@@ -130,132 +140,132 @@
      */
     public void testTupleintTypeClass()
     {
-        Tuple t = new Tuple( 2, TypeClass.PRIVATE ) ;
-        assertEquals( 2, t.getId() ) ;
-        assertEquals( TypeClass.PRIVATE, t.getTypeClass() ) ;
-        assertEquals( false, t.isPrimitive() ) ;
-        assertEquals( Length.INDEFINITE, t.getLength() ) ;
-
-        t = new Tuple( 2, (TypeClass) null ) ;
-        assertEquals( 2, t.getId() ) ;
-        assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
-        assertEquals( false, t.isPrimitive() ) ;
-        assertEquals( Length.INDEFINITE, t.getLength() ) ;
+        Tuple t = new Tuple( 2, TypeClass.PRIVATE );
+        assertEquals( 2, t.getId() );
+        assertEquals( TypeClass.PRIVATE, t.getTypeClass() );
+        assertEquals( false, t.isPrimitive() );
+        assertEquals( Length.INDEFINITE, t.getLength() );
+
+        t = new Tuple( 2, (TypeClass) null );
+        assertEquals( 2, t.getId() );
+        assertEquals( TypeClass.APPLICATION, t.getTypeClass() );
+        assertEquals( false, t.isPrimitive() );
+        assertEquals( Length.INDEFINITE, t.getLength() );
     }
 
     public void testGetId()
     {
-        Tuple t = new Tuple() ;
-        assertEquals( 0, t.getId() ) ;
-        t = new Tuple( 2, 0 ) ;
-        assertEquals( 2, t.getId() ) ;
-        t.id = 21 ;
-        assertEquals( 21, t.getId() ) ;
+        Tuple t = new Tuple();
+        assertEquals( 0, t.getId() );
+        t = new Tuple( 2, 0 );
+        assertEquals( 2, t.getId() );
+        t.id = 21;
+        assertEquals( 21, t.getId() );
     }
-    
-    
+
+
     public void testSize()
     {
-        Tuple t = new Tuple( 1, TypeClass.APPLICATION ) ;
-        assertEquals( 2, t.size() ) ;
-        t.id = 32 ;
-        assertEquals( 3, t.size() ) ;
-        t.id = 127 ;
-        assertEquals( 4, t.size() ) ;
-        t.id = 128 ;
-        assertEquals( 4, t.size() ) ;
-        t.id = 1 << 14 ;
-        assertEquals( 5, t.size() ) ;
-        t.id = 1 << 21 ;
-        assertEquals( 6, t.size() ) ;
-        
-        t.length = 127 ;
-        assertEquals( 6+127, t.size() ) ;
-        t.length = 128 ;
-        assertEquals( 7+128, t.size() ) ;
-        t.length = 255 ;
-        assertEquals( 7+255, t.size() ) ;
-        t.length = 256 ;
-        assertEquals( 8+256, t.size() ) ;
+        Tuple t = new Tuple( 1, TypeClass.APPLICATION );
+        assertEquals( 2, t.size() );
+        t.id = 32;
+        assertEquals( 3, t.size() );
+        t.id = 127;
+        assertEquals( 4, t.size() );
+        t.id = 128;
+        assertEquals( 4, t.size() );
+        t.id = 1 << 14;
+        assertEquals( 5, t.size() );
+        t.id = 1 << 21;
+        assertEquals( 6, t.size() );
+
+        t.length = 127;
+        assertEquals( 6 + 127, t.size() );
+        t.length = 128;
+        assertEquals( 7 + 128, t.size() );
+        t.length = 255;
+        assertEquals( 7 + 255, t.size() );
+        t.length = 256;
+        assertEquals( 8 + 256, t.size() );
     }
-    
-    
+
+
     public void testIsIndefinate()
     {
-        Tuple t = new Tuple() ;
-        assertFalse( t.isIndefinite() ) ;
-        t.length = Length.INDEFINITE ;
-        assertTrue( t.isIndefinite() ) ;
+        Tuple t = new Tuple();
+        assertFalse( t.isIndefinite() );
+        t.length = Length.INDEFINITE;
+        assertTrue( t.isIndefinite() );
     }
-    
+
 
     public void testIsIndefinateTerminator()
     {
-        Tuple t = new Tuple() ;
-        assertFalse( t.isIndefiniteTerminator() ) ;
-        t.id = 0 ;
-        t.length = 0 ;
-        t.isPrimitive = true ;
-        t.typeClass = TypeClass.UNIVERSAL ;
-        assertTrue( t.isIndefiniteTerminator() ) ;
+        Tuple t = new Tuple();
+        assertFalse( t.isIndefiniteTerminator() );
+        t.id = 0;
+        t.length = 0;
+        t.isPrimitive = true;
+        t.typeClass = TypeClass.UNIVERSAL;
+        assertTrue( t.isIndefiniteTerminator() );
     }
-    
+
 
     public void testIsPrimitive()
     {
-        Tuple t = new Tuple() ;
-        assertTrue( t.isPrimitive() ) ;
-        t.isPrimitive = false ;
-        assertFalse( t.isPrimitive() ) ;
+        Tuple t = new Tuple();
+        assertTrue( t.isPrimitive() );
+        t.isPrimitive = false;
+        assertFalse( t.isPrimitive() );
     }
 
     public void testGetLength()
     {
-        Tuple t = new Tuple() ;
-        assertEquals( 0, t.getLength() ) ;
-        t = new Tuple( 1, 2 ) ;
-        assertEquals( 2, t.getLength() ) ;
-        t.length = 21 ;
-        assertEquals( 21, t.getLength() ) ;
+        Tuple t = new Tuple();
+        assertEquals( 0, t.getLength() );
+        t = new Tuple( 1, 2 );
+        assertEquals( 2, t.getLength() );
+        t.length = 21;
+        assertEquals( 21, t.getLength() );
     }
 
     public void testGetTypeClass()
     {
-        Tuple t = new Tuple() ;
-        assertEquals( t.typeClass, TypeClass.APPLICATION ) ;
-        t = new Tuple( 0, 0 ) ;
-        assertEquals( TypeClass.APPLICATION, t.getTypeClass() ) ;
-        t.typeClass = TypeClass.PRIVATE ;
-        assertEquals( TypeClass.PRIVATE, t.getTypeClass() ) ;
+        Tuple t = new Tuple();
+        assertEquals( t.typeClass, TypeClass.APPLICATION );
+        t = new Tuple( 0, 0 );
+        assertEquals( TypeClass.APPLICATION, t.getTypeClass() );
+        t.typeClass = TypeClass.PRIVATE;
+        assertEquals( TypeClass.PRIVATE, t.getTypeClass() );
     }
 
     public void testClear()
     {
-        Tuple t = new Tuple() ;
-        t.id = 12 ;
-        assertEquals( 12, t.id ) ;
-        t.clear() ;
-        assertEquals( 0, t.id ) ;
-
-        t.length = 12 ;
-        assertEquals( 12, t.length ) ;
-        t.clear() ;
-        assertEquals( Length.UNDEFINED, t.length ) ;
-
-        t.index = 12 ;
-        assertEquals( 12, t.index ) ;
-        t.clear() ;
-        assertEquals( 0, t.index ) ;
-
-        t.isPrimitive = false ;
-        assertEquals( false, t.isPrimitive ) ;
-        t.clear() ;
-        assertEquals( true, t.isPrimitive ) ;
-
-        t.typeClass = TypeClass.CONTEXT_SPECIFIC ;
-        assertEquals( TypeClass.CONTEXT_SPECIFIC, t.typeClass ) ;
-        t.clear() ;
-        assertEquals( TypeClass.APPLICATION, t.typeClass ) ;
+        Tuple t = new Tuple();
+        t.id = 12;
+        assertEquals( 12, t.id );
+        t.clear();
+        assertEquals( 0, t.id );
+
+        t.length = 12;
+        assertEquals( 12, t.length );
+        t.clear();
+        assertEquals( Length.UNDEFINED, t.length );
+
+        t.index = 12;
+        assertEquals( 12, t.index );
+        t.clear();
+        assertEquals( 0, t.index );
+
+        t.isPrimitive = false;
+        assertEquals( false, t.isPrimitive );
+        t.clear();
+        assertEquals( true, t.isPrimitive );
+
+        t.typeClass = TypeClass.CONTEXT_SPECIFIC;
+        assertEquals( TypeClass.CONTEXT_SPECIFIC, t.typeClass );
+        t.clear();
+        assertEquals( TypeClass.APPLICATION, t.typeClass );
 
     }
 
@@ -264,819 +274,804 @@
      */
     public void testEqualsObject()
     {
-        Tuple tnull0 = new Tuple() ;
-        Tuple tnull1 = new Tuple() ;
-        tnull0.equals( tnull1 ) ;
-        
-        tnull1.equals( tnull1 ) ;
-        tnull0.equals( tnull0 ) ;
+        Tuple tnull0 = new Tuple();
+        Tuple tnull1 = new Tuple();
+        tnull0.equals( tnull1 );
+
+        tnull1.equals( tnull1 );
+        tnull0.equals( tnull0 );
     }
 
     public void testToEncodedBufferConstructed()
     {
-        Tuple t = null ;
-        ByteBuffer encoded ;
-        String binary ;
-
-        t = new Tuple( 0, 0 ) ;
-        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        Tuple t = null;
+        ByteBuffer encoded;
+        String binary;
+
+        t = new Tuple( 0, 0 );
+        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "01100000"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 2, 0 ) ;
-        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        t = new Tuple( 2, 0 );
+        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "01100010"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 30, 0 ) ;
-        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        t = new Tuple( 30, 0 );
+        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "01111110"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 31, 0 ) ;
-        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        t = new Tuple( 31, 0 );
+        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "00011111" +
                 "01111111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 128, 0 ) ;
-        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        t = new Tuple( 128, 0 );
+        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "00000000" +
                 "10000001" +
                 "01111111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 128, 127 ) ;
-        ArrayList list = new ArrayList() ;
-        list.add( ByteBuffer.allocate( 127 ) ) ;
-        encoded = t.toEncodedBuffer( list ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "01111111" +
+        t = new Tuple( 128, 127 );
+        ArrayList list = new ArrayList();
+        list.add( ByteBuffer.allocate( 127 ) );
+        encoded = t.toEncodedBuffer( list );
+        binary = toAsciiString( encoded );
+        assertEquals( "01111111" +
                 "00000000" +
                 "10000001" +
                 "01111111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 128, 128 ) ;
-        list.clear() ;
-        list.add( ByteBuffer.allocate( 128 ) ) ;
-        encoded = t.toEncodedBuffer( list ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "10000000" +
+        t = new Tuple( 128, 128 );
+        list.clear();
+        list.add( ByteBuffer.allocate( 128 ) );
+        encoded = t.toEncodedBuffer( list );
+        binary = toAsciiString( encoded );
+        assertEquals( "10000000" +
                 "10000001" +
                 "00000000" +
                 "10000001" +
                 "01111111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 128, 255 ) ;
-        list.clear() ;
-        list.add( ByteBuffer.allocate( 255 ) ) ;
-        encoded = t.toEncodedBuffer( list ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "11111111" +
+        t = new Tuple( 128, 255 );
+        list.clear();
+        list.add( ByteBuffer.allocate( 255 ) );
+        encoded = t.toEncodedBuffer( list );
+        binary = toAsciiString( encoded );
+        assertEquals( "11111111" +
                 "10000001" +
                 "00000000" +
                 "10000001" +
                 "01111111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 128, 256 ) ;
-        list.clear() ;
-        list.add( ByteBuffer.allocate( 256 ) ) ;
-        encoded = t.toEncodedBuffer( list ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000001" +
+        t = new Tuple( 128, 256 );
+        list.clear();
+        list.add( ByteBuffer.allocate( 256 ) );
+        encoded = t.toEncodedBuffer( list );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000001" +
                 "00000000" +
                 "10000010" +
                 "00000000" +
                 "10000001" +
                 "01111111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
     }
 
     public void testToEncodedBufferPrimitive()
     {
-        Tuple t = null ;
-        ByteBuffer encoded ;
-        byte[] data ;
-        String binary ;
-        
-        t = new Tuple( 0, 0, true, TypeClass.APPLICATION ) ;
-        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        Tuple t = null;
+        ByteBuffer encoded;
+        byte[] data;
+        String binary;
+
+        t = new Tuple( 0, 0, true, TypeClass.APPLICATION );
+        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "01000000"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 2, 0, true, TypeClass.APPLICATION ) ;
-        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        t = new Tuple( 2, 0, true, TypeClass.APPLICATION );
+        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "01000010"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 30, 0, true, TypeClass.APPLICATION ) ;
-        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        t = new Tuple( 30, 0, true, TypeClass.APPLICATION );
+        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "01011110"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 31, 0, true, TypeClass.APPLICATION ) ;
-        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        t = new Tuple( 31, 0, true, TypeClass.APPLICATION );
+        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "00011111" +
                 "01011111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        t = new Tuple( 128, 0, true, TypeClass.APPLICATION ) ;
-        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        t = new Tuple( 128, 0, true, TypeClass.APPLICATION );
+        encoded = t.toEncodedBuffer( Collections.EMPTY_LIST );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "00000000" +
                 "10000001" +
                 "01011111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        data = new byte[1] ;
-        t = new Tuple( 128, 1, true, TypeClass.APPLICATION ) ;
-        ArrayList list = new ArrayList() ;
-        list.add( ByteBuffer.wrap( data ) ) ;
-        encoded = t.toEncodedBuffer( list ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( 
-                "00000000" +
+        data = new byte[1];
+        t = new Tuple( 128, 1, true, TypeClass.APPLICATION );
+        ArrayList list = new ArrayList();
+        list.add( ByteBuffer.wrap( data ) );
+        encoded = t.toEncodedBuffer( list );
+        binary = toAsciiString( encoded );
+        assertEquals( "00000000" +
                 "00000001" +
                 "00000000" +
                 "10000001" +
                 "01011111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        data = new byte[127] ;
-        t = new Tuple( 128, 127, true, TypeClass.APPLICATION ) ;
-        list.clear() ;
-        list.add( ByteBuffer.wrap( data ) ) ;
-        encoded = t.toEncodedBuffer( list ) ;
-        binary = toAsciiString( encoded ) ;
+        data = new byte[127];
+        t = new Tuple( 128, 127, true, TypeClass.APPLICATION );
+        list.clear();
+        list.add( ByteBuffer.wrap( data ) );
+        encoded = t.toEncodedBuffer( list );
+        binary = toAsciiString( encoded );
         assertEquals( Binary.toAsciiString( data ) +
                 "01111111" +
                 "00000000" +
                 "10000001" +
                 "01011111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        data = new byte[128] ;
-        t = new Tuple( 128, 128, true, TypeClass.APPLICATION ) ;
-        list.clear() ;
-        list.add( ByteBuffer.wrap( data ) ) ;
-        encoded = t.toEncodedBuffer( list ) ;
-        binary = toAsciiString( encoded ) ;
+        data = new byte[128];
+        t = new Tuple( 128, 128, true, TypeClass.APPLICATION );
+        list.clear();
+        list.add( ByteBuffer.wrap( data ) );
+        encoded = t.toEncodedBuffer( list );
+        binary = toAsciiString( encoded );
         assertEquals( Binary.toAsciiString( data ) +
                 "10000000" +
                 "10000001" +
                 "00000000" +
                 "10000001" +
                 "01011111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        data = new byte[255] ;
-        t = new Tuple( 128, 255, true, TypeClass.APPLICATION ) ;
-        list.clear() ;
-        list.add( ByteBuffer.wrap( data ) ) ;
-        encoded = t.toEncodedBuffer( list ) ;
-        binary = toAsciiString( encoded ) ;
+        data = new byte[255];
+        t = new Tuple( 128, 255, true, TypeClass.APPLICATION );
+        list.clear();
+        list.add( ByteBuffer.wrap( data ) );
+        encoded = t.toEncodedBuffer( list );
+        binary = toAsciiString( encoded );
         assertEquals( Binary.toAsciiString( data ) +
                 "11111111" +
                 "10000001" +
                 "00000000" +
                 "10000001" +
                 "01011111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
 
-        data = new byte[256] ;
-        t = new Tuple( 128, 256, true, TypeClass.APPLICATION ) ;
-        list.clear() ;
-        list.add( ByteBuffer.wrap( data ) ) ;
-        encoded = t.toEncodedBuffer( list ) ;
-        binary = toAsciiString( encoded ) ;
-        assertEquals( Binary.toAsciiString( data ) + 
+        data = new byte[256];
+        t = new Tuple( 128, 256, true, TypeClass.APPLICATION );
+        list.clear();
+        list.add( ByteBuffer.wrap( data ) );
+        encoded = t.toEncodedBuffer( list );
+        binary = toAsciiString( encoded );
+        assertEquals( Binary.toAsciiString( data ) +
                 "00000001" +
                 "00000000" +
                 "10000010" +
                 "00000000" +
                 "10000001" +
                 "01011111"
-                , toAsciiString( encoded ) ) ;
+                , toAsciiString( encoded ) );
     }
 
-    
+
     public String toAsciiString( ByteBuffer buf )
     {
-        return Binary.toAsciiString( buf.array() ) ;
+        return Binary.toAsciiString( buf.array() );
     }
-    
-    
+
+
     public void testSetTagBufferint()
     {
-        ByteBuffer bites = ByteBuffer.allocate( 1 ) ;
-        Tuple t = new Tuple( 0, 0 ) ;
-        t.setTag( bites, 1 ) ;
-        String binary = toAsciiString( bites ) ;
-        assertEquals( "01100000", binary ) ;
-        
-        bites = ByteBuffer.allocate( 1 ) ;
-        t = new Tuple( 30, 0 ) ;
-        t.setTag( bites, 1 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111110", binary ) ;
-
-        bites = ByteBuffer.allocate( 1 ) ;
-        t = new Tuple( 30, 0 ) ;
-        t.isPrimitive = true ;
-        t.setTag( bites, 1 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01011110", binary ) ;
-
-        bites = ByteBuffer.allocate( 2 ) ;
-        t = new Tuple( 31, 0 ) ;
-        t.setTag( bites, 2 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "00011111" + "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 2 ) ;
-        t = new Tuple( 127, 0 ) ;
-        t.setTag( bites, 2 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111111" + "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 3 ) ;
-        t = new Tuple( 128, 0 ) ;
-        t.setTag( bites, 3 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "00000000" + "10000001" + "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 3 ) ;
-        t = new Tuple( BIT_13 - 1, 0 ) ;
-        t.setTag( bites, 3 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111111" + 
-                      "11111111" + 
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( BIT_13, 0 ) ;
-        t.setTag( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
+        ByteBuffer bites = ByteBuffer.allocate( 1 );
+        Tuple t = new Tuple( 0, 0 );
+        t.setTag( bites, 1 );
+        String binary = toAsciiString( bites );
+        assertEquals( "01100000", binary );
+
+        bites = ByteBuffer.allocate( 1 );
+        t = new Tuple( 30, 0 );
+        t.setTag( bites, 1 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111110", binary );
+
+        bites = ByteBuffer.allocate( 1 );
+        t = new Tuple( 30, 0 );
+        t.isPrimitive = true;
+        t.setTag( bites, 1 );
+        binary = toAsciiString( bites );
+        assertEquals( "01011110", binary );
+
+        bites = ByteBuffer.allocate( 2 );
+        t = new Tuple( 31, 0 );
+        t.setTag( bites, 2 );
+        binary = toAsciiString( bites );
+        assertEquals( "00011111" + "01111111", binary );
+
+        bites = ByteBuffer.allocate( 2 );
+        t = new Tuple( 127, 0 );
+        t.setTag( bites, 2 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111111" + "01111111", binary );
+
+        bites = ByteBuffer.allocate( 3 );
+        t = new Tuple( 128, 0 );
+        t.setTag( bites, 3 );
+        binary = toAsciiString( bites );
+        assertEquals( "00000000" + "10000001" + "01111111", binary );
+
+        bites = ByteBuffer.allocate( 3 );
+        t = new Tuple( BIT_13 - 1, 0 );
+        t.setTag( bites, 3 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111111" +
+                "11111111" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( BIT_13, 0 );
+        t.setTag( bites, 4 );
+        binary = toAsciiString( bites );
         assertEquals( "00000000" +
-                      "10000000" +
-                      "10000001" +
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( BIT_13 + 1, 0 ) ;
-        t.setTag( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
+                "10000000" +
+                "10000001" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( BIT_13 + 1, 0 );
+        t.setTag( bites, 4 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "10000000" +
-                      "10000001" + 
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( BIT_20 - 1, 0 ) ;
-        t.setTag( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111111" + 
-                      "11111111" + 
-                      "11111111" + 
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( BIT_20, 0 ) ;
-        t.setTag( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
+                "10000000" +
+                "10000001" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( BIT_20 - 1, 0 );
+        t.setTag( bites, 4 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111111" +
+                "11111111" +
+                "11111111" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( BIT_20, 0 );
+        t.setTag( bites, 5 );
+        binary = toAsciiString( bites );
         assertEquals( "00000000" +
-                      "10000000" +
-                      "10000000" +
-                      "10000001" +
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( BIT_20 + 1, 0 ) ;
-        t.setTag( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
+                "10000000" +
+                "10000000" +
+                "10000001" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( BIT_20 + 1, 0 );
+        t.setTag( bites, 5 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "10000000" +
-                      "10000000" +
-                      "10000001" + 
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( BIT_27 - 1, 0 ) ;
-        t.setTag( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111111" + 
-                      "11111111" + 
-                      "11111111" + 
-                      "11111111" + 
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 6 ) ;
-        t = new Tuple( BIT_27, 0 ) ;
-        
+                "10000000" +
+                "10000000" +
+                "10000001" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( BIT_27 - 1, 0 );
+        t.setTag( bites, 5 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111111" +
+                "11111111" +
+                "11111111" +
+                "11111111" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 6 );
+        t = new Tuple( BIT_27, 0 );
+
         try
         {
-            t.setTag( bites, 6 ) ;
-            fail( "should never reach this point due to thrown exception" ) ;
+            t.setTag( bites, 6 );
+            fail( "should never reach this point due to thrown exception" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 
     public void testSetTagbyteArrayint()
     {
-        ByteBuffer bites = ByteBuffer.allocate( 1 ) ;
-        Tuple t = new Tuple( 0, 0 ) ;
-        t.setTag( bites, 1 ) ;
-        String binary = toAsciiString( bites ) ;
-        assertEquals( "01100000", binary ) ;
-        
-        bites = ByteBuffer.allocate( 1 ) ;
-        t = new Tuple( 30, 0 ) ;
-        t.setTag( bites, 1 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111110", binary ) ;
-
-        bites = ByteBuffer.allocate( 1 ) ;
-        t = new Tuple( 30, 0 ) ;
-        t.isPrimitive = true ;
-        t.setTag( bites, 1 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01011110", binary ) ;
-
-        bites = ByteBuffer.allocate( 2 ) ;
-        t = new Tuple( 31, 0 ) ;
-        t.setTag( bites, 2 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "00011111" + "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 2 ) ;
-        t = new Tuple( 127, 0 ) ;
-        t.setTag( bites, 2 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111111" + "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 3 ) ;
-        t = new Tuple( 128, 0 ) ;
-        t.setTag( bites, 3 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "00000000" + "10000001" + "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 3 ) ;
-        t = new Tuple( BIT_13 - 1, 0 ) ;
-        t.setTag( bites, 3 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111111" + 
-                      "11111111" + 
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( BIT_13, 0 ) ;
-        t.setTag( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
+        ByteBuffer bites = ByteBuffer.allocate( 1 );
+        Tuple t = new Tuple( 0, 0 );
+        t.setTag( bites, 1 );
+        String binary = toAsciiString( bites );
+        assertEquals( "01100000", binary );
+
+        bites = ByteBuffer.allocate( 1 );
+        t = new Tuple( 30, 0 );
+        t.setTag( bites, 1 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111110", binary );
+
+        bites = ByteBuffer.allocate( 1 );
+        t = new Tuple( 30, 0 );
+        t.isPrimitive = true;
+        t.setTag( bites, 1 );
+        binary = toAsciiString( bites );
+        assertEquals( "01011110", binary );
+
+        bites = ByteBuffer.allocate( 2 );
+        t = new Tuple( 31, 0 );
+        t.setTag( bites, 2 );
+        binary = toAsciiString( bites );
+        assertEquals( "00011111" + "01111111", binary );
+
+        bites = ByteBuffer.allocate( 2 );
+        t = new Tuple( 127, 0 );
+        t.setTag( bites, 2 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111111" + "01111111", binary );
+
+        bites = ByteBuffer.allocate( 3 );
+        t = new Tuple( 128, 0 );
+        t.setTag( bites, 3 );
+        binary = toAsciiString( bites );
+        assertEquals( "00000000" + "10000001" + "01111111", binary );
+
+        bites = ByteBuffer.allocate( 3 );
+        t = new Tuple( BIT_13 - 1, 0 );
+        t.setTag( bites, 3 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111111" +
+                "11111111" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( BIT_13, 0 );
+        t.setTag( bites, 4 );
+        binary = toAsciiString( bites );
         assertEquals( "00000000" +
-                      "10000000" +
-                      "10000001" +
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( BIT_13 + 1, 0 ) ;
-        t.setTag( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
+                "10000000" +
+                "10000001" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( BIT_13 + 1, 0 );
+        t.setTag( bites, 4 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "10000000" +
-                      "10000001" + 
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( BIT_20 - 1, 0 ) ;
-        t.setTag( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111111" + 
-                      "11111111" + 
-                      "11111111" + 
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( BIT_20, 0 ) ;
-        t.setTag( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
+                "10000000" +
+                "10000001" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( BIT_20 - 1, 0 );
+        t.setTag( bites, 4 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111111" +
+                "11111111" +
+                "11111111" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( BIT_20, 0 );
+        t.setTag( bites, 5 );
+        binary = toAsciiString( bites );
         assertEquals( "00000000" +
-                      "10000000" +
-                      "10000000" +
-                      "10000001" +
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( BIT_20 + 1, 0 ) ;
-        t.setTag( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
+                "10000000" +
+                "10000000" +
+                "10000001" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( BIT_20 + 1, 0 );
+        t.setTag( bites, 5 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "10000000" +
-                      "10000000" +
-                      "10000001" + 
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( BIT_27 - 1, 0 ) ;
-        t.setTag( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111111" + 
-                      "11111111" + 
-                      "11111111" + 
-                      "11111111" + 
-                      "01111111", binary ) ;
-
-        bites = ByteBuffer.allocate( 6 ) ;
-        t = new Tuple( BIT_27, 0 ) ;
-        
+                "10000000" +
+                "10000000" +
+                "10000001" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( BIT_27 - 1, 0 );
+        t.setTag( bites, 5 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111111" +
+                "11111111" +
+                "11111111" +
+                "11111111" +
+                "01111111", binary );
+
+        bites = ByteBuffer.allocate( 6 );
+        t = new Tuple( BIT_27, 0 );
+
         try
         {
-            t.setTag( bites, 6 ) ;
-            fail( "should never reach this point due to thrown exception" ) ;
+            t.setTag( bites, 6 );
+            fail( "should never reach this point due to thrown exception" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
-    
-    
+
+
     String toAsciiString( int raw )
     {
-        byte[] intBytes = new byte[4] ;
-        intBytes[0] = (byte) ( (int) 0x000000ff & raw ) ;
-        intBytes[1] = (byte) ( (int) ( 0x0000ff00 & raw ) >> 8 ) ;
-        intBytes[2] = (byte) ( (int) ( 0x00ff0000 & raw ) >> 16 ) ;
-        intBytes[3] = (byte) ( (int) ( 0xff000000 & raw ) >> 24 ) ;
-        
-        return Binary.toAsciiString( intBytes ) ;
+        byte[] intBytes = new byte[4];
+        intBytes[0] = (byte) ( (int) 0x000000ff & raw );
+        intBytes[1] = (byte) ( (int) ( 0x0000ff00 & raw ) >> 8 );
+        intBytes[2] = (byte) ( (int) ( 0x00ff0000 & raw ) >> 16 );
+        intBytes[3] = (byte) ( (int) ( 0xff000000 & raw ) >> 24 );
+
+        return Binary.toAsciiString( intBytes );
     }
-    
+
 
     public void testSetLengthBuffer()
     {
-        ByteBuffer bites = ByteBuffer.allocate( 1 ) ;
-        Tuple t = new Tuple( 0, 0 ) ;
-        t.setLength( bites, 1 ) ;
-        String binary = toAsciiString( bites ) ;
-        assertEquals( "00000000", binary ) ;
-
-        bites = ByteBuffer.allocate( 1 ) ;
-        t = new Tuple( 30, 15 ) ;
-        t.setLength( bites, 1 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "00001111", binary ) ;
-
-        bites = ByteBuffer.allocate( 1 ) ;
-        t = new Tuple( 30, 127 ) ;
-        t.setLength( bites, 1 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111111", binary ) ;
-        
-        bites = ByteBuffer.allocate( 2 ) ;
-        t = new Tuple( 30, 128 ) ;
-        t.setLength( bites, 2 ) ;
-        binary = toAsciiString( bites ) ;
+        ByteBuffer bites = ByteBuffer.allocate( 1 );
+        Tuple t = new Tuple( 0, 0 );
+        t.setLength( bites, 1 );
+        String binary = toAsciiString( bites );
+        assertEquals( "00000000", binary );
+
+        bites = ByteBuffer.allocate( 1 );
+        t = new Tuple( 30, 15 );
+        t.setLength( bites, 1 );
+        binary = toAsciiString( bites );
+        assertEquals( "00001111", binary );
+
+        bites = ByteBuffer.allocate( 1 );
+        t = new Tuple( 30, 127 );
+        t.setLength( bites, 1 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111111", binary );
+
+        bites = ByteBuffer.allocate( 2 );
+        t = new Tuple( 30, 128 );
+        t.setLength( bites, 2 );
+        binary = toAsciiString( bites );
         assertEquals( "10000000" +
-                      "10000001", binary ) ;
-        
-        bites = ByteBuffer.allocate( 2 ) ;
-        t = new Tuple( 30, 255 ) ;
-        t.setLength( bites, 2 ) ;
-        binary = toAsciiString( bites ) ;
+                "10000001", binary );
+
+        bites = ByteBuffer.allocate( 2 );
+        t = new Tuple( 30, 255 );
+        t.setLength( bites, 2 );
+        binary = toAsciiString( bites );
         assertEquals( "11111111" +
-                      "10000001", binary ) ;
-        
-        bites = ByteBuffer.allocate( 3 ) ;
-        t = new Tuple( 30, 256 ) ;
-        t.setLength( bites, 3 ) ;
-        binary = toAsciiString( bites ) ;
+                "10000001", binary );
+
+        bites = ByteBuffer.allocate( 3 );
+        t = new Tuple( 30, 256 );
+        t.setLength( bites, 3 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "00000000" +
-                      "10000010", binary ) ;
-        
-        bites = ByteBuffer.allocate( 3 ) ;
-        t = new Tuple( 30, BIT_15 - 1 ) ;
-        t.setLength( bites, 3 ) ;
-        binary = toAsciiString( bites ) ;
+                "00000000" +
+                "10000010", binary );
+
+        bites = ByteBuffer.allocate( 3 );
+        t = new Tuple( 30, BIT_15 - 1 );
+        t.setLength( bites, 3 );
+        binary = toAsciiString( bites );
         assertEquals( "11111111" +
-                      "11111111" +
-                      "10000010", binary ) ;
-        
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( 30, BIT_15 ) ;
-        t.setLength( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
+                "11111111" +
+                "10000010", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( 30, BIT_15 );
+        t.setLength( bites, 4 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "00000000" +
-                      "00000000" +
-                      "10000011", binary ) ;
-        
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( 30, BIT_15 + 1 ) ;
-        t.setLength( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
+                "00000000" +
+                "00000000" +
+                "10000011", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( 30, BIT_15 + 1 );
+        t.setLength( bites, 4 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "00000000" +
-                      "00000001" +
-                      "10000011", binary ) ;
-        
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( 30, BIT_23 - 1 ) ;
-        t.setLength( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
+                "00000000" +
+                "00000001" +
+                "10000011", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( 30, BIT_23 - 1 );
+        t.setLength( bites, 4 );
+        binary = toAsciiString( bites );
         assertEquals( "11111111" +
-                      "11111111" +
-                      "11111111" +
-                      "10000011", binary ) ;
-        
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( 30, BIT_23 ) ;
-        t.setLength( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
+                "11111111" +
+                "11111111" +
+                "10000011", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( 30, BIT_23 );
+        t.setLength( bites, 5 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "00000000" +
-                      "00000000" +
-                      "00000000" +
-                      "10000100", binary ) ;
-        
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( 30, BIT_23 + 1 ) ;
-        t.setLength( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
+                "00000000" +
+                "00000000" +
+                "00000000" +
+                "10000100", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( 30, BIT_23 + 1 );
+        t.setLength( bites, 5 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "00000000" +
-                      "00000000" +
-                      "00000001" +
-                      "10000100", binary ) ;
-        
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( 30, Integer.MAX_VALUE ) ;
-        t.setLength( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
+                "00000000" +
+                "00000000" +
+                "00000001" +
+                "10000100", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( 30, Integer.MAX_VALUE );
+        t.setLength( bites, 5 );
+        binary = toAsciiString( bites );
         assertEquals( toAsciiString( Integer.MAX_VALUE ) +
-                      "10000100", binary ) ;
-        
-        
-        bites = ByteBuffer.allocate( 6 ) ;
-        t = new Tuple( 30, Integer.MAX_VALUE + 1 ) ;
+                "10000100", binary );
+
+
+        bites = ByteBuffer.allocate( 6 );
+        t = new Tuple( 30, Integer.MAX_VALUE + 1 );
 
         try
         {
-            t.setLength( bites, 6 ) ;
-            fail( "should never get here due to thrown exception" ) ;
+            t.setLength( bites, 6 );
+            fail( "should never get here due to thrown exception" );
         }
-        catch( IllegalArgumentException e ) 
+        catch ( IllegalArgumentException e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 
     public void testSetLengthbyteArrayintint()
     {
-        ByteBuffer bites = ByteBuffer.allocate( 1 ) ;
-        Tuple t = new Tuple( 0, 0 ) ;
-        t.setLength( bites, 1 ) ;
-        String binary = toAsciiString( bites ) ;
-        assertEquals( "00000000", binary ) ;
-
-        bites = ByteBuffer.allocate( 1 ) ;
-        t = new Tuple( 30, 15 ) ;
-        t.setLength( bites, 1 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "00001111", binary ) ;
-
-        bites = ByteBuffer.allocate( 1 ) ;
-        t = new Tuple( 30, 127 ) ;
-        t.setLength( bites, 1 ) ;
-        binary = toAsciiString( bites ) ;
-        assertEquals( "01111111", binary ) ;
-        
-        bites = ByteBuffer.allocate( 2 ) ;
-        t = new Tuple( 30, 128 ) ;
-        t.setLength( bites, 2 ) ;
-        binary = toAsciiString( bites ) ;
+        ByteBuffer bites = ByteBuffer.allocate( 1 );
+        Tuple t = new Tuple( 0, 0 );
+        t.setLength( bites, 1 );
+        String binary = toAsciiString( bites );
+        assertEquals( "00000000", binary );
+
+        bites = ByteBuffer.allocate( 1 );
+        t = new Tuple( 30, 15 );
+        t.setLength( bites, 1 );
+        binary = toAsciiString( bites );
+        assertEquals( "00001111", binary );
+
+        bites = ByteBuffer.allocate( 1 );
+        t = new Tuple( 30, 127 );
+        t.setLength( bites, 1 );
+        binary = toAsciiString( bites );
+        assertEquals( "01111111", binary );
+
+        bites = ByteBuffer.allocate( 2 );
+        t = new Tuple( 30, 128 );
+        t.setLength( bites, 2 );
+        binary = toAsciiString( bites );
         assertEquals( "10000000" +
-                      "10000001", binary ) ;
-        
-        bites = ByteBuffer.allocate( 2 ) ;
-        t = new Tuple( 30, 255 ) ;
-        t.setLength( bites, 2 ) ;
-        binary = toAsciiString( bites ) ;
+                "10000001", binary );
+
+        bites = ByteBuffer.allocate( 2 );
+        t = new Tuple( 30, 255 );
+        t.setLength( bites, 2 );
+        binary = toAsciiString( bites );
         assertEquals( "11111111" +
-                      "10000001", binary ) ;
-        
-        bites = ByteBuffer.allocate( 3 ) ;
-        t = new Tuple( 30, 256 ) ;
-        t.setLength( bites, 3 ) ;
-        binary = toAsciiString( bites ) ;
+                "10000001", binary );
+
+        bites = ByteBuffer.allocate( 3 );
+        t = new Tuple( 30, 256 );
+        t.setLength( bites, 3 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "00000000" +
-                      "10000010", binary ) ;
-        
-        bites = ByteBuffer.allocate( 3 ) ;
-        t = new Tuple( 30, BIT_15 - 1 ) ;
-        t.setLength( bites, 3 ) ;
-        binary = toAsciiString( bites ) ;
+                "00000000" +
+                "10000010", binary );
+
+        bites = ByteBuffer.allocate( 3 );
+        t = new Tuple( 30, BIT_15 - 1 );
+        t.setLength( bites, 3 );
+        binary = toAsciiString( bites );
         assertEquals( "11111111" +
-                      "11111111" +
-                      "10000010", binary ) ;
-        
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( 30, BIT_15 ) ;
-        t.setLength( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
+                "11111111" +
+                "10000010", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( 30, BIT_15 );
+        t.setLength( bites, 4 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "00000000" +
-                      "00000000" +
-                      "10000011", binary ) ;
-        
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( 30, BIT_15 + 1 ) ;
-        t.setLength( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
+                "00000000" +
+                "00000000" +
+                "10000011", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( 30, BIT_15 + 1 );
+        t.setLength( bites, 4 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "00000000" +
-                      "00000001" +
-                      "10000011", binary ) ;
-        
-        bites = ByteBuffer.allocate( 4 ) ;
-        t = new Tuple( 30, BIT_23 - 1 ) ;
-        t.setLength( bites, 4 ) ;
-        binary = toAsciiString( bites ) ;
+                "00000000" +
+                "00000001" +
+                "10000011", binary );
+
+        bites = ByteBuffer.allocate( 4 );
+        t = new Tuple( 30, BIT_23 - 1 );
+        t.setLength( bites, 4 );
+        binary = toAsciiString( bites );
         assertEquals( "11111111" +
-                      "11111111" +
-                      "11111111" +
-                      "10000011", binary ) ;
-        
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( 30, BIT_23 ) ;
-        t.setLength( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
+                "11111111" +
+                "11111111" +
+                "10000011", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( 30, BIT_23 );
+        t.setLength( bites, 5 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "00000000" +
-                      "00000000" +
-                      "00000000" +
-                      "10000100", binary ) ;
-        
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( 30, BIT_23 + 1 ) ;
-        t.setLength( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
+                "00000000" +
+                "00000000" +
+                "00000000" +
+                "10000100", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( 30, BIT_23 + 1 );
+        t.setLength( bites, 5 );
+        binary = toAsciiString( bites );
         assertEquals( "00000001" +
-                      "00000000" +
-                      "00000000" +
-                      "00000001" +
-                      "10000100", binary ) ;
-        
-        bites = ByteBuffer.allocate( 5 ) ;
-        t = new Tuple( 30, Integer.MAX_VALUE ) ;
-        t.setLength( bites, 5 ) ;
-        binary = toAsciiString( bites ) ;
+                "00000000" +
+                "00000000" +
+                "00000001" +
+                "10000100", binary );
+
+        bites = ByteBuffer.allocate( 5 );
+        t = new Tuple( 30, Integer.MAX_VALUE );
+        t.setLength( bites, 5 );
+        binary = toAsciiString( bites );
         assertEquals( toAsciiString( Integer.MAX_VALUE ) +
-                      "10000100", binary ) ;
-        
-        
-        bites = ByteBuffer.allocate( 6 ) ;
-        t = new Tuple( 30, Integer.MAX_VALUE + 1 ) ;
+                "10000100", binary );
+
+
+        bites = ByteBuffer.allocate( 6 );
+        t = new Tuple( 30, Integer.MAX_VALUE + 1 );
 
         try
         {
-            t.setLength( bites, 6 ) ;
-            fail( "should never get here due to thrown exception" ) ;
+            t.setLength( bites, 6 );
+            fail( "should never get here due to thrown exception" );
         }
-        catch( IllegalArgumentException e ) 
+        catch ( IllegalArgumentException e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 
     public void testGetTagLength()
     {
-        Tuple t = new Tuple() ;
-        assertEquals( 1, t.getTagLength() ) ;
-        t.id = 30 ;
-        assertEquals( 1, t.getTagLength() ) ;
-        t.id = 31 ;
-        assertEquals( 2, t.getTagLength() ) ;
-        t.id = 100 ;
-        assertEquals( 3, t.getTagLength() ) ;
-        t.id = 127 ;
-        assertEquals( 3, t.getTagLength() ) ;
-        t.id = 128 ;
-        assertEquals( 3, t.getTagLength() ) ;
-        t.id = 129 ;
-        assertEquals( 3, t.getTagLength() ) ;
-
-        t.id = BIT_13 - 1 ;
-        assertEquals( 3, t.getTagLength() ) ;
-        t.id = BIT_13 ;
-        assertEquals( 4, t.getTagLength() ) ;
-        t.id = BIT_13 + 100 ;
-        assertEquals( 4, t.getTagLength() ) ;
-        
-        t.id = BIT_20 - 1 ;
-        assertEquals( 4, t.getTagLength() ) ;
-        t.id = BIT_20 ;
-        assertEquals( 5, t.getTagLength() ) ;
-        t.id = BIT_20 + 100 ;
-        assertEquals( 5, t.getTagLength() ) ;
+        Tuple t = new Tuple();
+        assertEquals( 1, t.getTagLength() );
+        t.id = 30;
+        assertEquals( 1, t.getTagLength() );
+        t.id = 31;
+        assertEquals( 2, t.getTagLength() );
+        t.id = 100;
+        assertEquals( 3, t.getTagLength() );
+        t.id = 127;
+        assertEquals( 3, t.getTagLength() );
+        t.id = 128;
+        assertEquals( 3, t.getTagLength() );
+        t.id = 129;
+        assertEquals( 3, t.getTagLength() );
+
+        t.id = BIT_13 - 1;
+        assertEquals( 3, t.getTagLength() );
+        t.id = BIT_13;
+        assertEquals( 4, t.getTagLength() );
+        t.id = BIT_13 + 100;
+        assertEquals( 4, t.getTagLength() );
+
+        t.id = BIT_20 - 1;
+        assertEquals( 4, t.getTagLength() );
+        t.id = BIT_20;
+        assertEquals( 5, t.getTagLength() );
+        t.id = BIT_20 + 100;
+        assertEquals( 5, t.getTagLength() );
+
+        t.id = BIT_27 - 1;
+        assertEquals( 5, t.getTagLength() );
 
-        t.id = BIT_27 - 1 ;
-        assertEquals( 5, t.getTagLength() ) ;
+        t.id = BIT_27;
 
-        t.id = BIT_27 ;
-        
         try
         {
-            assertEquals( 6, t.getTagLength() ) ;
-            fail( "should throw an exception before getting here" ) ;
+            assertEquals( 6, t.getTagLength() );
+            fail( "should throw an exception before getting here" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
     }
 
     public void testGetLengthLength()
     {
-        Tuple t = new Tuple() ;
-        assertEquals( 1, t.getLengthLength() ) ;
-        t.length = 127 ;
-        assertEquals( 1, t.getLengthLength() ) ;
-        t.length = 128 ;
-        assertEquals( 2, t.getLengthLength() ) ;
-        t.length = 255 ;
-        assertEquals( 2, t.getLengthLength() ) ;
-        t.length = 256 ;
-        assertEquals( 3, t.getLengthLength() ) ;
-
-        t.length = BIT_15 - 1 ;
-        assertEquals( 3, t.getLengthLength() ) ;
-        t.length = BIT_15 ;
-        assertEquals( 4, t.getLengthLength() ) ;
-        t.length = BIT_15 + 100 ;
-        assertEquals( 4, t.getLengthLength() ) ;
-        
-        t.length = BIT_23 - 1 ;
-        assertEquals( 4, t.getLengthLength() ) ;
-        t.length = BIT_23 ;
-        assertEquals( 5, t.getLengthLength() ) ;
-        t.length = BIT_23 + 100 ;
-        assertEquals( 5, t.getLengthLength() ) ;
+        Tuple t = new Tuple();
+        assertEquals( 1, t.getLengthLength() );
+        t.length = 127;
+        assertEquals( 1, t.getLengthLength() );
+        t.length = 128;
+        assertEquals( 2, t.getLengthLength() );
+        t.length = 255;
+        assertEquals( 2, t.getLengthLength() );
+        t.length = 256;
+        assertEquals( 3, t.getLengthLength() );
+
+        t.length = BIT_15 - 1;
+        assertEquals( 3, t.getLengthLength() );
+        t.length = BIT_15;
+        assertEquals( 4, t.getLengthLength() );
+        t.length = BIT_15 + 100;
+        assertEquals( 4, t.getLengthLength() );
+
+        t.length = BIT_23 - 1;
+        assertEquals( 4, t.getLengthLength() );
+        t.length = BIT_23;
+        assertEquals( 5, t.getLengthLength() );
+        t.length = BIT_23 + 100;
+        assertEquals( 5, t.getLengthLength() );
 
-        t.length = Integer.MAX_VALUE ;
-        assertEquals( 5, t.getLengthLength() ) ;
+        t.length = Integer.MAX_VALUE;
+        assertEquals( 5, t.getLengthLength() );
 
-        
-        t.length = Integer.MAX_VALUE + 1 ;
+
+        t.length = Integer.MAX_VALUE + 1;
         try
         {
-            assertEquals( 6, t.getLengthLength() ) ;
-            fail( "should throw an exception before getting here" ) ;
+            assertEquals( 6, t.getLengthLength() );
+            fail( "should throw an exception before getting here" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
-            assertNotNull( e ) ;
+            assertNotNull( e );
         }
-        
+
     }
 }

Modified: incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TypeClassTest.java
==============================================================================
--- incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TypeClassTest.java	(original)
+++ incubator/directory/snickers/branches/ber-decoder/modules/runtime/src/test/org/apache/snickers/encoding/ber/TypeClassTest.java	Sat Jul 10 11:54:20 2004
@@ -14,28 +14,28 @@
  *   limitations under the License.
  *
  */
-package org.apache.snickers.ber ;
+package org.apache.snickers.encoding.ber;
 
 
 import java.util.List;
 import java.util.Map;
 
-import junit.framework.TestCase ;
+import junit.framework.TestCase;
 
 
 /**
  * Tests TypeClass class.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ *         Apache Directory Project</a>
  * @version $Rev$
  */
 public class TypeClassTest extends TestCase
 {
 
-    public static void main(String[] args)
+    public static void main( String[] args )
     {
-        junit.textui.TestRunner.run(TypeClassTest.class);
+        junit.textui.TestRunner.run( TypeClassTest.class );
     }
 
     /*
@@ -56,11 +56,12 @@
 
     /**
      * Constructor for TypeClassTest.
+     *
      * @param arg0
      */
-    public TypeClassTest(String arg0)
+    public TypeClassTest( String arg0 )
     {
-        super(arg0);
+        super( arg0 );
     }
 
     /*
@@ -68,55 +69,47 @@
      */
     public void testGetTypeClassString()
     {
-        assertEquals( TypeClass.APPLICATION, TypeClass.getTypeClass( 
-                        TypeClass.APPLICATION.getName() ) ) ;
-        assertEquals( TypeClass.UNIVERSAL, TypeClass.getTypeClass( 
-                        TypeClass.UNIVERSAL.getName() ) ) ;
-        assertEquals( TypeClass.PRIVATE, TypeClass.getTypeClass( 
-                        TypeClass.PRIVATE.getName() ) ) ;
-        assertEquals( TypeClass.CONTEXT_SPECIFIC, TypeClass.getTypeClass( 
-                        TypeClass.CONTEXT_SPECIFIC.getName() ) ) ;
-
-        assertEquals( TypeClass.APPLICATION, TypeClass.getTypeClass( 
-                        "application") ) ;
-        assertEquals( TypeClass.UNIVERSAL, TypeClass.getTypeClass( 
-                        "Universal" ) ) ;
-        assertEquals( TypeClass.PRIVATE, TypeClass.getTypeClass( 
-                        "PRivatE" ) ) ;
-        assertEquals( TypeClass.CONTEXT_SPECIFIC, TypeClass.getTypeClass( 
-                        "context_specific" ) ) ;
-        
+        assertEquals( TypeClass.APPLICATION, TypeClass.getTypeClass( TypeClass.APPLICATION.getName() ) );
+        assertEquals( TypeClass.UNIVERSAL, TypeClass.getTypeClass( TypeClass.UNIVERSAL.getName() ) );
+        assertEquals( TypeClass.PRIVATE, TypeClass.getTypeClass( TypeClass.PRIVATE.getName() ) );
+        assertEquals( TypeClass.CONTEXT_SPECIFIC, TypeClass.getTypeClass( TypeClass.CONTEXT_SPECIFIC.getName() ) );
+
+        assertEquals( TypeClass.APPLICATION, TypeClass.getTypeClass( "application" ) );
+        assertEquals( TypeClass.UNIVERSAL, TypeClass.getTypeClass( "Universal" ) );
+        assertEquals( TypeClass.PRIVATE, TypeClass.getTypeClass( "PRivatE" ) );
+        assertEquals( TypeClass.CONTEXT_SPECIFIC, TypeClass.getTypeClass( "context_specific" ) );
+
         try
         {
-            TypeClass.getTypeClass( "asdf" ) ;
-            fail( "exception should prevent this failure" ) ;
+            TypeClass.getTypeClass( "asdf" );
+            fail( "exception should prevent this failure" );
         }
         catch ( Throwable t )
-        { 
-            assertNotNull( t ) ;
+        {
+            assertNotNull( t );
         }
     }
 
     public void testList()
     {
-        List list = TypeClass.list() ;
-        assertNotNull( list ) ;
-        assertEquals( 4, list.size() ) ;
-        assertTrue( list.contains( TypeClass.PRIVATE ) ) ;
-        assertTrue( list.contains( TypeClass.UNIVERSAL ) ) ;
-        assertTrue( list.contains( TypeClass.APPLICATION ) ) ;
-        assertTrue( list.contains( TypeClass.CONTEXT_SPECIFIC ) ) ;
+        List list = TypeClass.list();
+        assertNotNull( list );
+        assertEquals( 4, list.size() );
+        assertTrue( list.contains( TypeClass.PRIVATE ) );
+        assertTrue( list.contains( TypeClass.UNIVERSAL ) );
+        assertTrue( list.contains( TypeClass.APPLICATION ) );
+        assertTrue( list.contains( TypeClass.CONTEXT_SPECIFIC ) );
     }
 
     public void testMap()
     {
-        Map map = TypeClass.map() ;
-        assertNotNull( map ) ;
-        assertEquals( 4, map.size() ) ;
-        assertTrue( map.containsKey( TypeClass.PRIVATE.getName() ) ) ;
-        assertTrue( map.containsKey( TypeClass.UNIVERSAL.getName() ) ) ;
-        assertTrue( map.containsKey( TypeClass.APPLICATION.getName() ) ) ;
-        assertTrue( map.containsKey( TypeClass.CONTEXT_SPECIFIC.getName() ) ) ;
+        Map map = TypeClass.map();
+        assertNotNull( map );
+        assertEquals( 4, map.size() );
+        assertTrue( map.containsKey( TypeClass.PRIVATE.getName() ) );
+        assertTrue( map.containsKey( TypeClass.UNIVERSAL.getName() ) );
+        assertTrue( map.containsKey( TypeClass.APPLICATION.getName() ) );
+        assertTrue( map.containsKey( TypeClass.CONTEXT_SPECIFIC.getName() ) );
     }
 
     /*
@@ -124,23 +117,19 @@
      */
     public void testGetTypeClassint()
     {
-        assertEquals( TypeClass.APPLICATION, TypeClass.getTypeClass( 
-                        TypeClass.APPLICATION_VAL ) ) ;
-        assertEquals( TypeClass.PRIVATE, TypeClass.getTypeClass( 
-                        TypeClass.PRIVATE_VAL ) ) ;
-        assertEquals( TypeClass.UNIVERSAL, TypeClass.getTypeClass( 
-                        TypeClass.UNIVERSAL_VAL ) ) ;
-        assertEquals( TypeClass.CONTEXT_SPECIFIC, TypeClass.getTypeClass( 
-                        TypeClass.CONTEXT_SPECIFIC_VAL ) ) ;
-        
+        assertEquals( TypeClass.APPLICATION, TypeClass.getTypeClass( TypeClass.APPLICATION_VAL ) );
+        assertEquals( TypeClass.PRIVATE, TypeClass.getTypeClass( TypeClass.PRIVATE_VAL ) );
+        assertEquals( TypeClass.UNIVERSAL, TypeClass.getTypeClass( TypeClass.UNIVERSAL_VAL ) );
+        assertEquals( TypeClass.CONTEXT_SPECIFIC, TypeClass.getTypeClass( TypeClass.CONTEXT_SPECIFIC_VAL ) );
+
         try
         {
-            TypeClass.getTypeClass( 35 ) ;
-            fail( "exception should prevent this failure" ) ;
+            TypeClass.getTypeClass( 35 );
+            fail( "exception should prevent this failure" );
         }
-        catch( Throwable t )
+        catch ( Throwable t )
         {
-            assertNotNull( t ) ;
+            assertNotNull( t );
         }
     }
 }

Mime
View raw message