ch.panter.li.bi.asn.ber
Class AsnBerTagLengthImpl

java.lang.Object
  extended by ch.panter.li.bi.asn.ber.AsnBerTagLengthImpl
All Implemented Interfaces:
AsnBerTagLength

public final class AsnBerTagLengthImpl
extends Object
implements AsnBerTagLength


Constructor Summary
AsnBerTagLengthImpl()
           
AsnBerTagLengthImpl(boolean definite, int tagLength)
           
 
Method Summary
 boolean equals(Object compare)
           
 Number getTagLength()
          The tag length of this instance as an abstract number (Integer, Long, BigInteger).
 int getTagLengthAsInt()
          The tag length of this instance as a java int.
 Number getTagLengthLarge()
          The tag length bits of this instance as an abstract number (Long, BigInteger).
 int hashCode()
           
 boolean isDefinite()
           
 boolean isIndefinite()
           
 boolean isTagLengthAnInt()
          Determines whether the tag length of this instance can be represented in a java int.
 void setDefinite(boolean definite)
           
 void setIndefinite(boolean indefinite)
           
 void setTagLengthAsInt(int tagLength)
          Sets the new tag number to the given value and resets any previously set bits.
 void setTagLengthLarge(BigInteger tagLengthLarge)
          Sets the new tag number to the given abstract number.
 void setTagLengthLarge(Long tagLengthLarge)
          Sets the new tag number to the given abstract number.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsnBerTagLengthImpl

public AsnBerTagLengthImpl()

AsnBerTagLengthImpl

public AsnBerTagLengthImpl(boolean definite,
                           int tagLength)
Method Detail

isDefinite

public final boolean isDefinite()
Specified by:
isDefinite in interface AsnBerTagLength

setDefinite

public final void setDefinite(boolean definite)

isIndefinite

public final boolean isIndefinite()
Specified by:
isIndefinite in interface AsnBerTagLength

setIndefinite

public final void setIndefinite(boolean indefinite)

getTagLength

public final Number getTagLength()
Description copied from interface: AsnBerTagLength
The tag length of this instance as an abstract number (Integer, Long, BigInteger). Always safe to call, independent of the result of isTagLengthAnInt().

Specified by:
getTagLength in interface AsnBerTagLength
Returns:
the tag length of this instance as an abstract number

isTagLengthAnInt

public final boolean isTagLengthAnInt()
Description copied from interface: AsnBerTagLength
Determines whether the tag length of this instance can be represented in a java int. Depending on the result of this method one of the getTagLengthAsInt() or getTagLengthLarge() must be used to access the tag length.

Specified by:
isTagLengthAnInt in interface AsnBerTagLength
Returns:
true if it is safe to call getTagLengthAsInt(), false if getTagLengthLarge() must be used.

getTagLengthAsInt

public final int getTagLengthAsInt()
Description copied from interface: AsnBerTagLength
The tag length of this instance as a java int. May only be called if isTagLengthAnInt() returned true.

Specified by:
getTagLengthAsInt in interface AsnBerTagLength
Returns:
the tag length of this instance as a java int

setTagLengthAsInt

public final void setTagLengthAsInt(int tagLength)
Sets the new tag number to the given value and resets any previously set bits.

Parameters:
tagLength - the new tag number to set
Throws:
IllegalArgumentException - in case the given number is below zero

getTagLengthLarge

public final Number getTagLengthLarge()
Description copied from interface: AsnBerTagLength
The tag length bits of this instance as an abstract number (Long, BigInteger). May only be called if isTagLengthAnInt() returned false.

Specified by:
getTagLengthLarge in interface AsnBerTagLength
Returns:
the tag length of this instance as an abstract number

setTagLengthLarge

public final void setTagLengthLarge(Long tagLengthLarge)
Sets the new tag number to the given abstract number. Reverts to java int if the value represented in the given number fits into a java int value.

Parameters:
tagLengthLarge - the new tag number to set
Throws:
IllegalArgumentException - in case the given number is null or below zero

setTagLengthLarge

public final void setTagLengthLarge(BigInteger tagLengthLarge)
Sets the new tag number to the given abstract number. Reverts to java int if the value represented in the given number fits into a java int value.

Parameters:
tagLengthLarge - the new tag number to set
Throws:
IllegalArgumentException - in case the given number is null or below zero

equals

public final boolean equals(Object compare)
Overrides:
equals in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright 2007-2007 SourceForge. All Rights Reserved.