|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.util.math.BitList
public class BitList
represents an immutable ordered collection of bits with a known length
when converting to and from bytes and larger numbers, this representation uses the least-significant first convention both for bits and for bytes (little endian)
(i.e. least significant byte is first, as is the least significant bit; ninth element in this list is the least significant bit in the second byte, so a list {0,0,0,0,0,0,0,0,1,0} represents 256)
Field Summary | |
---|---|
protected int |
length
|
Constructor Summary | |
protected BitList(java.util.BitSet bits, int length)
|
Method Summary | |
---|---|
BitList
|
anded(BitList other)
represents the result of this bit list logically ANDed with the other |
boolean[]
|
asArray()
|
java.math.BigInteger
|
asBigInteger()
|
java.util.BitSet
|
asBitSet()
nb: BitSet forgets the length |
java.util.List
|
asByteList()
|
byte[]
|
asBytes()
returns the bits converted to bytes, with least significant bit first and* first 8 bits in the first byte |
java.util.List
|
asList()
|
int[]
|
asUnsignedBytes()
|
byte
|
byteValue()
returns value of this as a byte(ignoring any too-high bits) |
int
|
commonPrefixLength(BitList other)
|
boolean
|
equals(java.lang.Object obj)
|
boolean
|
get(int index)
|
int
|
hashCode()
|
int
|
intValue()
returns value of this as an integer (ignoring any too-high bits) |
boolean
|
isEmpty()
true iff the length is 0; see also isZero |
boolean
|
isZero()
true iff all bits are 0 |
int
|
length()
|
long
|
longValue()
returns value of this as a long (ignoring any too-high bits) |
static BitList
|
newInstance(java.util.BitSet bits, int length)
|
static BitList
|
newInstance(byte... bytes)
|
static BitList
|
newInstance(java.util.List l)
|
static BitList
|
newInstance(boolean... l)
|
static BitList
|
newInstance(java.math.BigInteger x)
|
static BitList
|
newInstanceFromBytes(int... bytes)
as newInstance(byte...), but accepting ints for convenience; only the least significant 8 bits of the parameters are considered |
BitList
|
notted()
represents the result of this bit list logically notted |
BitList
|
orred(BitList other)
represents the result of this bit list logically ORred with the other |
BitList
|
resized(int length)
creates a new instance with the given length, either reducing the list or padding it with 0's (at the end, in both cases) |
BitList
|
reversed()
|
java.lang.String
|
toString()
|
BitList
|
xorred(BitList other)
represents the result of this bit list logically XORred with the other |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected final int length
Constructor Detail |
---|
protected BitList(java.util.BitSet bits, int length)
Method Detail |
---|
public BitList anded(BitList other)
public boolean[] asArray()
public java.math.BigInteger asBigInteger()
public java.util.BitSet asBitSet()
public java.util.List asByteList()
public byte[] asBytes()
NB this may be different to BitSet.valueOf available since java 7 (as late as that!) which reverses the order of the bytes
public java.util.List asList()
public int[] asUnsignedBytes()
public byte byteValue()
public int commonPrefixLength(BitList other)
@Override public boolean equals(java.lang.Object obj)
public boolean get(int index)
@Override public int hashCode()
public int intValue()
public boolean isEmpty()
public boolean isZero()
public int length()
public long longValue()
public static BitList newInstance(java.util.BitSet bits, int length)
public static BitList newInstance(byte... bytes)
public static BitList newInstance(java.util.List l)
public static BitList newInstance(boolean... l)
public static BitList newInstance(java.math.BigInteger x)
public static BitList newInstanceFromBytes(int... bytes)
public BitList notted()
public BitList orred(BitList other)
public BitList resized(int length)
public BitList reversed()
@Override public java.lang.String toString()
public BitList xorred(BitList other)
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.