Package fr.uga.pddl4j.util
Class BitVector
java.lang.Object
fr.uga.pddl4j.util.BitSet
fr.uga.pddl4j.util.BitVector
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
State
This class implements a bit vector.
Revisions:
Revisions:
- 26.06.2020: Add shift methods.
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returnstrue
if this bit vector excludes an other specifiedBitVector
.getIntersection(BitVector vector)
Return a bit vector that represents the intersection of this bit vector with an other.boolean
Returnstrue
if this bit vector includes an other specifiedBitVector
.void
shiftLeft(int n)
Shifts left the bit vector of n bits.void
shiftRight(int n)
Shifts right the bit vector of n bits.Methods inherited from class fr.uga.pddl4j.util.BitSet
and, andNot, cardinality, clear, clear, clear, clone, ensureCapacity, equals, flip, flip, get, get, hashCode, intersects, isEmpty, length, nextClearBit, nextSetBit, or, previousClearBit, previousSetBit, recalculateWordsInUse, set, set, set, set, size, stream, toByteArray, toLongArray, toString, valueOf, valueOf, valueOf, valueOf, xor
-
Constructor Details
-
BitVector
public BitVector(int size)Creates a newBitVector
with a specific size.- Parameters:
size
- the size of the bit vector.
-
BitVector
public BitVector()Creates a newBitVector
. -
BitVector
Creates a newBitVector
from a specifiedBitExp
.- Parameters:
exp
- theBitExp
that representsBitVector
.
-
BitVector
Creates a newBitVector
from an other state. This constructor is the copy constructor.- Parameters:
vector
- the otherBitVector
to copy
-
-
Method Details
-
include
Returnstrue
if this bit vector includes an other specifiedBitVector
. In other word, this method returnstrue
if all the bits set to 1 in the specified vector are also set to 1 in this vector.- Parameters:
vector
- the other bit vector.- Returns:
true
if this bit vector includes an other specifiedBitVector
;false
otherwise.
-
exclude
Returnstrue
if this bit vector excludes an other specifiedBitVector
. In other word, this method returnstrue
if all the bits set to 1 in the specified vector are set to 0 in this vector.- Parameters:
vector
- the other bit vector.- Returns:
true
if this bit vector is included a other specifiedBitVector
;false
otherwise.
-
getIntersection
Return a bit vector that represents the intersection of this bit vector with an other.- Parameters:
vector
- the other bit vector.- Returns:
- Return a bit vector that represents the intersection of this bit vector with an other.
-
shiftRight
public final void shiftRight(int n)Shifts right the bit vector of n bits.- Parameters:
n
- the number of bit to shift. n must greater or equal 0.
-
shiftLeft
public final void shiftLeft(int n)Shifts left the bit vector of n bits.- Parameters:
n
- the number of bit to shift. n must greater of equal to 0.
-