directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1069589 - in /directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util: BitString.java OID.java
Date Thu, 10 Feb 2011 22:19:35 GMT
Author: elecharny
Date: Thu Feb 10 22:19:35 2011
New Revision: 1069589

URL: http://svn.apache.org/viewvc?rev=1069589&view=rev
Log:
Fixed the Javadoc

Modified:
    directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util/BitString.java
    directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util/OID.java

Modified: directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util/BitString.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util/BitString.java?rev=1069589&r1=1069588&r2=1069589&view=diff
==============================================================================
--- directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util/BitString.java
(original)
+++ directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util/BitString.java
Thu Feb 10 22:19:35 2011
@@ -6,16 +6,16 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.asn1.util;
 
@@ -28,7 +28,7 @@ import org.apache.directory.shared.i18n.
 /**
  * Implement the Bit String primitive type. A BitString is internally stored as
  * an array of byte.
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class BitString implements Serializable
@@ -55,7 +55,7 @@ public class BitString implements Serial
     /**
      * Creates a BitString with a specific length (length is the number of
      * bits).
-     * 
+     *
      * @param length The BitString length (it's a number of bits)
      */
     public BitString( int length )
@@ -85,7 +85,7 @@ public class BitString implements Serial
     /**
      * Creates a BitString from a byte[]. As the first byteis the number of unused bits
      * in the last byte, we have to ignore it.
-     * 
+     *
      * @param bytes The value to store. The first byte contains the number of
      * unused bits
      */
@@ -104,7 +104,7 @@ public class BitString implements Serial
     /**
      * Set a new BitString in the BitString. It will replace the old BitString,
      * and reset the current length with the new one.
-     * 
+     *
      * @param bytes The string to store
      */
     public void setData( byte[] bytes )
@@ -132,7 +132,7 @@ public class BitString implements Serial
     /**
      * Get the representation of a BitString. A first byte containing the number
      * of unused bits is added
-     * 
+     *
      * @return A byte array which represent the BitString
      */
     public byte[] getData()
@@ -148,7 +148,7 @@ public class BitString implements Serial
 
     /**
      * Get the number of unused bits
-     * 
+     *
      * @return A byte which represent the number of unused bits
      */
     public byte getUnusedBits()
@@ -158,10 +158,10 @@ public class BitString implements Serial
 
 
     /**
-     * Set a bit at a specified position. 
+     * Set a bit at a specified position.
      * The bits are stored from left to right.
      * For instance, if we have 10 bits, then they are coded as b0 b1 b2 b3 b4 b5 b6 b7 -
b8 b9 x x x x x x
-     * 
+     *
      * @param pos The bit to set
      */
     public void setBit( int pos )
@@ -180,11 +180,11 @@ public class BitString implements Serial
 
 
     /**
-     * Clear a bit at a specified position. 
+     * Clear a bit at a specified position.
      * The bits are stored from left to right.
-     * For instance, if we have 10 bits, then they are coded 
+     * For instance, if we have 10 bits, then they are coded
      * as b0 b1 b2 b3 b4 b5 b6 b7 - b8 b9 x x x x x x
-     * 
+     *
      * @param pos The bit to clear
      */
     public void clearBit( int pos )
@@ -203,24 +203,23 @@ public class BitString implements Serial
 
 
     /**
-     * Get the bit stored into the BitString at a specific position. 
+     * Get the bit stored into the BitString at a specific position.
      * The bits are stored from left to right, the LSB on the left and the
-     * MSB on the right
-     * For instance, if we have 10 bits, then they are coded as 
+     * MSB on the right.<br/>
+     * For instance, if we have 10 bits, then they are coded as
      * b0 b1 b2 b3 - b4 b5 b6 b7 - b8 b9 x x - x x x x
-     * 
-     * With '1001 000x', where x is an unused bit, 
-     *       ^ ^    ^ 
-     *       | |    | 
-     *       | |    |  
-     *       | |    +----- getBit(6) = 0 
-     *       | +---------- getBit(2) = 0 
+     * <pre>
+     * With '1001 000x', where x is an unused bit,
+     *       ^ ^    ^
+     *       | |    |
+     *       | |    |
+     *       | |    +----- getBit(6) = 0
+     *       | +---------- getBit(2) = 0
      *       +------------ getBit(0) = 1
-     *       
-     * @param pos The position of the requested bit.  
-     * 
-     * @return <code>true</code> if the bit is set, <code>false</code>
-     *         otherwise
+     * </pre>
+     * @param pos The position of the requested bit.
+     *
+     * @return <code>true</code> if the bit is set, <code>false</code>
otherwise
      */
     public boolean getBit( int pos )
     {
@@ -234,7 +233,7 @@ public class BitString implements Serial
         byte mask = (byte)( 1 << bitNumber );
 
         int res = bytes[posBytes] & mask;
-        
+
         return res != 0;
     }
 
