org.llrp.ltk.types
Class Bit

java.lang.Object
  extended by org.llrp.ltk.types.LLRPType
      extended by org.llrp.ltk.types.LLRPNumberType
          extended by org.llrp.ltk.types.Bit
Direct Known Subclasses:
AccessSpecState, C1G2DRValue, C1G2TagInventoryStateAwareI, C1G2TagInventoryStateAwareS

public class Bit
extends LLRPNumberType

A single bit


Field Summary
protected  java.lang.Integer value
           
 
Fields inherited from class org.llrp.ltk.types.LLRPNumberType
signed
 
Constructor Summary
Bit()
          initially set to 0.
Bit(boolean x)
          create a 7bit.
Bit(java.lang.Boolean bool)
          everything but 0 is interpreted as 1.
Bit(org.jdom.Element element)
          Creates a new Bit object from jdom element - used for xml decoding.
Bit(int x)
          create a bit.
Bit(java.lang.Integer i)
           
Bit(LLRPBitList bitList)
          create a bit.
Bit(java.lang.String x)
          create a bit.
 
Method Summary
 void decodeBinary(LLRPBitList list)
          decode
 void decodeXML(org.jdom.Element element)
          create objects from xml.
 LLRPBitList encodeBinary()
          encode this value
 org.jdom.Content encodeXML(java.lang.String name, org.jdom.Namespace ns)
          create xml representation of this parameter.
 boolean inRange(long value)
           
 boolean inRange(java.lang.String valueString)
           
 int intValue()
           
static int length()
          length in number of bits used to represent this type.
 boolean toBoolean()
          0 is false, 1 is true.
 byte toByte()
          bit as byte - the last bit is set or not.
 java.lang.Integer toInteger()
          either 0 or 1.
 java.lang.String toString()
          String representation
 java.lang.String toString(int radix)
           
 
Methods inherited from class org.llrp.ltk.types.LLRPNumberType
equals, hashCode
 
Methods inherited from class org.llrp.ltk.types.LLRPType
toXMLString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected java.lang.Integer value
Constructor Detail

Bit

public Bit()
initially set to 0.


Bit

public Bit(int x)
create a bit.

Parameters:
x - - everything but 0 is interpreted as 1

Bit

public Bit(boolean x)
create a 7bit.

Parameters:
x -

Bit

public Bit(java.lang.Integer i)

Bit

public Bit(java.lang.String x)
create a bit.

Parameters:
x - - everything but 0 is interpreted as 1

Bit

public Bit(LLRPBitList bitList)
create a bit. Look at first bit of list only.

Parameters:
bitList - - everything but 0 is interpreted as 1

Bit

public Bit(java.lang.Boolean bool)
everything but 0 is interpreted as 1.

Parameters:
bool - initial value

Bit

public Bit(org.jdom.Element element)
Creates a new Bit object from jdom element - used for xml decoding.

Parameters:
element - to be decoded
Method Detail

length

public static int length()
length in number of bits used to represent this type.

Returns:
Integer representing number of bits nedded for this type

toBoolean

public boolean toBoolean()
0 is false, 1 is true.

Returns:
boolean

toByte

public byte toByte()
bit as byte - the last bit is set or not.

Returns:
byte

toInteger

public java.lang.Integer toInteger()
either 0 or 1.

Specified by:
toInteger in class LLRPNumberType
Returns:
either 0 or 1!

intValue

public int intValue()
Overrides:
intValue in class LLRPNumberType

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

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

decodeBinary

public void decodeBinary(LLRPBitList list)
Description copied from class: LLRPType
decode

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

encodeBinary

public LLRPBitList encodeBinary()
Description copied from class: LLRPType
encode this value

Specified by:
encodeBinary in class LLRPType
Returns:
LLRPBitList

toString

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

Overrides:
toString in class LLRPNumberType
Returns:
String

toString

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

inRange

public boolean inRange(long value)
Specified by:
inRange in class LLRPNumberType

inRange

public boolean inRange(java.lang.String valueString)
Specified by:
inRange in class LLRPType


Copyright © 2007 ETH Zurich.