Class BitArray
java.lang.Object
org.openhab.core.io.transport.modbus.BitArray
Class that implements a collection for
 bits
- Author:
 - Sami Salonen - Initial contribution
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleangetBit(int index) Returns the state of the bit at the given index Index 0 matches LSB (rightmost) bititerator()voidsetBit(int index, boolean value) intsize()Get number of bits stored in this instanceGet data as binary string For example, 0010toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator 
- 
Constructor Details
- 
BitArray
public BitArray(int nbits)  - 
BitArray
public BitArray(boolean... bits)  - 
BitArray
 
 - 
 - 
Method Details
- 
getBit
public boolean getBit(int index) Returns the state of the bit at the given index Index 0 matches LSB (rightmost) bit- Parameters:
 index- the index of the bit to be returned.- Returns:
 - true if the bit at the specified index is set, false otherwise.
 - Throws:
 IndexOutOfBoundsException- if the index is out of bounds.
 - 
setBit
public void setBit(int index, boolean value)  - 
size
public int size()Get number of bits stored in this instance- Returns:
 
 - 
toString
 - 
iterator
 - 
equals
 - 
toBinaryString
Get data as binary string For example, 0010- Returns:
 - string representing the data
 
 
 -