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 SummaryConstructors
- 
Method SummaryModifier 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.Objectclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
BitArraypublic BitArray(int nbits) 
- 
BitArraypublic BitArray(boolean... bits) 
- 
BitArray
 
- 
- 
Method Details- 
getBitpublic 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.
 
- 
setBitpublic void setBit(int index, boolean value) 
- 
sizepublic int size()Get number of bits stored in this instance- Returns:
 
- 
toString
- 
iterator
- 
equals
- 
toBinaryStringGet data as binary string For example, 0010- Returns:
- string representing the data
 
 
-