@@ -250,9 +249,10 @@ public class BitString implements Serial
 
     /**
      * Return a native String representation of the BitString.
-     * 
+     *
      * @return A String representing the BitString
      */
+    @Override
     public String toString()
     {
         StringBuilder sb = new StringBuilder();

Modified: directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util/OID.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util/OID.java?rev=1069589&r1=1069588&r2=1069589&view=diff
==============================================================================
--- directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util/OID.java
(original)
+++ directory/shared/branches/m1/asn1-api/src/main/java/org/apache/directory/shared/asn1/util/OID.java
Thu Feb 10 22:19:35 2011
@@ -28,35 +28,40 @@ import org.apache.directory.shared.i18n.
 
 
 /**
- * This class implement an OID (Object Identifier).
- *
- * An OID is encoded as a list of bytes representing integers.
- *
- * An OID has a numeric representation where number are separated with dots :
- * SPNEGO Oid = 1.3.6.1.5.5.2
- *
- * Translating from a byte list to a dot separated list of number follows the rules :
- * - the first number is in [0..2]
- * - the second number is in [0..39] if the first number is 0 or 1
- * - the first byte has a value equal to : number 1 * 40 + number two
- * - the upper bit of a byte is set if the next byte is a part of the number
- *
- * For instance, the SPNEGO Oid (1.3.6.1.5.5.2) will be encoded :
+ * This class implement an OID (Object Identifier).<br/>
+ * <br/>
+ * An OID is encoded as a list of bytes representing integers.<br/>
+ * <br/>
+ * An OID has a numeric representation where number are separated with dots :<br/>
+ * SPNEGO Oid = 1.3.6.1.5.5.2<br/>
+ * <br/>
+ * Translating from a byte list to a dot separated list of number follows the rules :<br/>
+ * <ul>
+ * <li>the first number is in [0..2]</li>
+ * <li>the second number is in [0..39] if the first number is 0 or 1</li>
+ * <li>the first byte has a value equal to : number 1 * 40 + number two</li>
+ * <li>the upper bit of a byte is set if the next byte is a part of the number</li>
+ * </ul>
+ * <br/>
+ * For instance, the SPNEGO Oid (1.3.6.1.5.5.2) will be encoded :<br/>
+ * <pre>
  * 1.3 -> 0x2B (1*40 + 3 = 43 = 0x2B)
  * .6  -> 0x06
  * .1  -> 0x01
  * .5  -> 0x05
  * .5  -> 0x05
  * .2  -> 0x02
- *
- * The Kerberos V5 Oid (1.2.840.48018.1.2.2)  will be encoded :
+ * </pre>
+ * <br/>
+ * The Kerberos V5 Oid (1.2.840.48018.1.2.2)  will be encoded :<br/>
+ * <pre>
  * 1.2   -> 0x2A (1*40 + 2 = 42 = 0x2A)
  * 840   -> 0x86 0x48 (840 = 6 * 128 + 72 = (0x06 | 0x80) 0x48 = 0x86 0x48
  * 48018 -> 0x82 0xF7 0x12 (2 * 128 * 128 + 119 * 128 + 18 = (0x02 | 0x80) (0x77 | 0x80)
0x12
  * .1    -> 0x01
  * .2    -> 0x02
  * .2    -> 0x02
- *
+ * </pre>
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class OID implements Serializable
@@ -294,7 +299,7 @@ public class OID implements Serializable
                     throw new DecoderException( I18n.err( I18n.ERR_00033_INVALID_OID, oid
) );
                 }
 
-                if ( ituOrIso && value > 39 )
+                if ( ituOrIso && ( value > 39 ) )
                 {
                     throw new DecoderException( I18n.err( I18n.ERR_00033_INVALID_OID, oid
) );
                 }
@@ -596,7 +601,7 @@ public class OID implements Serializable
                     return false;
                 }
 
-                if ( ituOrIso && value > 39 )
+                if ( ituOrIso && ( value > 39 ) )
                 {
                     return false;
                 }
@@ -631,6 +636,7 @@ public class OID implements Serializable
      *
      * @return A String representing the OID
      */
+    @Override
     public String toString()
     {
         StringBuffer sb = new StringBuffer();
@@ -652,6 +658,7 @@ public class OID implements Serializable
     /**
      * {@inheritDoc}
      */
+    @Override
     public int hashCode()
     {
         return hash;
@@ -661,6 +668,7 @@ public class OID implements Serializable
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean equals( Object oid )
     {
         if ( this == oid )



Mime
View raw message