Package com.oss.asn1

Class UNSIGNED

All Implemented Interfaces:
com.oss.asn1.Comparable, Serializable, Cloneable

public class UNSIGNED extends AbstractData implements com.oss.asn1.Comparable
This class is used to represent non-negative (unsigned) 64-bit integer numbers.
Since:
ASN.1/Java 6.0
See Also:
  • Field Summary

    Fields inherited from class com.oss.asn1.AbstractData

    EQUALS, GREATER_THAN, LESS_THAN
  • Constructor Summary

    Constructors
    Constructor
    Description
    The default constructor.
    UNSIGNED(int value)
    Construct from an int.
    UNSIGNED(long value)
    Construct from a long.
    UNSIGNED(short value)
    Construct from a short.
    Construct from a String.
  • Method Summary

    Modifier and Type
    Method
    Description
    Compute the arithmetic sum of two numbers.
    Clone 'this' object.
    int
    Compare 'this' object to another INTEGER (signed) number to determine whether the contents of 'this' object is less than, equal to, or greater than the contents of another object.
    final int
    Compare 'this' object to another UnsignedLong object to determine whether the contents of 'this' object is less than, equal to, or greater than the contents of another object.
    Returns the result of integer division of this number by another number.
    boolean
    Compares two objects for equality.
    final boolean
    Compare 'this' object to another INTEGER object to see if their contents are the same.
    Returns the name of ASN.1 type this java class represents.
    int
    Returns a hash code for this object
    final int
    Get the value of 'this' object as an int.
    final long
    Get the value of 'this' object as a long.
    Multiplies this number by another number.
    Computes the remainder from division of this number by another number.
    final void
    setValue(int value)
    Set the value of 'this' object to a short.
    final void
    setValue(long value)
    Set the value of 'this' object to a short.
    final void
    setValue(short value)
    Set the value of 'this' object to a short.
    shiftLeft(int shift)
    Shifts this number by the specified number of bits to the left.
    shiftRight(int shift)
    Does unsigned shift of this number by the specified number of bits to the right.
    final short
    Get the value of 'this' object as a short.
    Computes the difference between two numbers.
    Converts this unsigned number to a String.

    Methods inherited from class com.oss.asn1.AbstractData

    delete, isEncodable, isPDU, isValid, toString

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • UNSIGNED

      public UNSIGNED()
      The default constructor.
    • UNSIGNED

      public UNSIGNED(short value)
      Construct from a short.
      Parameters:
      value - the short to set 'this' object to.
    • UNSIGNED

      public UNSIGNED(int value)
      Construct from an int.
      Parameters:
      value - the int to set 'this' object to.
    • UNSIGNED

      public UNSIGNED(long value)
      Construct from a long.
      Parameters:
      value - the long to set 'this' object to.
    • UNSIGNED

      public UNSIGNED(String value)
      Construct from a String.
      Parameters:
      value - the String to set 'this' object to.
  • Method Details

    • setValue

      public final void setValue(short value)
      Set the value of 'this' object to a short.
      Parameters:
      value - the short value to set 'this' object to.
    • setValue

      public final void setValue(int value)
      Set the value of 'this' object to a short.
      Parameters:
      value - the int value to set 'this' object to.
    • setValue

      public final void setValue(long value)
      Set the value of 'this' object to a short.
      Parameters:
      value - the long value to set 'this' object to.
    • shortValue

      public final short shortValue()
      Get the value of 'this' object as a short.
      Returns:
      short value of 'this' object.
    • intValue

      public final int intValue()
      Get the value of 'this' object as an int.
      Returns:
      int value of 'this' object.
    • longValue

      public final long longValue()
      Get the value of 'this' object as a long.
      Returns:
      long value of 'this' object.
    • add

      public UNSIGNED add(UNSIGNED o)
      Compute the arithmetic sum of two numbers.
      Parameters:
      o - the number to add.
      Returns:
      the result of addition of this and another numbers.
    • subtract

      public UNSIGNED subtract(UNSIGNED o)
      Computes the difference between two numbers.
      Parameters:
      o - specifies another number.
      Returns:
      the difference between the biggest of two numbers and another number.
    • multiply

      public UNSIGNED multiply(UNSIGNED o)
      Multiplies this number by another number.
      Parameters:
      o - another number
      Returns:
      the result of multiplication of this number by 'o'.
    • divide

      public UNSIGNED divide(UNSIGNED o)
      Returns the result of integer division of this number by another number.
      Parameters:
      o - specifies the number to divide by.
      Returns:
      the result of division.
    • remainder

      public UNSIGNED remainder(UNSIGNED o)
      Computes the remainder from division of this number by another number.
      Parameters:
      o - specifies another number.
      Returns:
      the remainder.
    • shiftLeft

      public UNSIGNED shiftLeft(int shift)
      Shifts this number by the specified number of bits to the left.
      Parameters:
      shift - specifies shift count.
      Returns:
      the result of the shift.
    • shiftRight

      public UNSIGNED shiftRight(int shift)
      Does unsigned shift of this number by the specified number of bits to the right.
      Parameters:
      shift - specifies the shift count.
      Returns:
      the result of the shift.
    • equalTo

      public final boolean equalTo(UNSIGNED that)
      Compare 'this' object to another INTEGER object to see if their contents are the same.
      Parameters:
      that - the INTEGER object to compare 'this' object to.
      Returns:
      true if contents of both objects are the same.
    • compareTo

      public final int compareTo(UNSIGNED that)
      Compare 'this' object to another UnsignedLong object to determine whether the contents of 'this' object is less than, equal to, or greater than the contents of another object.
      Parameters:
      that - INTEGER object that is compared with 'this' object
      Returns:
      LESS_THAN, EQUALS, GREATER_THAN values as the results of comparison.
    • compareTo

      public int compareTo(INTEGER that)
      Compare 'this' object to another INTEGER (signed) number to determine whether the contents of 'this' object is less than, equal to, or greater than the contents of another object.
      Parameters:
      that - INTEGER object that is compared with 'this' object
      Returns:
      LESS_THAN, EQUALS, GREATER_THAN values as the results of comparison.
    • toString

      public String toString()
      Converts this unsigned number to a String.
      Overrides:
      toString in class AbstractData
      Returns:
      the result of conversion.
    • equals

      public boolean equals(Object obj)
      Compares two objects for equality.
      Overrides:
      equals in class AbstractData
      Parameters:
      obj - an object to compare 'this' object with.
      Returns:
      boolean value specifying whether or not contents of 'this' and 'that' objects are equal.
    • hashCode

      public int hashCode()
      Returns a hash code for this object
      Overrides:
      hashCode in class AbstractData
      Returns:
      a hash code for this object
    • clone

      public UNSIGNED clone()
      Clone 'this' object.
      Returns:
      deep copy of 'this' object.
    • getTypeName

      public String getTypeName()
      Returns the name of ASN.1 type this java class represents.
      Overrides:
      getTypeName in class AbstractData
      Returns:
      the name of the ASN.1 type.