org.llrp.ltk.types
Class LLRPBitList

java.lang.Object
  extended by org.llrp.ltk.types.LLRPBitList

public class LLRPBitList
extends java.lang.Object

A list of bits used for binary representation of messages.


Constructor Summary
LLRPBitList()
          Creates a new LLRPBitList object.
LLRPBitList(byte[] bytes)
          bytes interpreted in order they appear in array.
LLRPBitList(int n)
          creates lit list with all bits set to 0.
LLRPBitList(java.lang.String bitString)
          create BitList from String.
 
Method Summary
 void add(boolean bit)
          add a bit to bit list.
 void append(LLRPBitList other)
          appends other bit list to this.
 void clear(int position)
          clear bit at specified position.
 void clear(java.lang.Integer i)
           
 java.lang.Object clone()
          clone.
 boolean equals(LLRPBitList other)
          bitwise comparison.
 boolean get(int position)
          get bit as boolean value at specified position.
 boolean get(java.lang.Integer i)
           
 int hashCode()
           
 int length()
          returns number of bits in this list.
 void pad(int number)
          add a list of 0s to front of list.
 void pad(java.lang.Integer i)
           
 void set(int position)
          set bit at specified position to true.
 void set(java.lang.Integer i)
           
 LLRPBitList subList(java.lang.Integer from, java.lang.Integer subLength)
          return a list containing a copy of the elements starting at from, having length length.
 byte[] toByteArray()
          8 bits bundled Integero one byte.
 java.lang.String toString()
          encoded message as a string.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LLRPBitList

public LLRPBitList()
Creates a new LLRPBitList object.


LLRPBitList

public LLRPBitList(byte[] bytes)
bytes interpreted in order they appear in array.

Parameters:
bytes - interpreted in order they appear in array

LLRPBitList

public LLRPBitList(java.lang.String bitString)
create BitList from String. Everything but '0' is interpreted as 1.

Parameters:
bitString - to be decoded

LLRPBitList

public LLRPBitList(int n)
creates lit list with all bits set to 0.

Parameters:
n - length of bit list
Method Detail

add

public void add(boolean bit)
add a bit to bit list. Length is increased by 1.

Parameters:
bit - to be added

append

public void append(LLRPBitList other)
appends other bit list to this. This list gets changed.

Parameters:
other - bit list

clear

public void clear(int position)
clear bit at specified position.

Parameters:
position - to clear

clear

public void clear(java.lang.Integer i)

clone

public java.lang.Object clone()
clone.

Overrides:
clone in class java.lang.Object
Returns:
cloned object

equals

public boolean equals(LLRPBitList other)
bitwise comparison.

Parameters:
other - to compare
Returns:
boolean

get

public boolean get(int position)
get bit as boolean value at specified position.

Parameters:
position - of bit
Returns:
returns true (bit set) or false

get

public boolean get(java.lang.Integer i)

length

public int length()
returns number of bits in this list.

Returns:
int

pad

public void pad(int number)
add a list of 0s to front of list.

Parameters:
number - of bits to add at front

pad

public void pad(java.lang.Integer i)

set

public void set(int position)
set bit at specified position to true.

Parameters:
position - start at index 0

set

public void set(java.lang.Integer i)

subList

public LLRPBitList subList(java.lang.Integer from,
                           java.lang.Integer subLength)
return a list containing a copy of the elements starting at from, having length length.

Parameters:
from - where sublist starts, list start at Index 0
subLength - long sublist is
Returns:
LLRPBitList sublist starting at from and total length sublength

toByteArray

public byte[] toByteArray()
8 bits bundled Integero one byte.

Returns:
byte Array

toString

public java.lang.String toString()
encoded message as a string.

Overrides:
toString in class java.lang.Object
Returns:
String

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2007 ETH Zurich.