org.llrp.ltk.types
Class BitArray

java.lang.Object
  extended by org.llrp.ltk.types.LLRPType
      extended by org.llrp.ltk.types.BitArray
Direct Known Subclasses:
BitArray_HEX

public class BitArray
extends LLRPType

Array of bits


Field Summary
protected  Bit[] bits
           
protected static int LENGTH
           
 
Constructor Summary
BitArray()
          Creates an empty BitArray.
BitArray(Bit[] bits)
          create a new BitArray.
BitArray(org.jdom.Element element)
           
BitArray(int length)
          create a new BitArray.
BitArray(LLRPBitList list)
          create a new BitArray.
BitArray(java.lang.String binaryString)
           
 
Method Summary
 void add(Bit aBit)
           
 void clear(int i)
          set bit at provided positionto 0.
 void decodeBinary(LLRPBitList list)
          Create BitArray from BitList.
 void decodeXML(org.jdom.Element element)
          create objects from xml.
 LLRPBitList encodeBinary()
          encodes length before encoding containing values.
 org.jdom.Content encodeXML(java.lang.String name, org.jdom.Namespace ns)
          create xml representation of this parameter.
 Bit get(int i)
          get bit at specified position.
 boolean inRange(java.lang.String valueString)
          expects a string as formated for XML
static int length()
          length of BaseType - not the array - for array length call size().
 void set(int i)
          set bit at provided position to 1.
 int size()
          number of elements in array.
 java.lang.String toString()
          String representation
 java.lang.String toString(int radix)
           
 
Methods inherited from class org.llrp.ltk.types.LLRPType
toXMLString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LENGTH

protected static final int LENGTH
See Also:
Constant Field Values

bits

protected Bit[] bits
Constructor Detail

BitArray

public BitArray(Bit[] bits)
create a new BitArray. When encoded, BitArray also encodes its length.

Parameters:
bits - to be decoded

BitArray

public BitArray(LLRPBitList list)
create a new BitArray. When encoded, BitArray also encodes its length.

Parameters:
list - to be decoded

BitArray

public BitArray(int length)
create a new BitArray. When encoded, BitArray also encodes its length. Initially all bits set to 0

Parameters:
length - of array

BitArray

public BitArray()
Creates an empty BitArray. Do not call method 'set' on an empty array. Add a Bit by calling the add method


BitArray

public BitArray(org.jdom.Element element)
Parameters:
element - to be decoded

BitArray

public BitArray(java.lang.String binaryString)
Parameters:
binaryString -
Method Detail

clear

public void clear(int i)
set bit at provided positionto 0.

Parameters:
i - to be cleared

encodeBinary

public LLRPBitList encodeBinary()
encodes length before encoding containing values.

Specified by:
encodeBinary in class LLRPType
Returns:
LLRPBitList

length

public static int length()
length of BaseType - not the array - for array length call size().

Returns:
Integer representing number of bits nedded for this type

decodeBinary

public void decodeBinary(LLRPBitList list)
Create BitArray from BitList. Must provide length with first 16 bits.

Specified by:
decodeBinary in class LLRPType
Parameters:
list - to be decoded

get

public Bit get(int i)
get bit at specified position.

Parameters:
i - to get
Returns:
Bit

set

public void set(int i)
set bit at provided position to 1.

Parameters:
i - to be set to 1

size

public int size()
number of elements in array.

Returns:
number of elements in array

encodeXML

public org.jdom.Content encodeXML(java.lang.String name,
                                  org.jdom.Namespace ns)
Description copied from class: LLRPType
create xml representation of this parameter.

Specified by:
encodeXML in class LLRPType
Parameters:
name - returned content should have
ns - Namespace of elements

decodeXML

public void decodeXML(org.jdom.Element element)
Description copied from class: LLRPType
create objects from xml.

Specified by:
decodeXML in class LLRPType
Parameters:
element - to be decoded

add

public void add(Bit aBit)

toString

public java.lang.String toString()
Description copied from class: LLRPType
String representation

Overrides:
toString in class LLRPType
Returns:
String

toString

public java.lang.String toString(int radix)
Specified by:
toString in class LLRPType

inRange

public boolean inRange(java.lang.String valueString)
expects a string as formated for XML

Specified by:
inRange in class LLRPType


Copyright © 2007 ETH Zurich.