类 BitVector
java.lang.Object
net.sf.marineapi.ais.util.BitVector
Class holding bit values in an array and implementing put/get
integer/string operations on it.
- 作者:
- Lázár József
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明get(int from, int to) Gets a vector subset.intgetAs17BitInt(int from, int to) Convert to 17-bit integer.intgetAs18BitInt(int from, int to) Convert to 18-bit integer.intgetAs27BitInt(int from, int to) Convert to 27-bit integer.intgetAs28BitInt(int from, int to) Convert to 28-bit integer.intgetAs8BitInt(int from, int to) Convert to 8-bit integer.booleangetBoolean(int index) Return bit as boolean from the bit vectorintgetUInt(int from, int to) Returns the requested bits interpreted as an integer (MSB first) from the message.voidset(int index) Set bit at given index.
-
构造器详细资料
-
BitVector
public BitVector(int bits) Creates a new instance with given length.- 参数:
bits- Vector length
-
BitVector
Creates a new instance with given BitSet and length.- 参数:
vector- BitSet
-
-
方法详细资料
-
set
public void set(int index) Set bit at given index.- 参数:
index- Index of bit to set.
-
get
Gets a vector subset.- 参数:
from- Start indexto- End index- 返回:
- BitVector with specified range
-
getBoolean
public boolean getBoolean(int index) Return bit as boolean from the bit vector- 参数:
index- start index of bit- 返回:
trueif bit is set, otherwisefalse.
-
getUInt
public int getUInt(int from, int to) Returns the requested bits interpreted as an integer (MSB first) from the message.- 参数:
from- begin index (inclusive)to- end index (inclusive)- 返回:
- unsigned int value
-
getAs8BitInt
public int getAs8BitInt(int from, int to) Convert to 8-bit integer.- 参数:
from- Start indexto- End index- 返回:
- Integer value
-
getAs17BitInt
public int getAs17BitInt(int from, int to) Convert to 17-bit integer.- 参数:
from- Start indexto- End index- 返回:
- Integer value
-
getAs18BitInt
public int getAs18BitInt(int from, int to) Convert to 18-bit integer.- 参数:
from- Start indexto- End index- 返回:
- Integer value
-
getAs27BitInt
public int getAs27BitInt(int from, int to) Convert to 27-bit integer.- 参数:
from- Start indexto- End index- 返回:
- Integer value
-
getAs28BitInt
public int getAs28BitInt(int from, int to) Convert to 28-bit integer.- 参数:
from- Start indexto- End index- 返回:
- Integer value
-