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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif 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.booleanReturnstrueif this bit vector includes an other specifiedBitVector.voidshiftLeft(int n)Shifts left the bit vector of n bits.voidshiftRight(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 newBitVectorwith a specific size.- Parameters:
size- the size of the bit vector.
-
BitVector
public BitVector()Creates a newBitVector. -
BitVector
Creates a newBitVectorfrom a specifiedBitExp.- Parameters:
exp- theBitExpthat representsBitVector.
-
BitVector
Creates a newBitVectorfrom an other state. This constructor is the copy constructor.- Parameters:
vector- the otherBitVectorto copy
-
-
Method Details
-
include
Returnstrueif this bit vector includes an other specifiedBitVector. In other word, this method returnstrueif 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:
trueif this bit vector includes an other specifiedBitVector;falseotherwise.
-
exclude
Returnstrueif this bit vector excludes an other specifiedBitVector. In other word, this method returnstrueif all the bits set to 1 in the specified vector are set to 0 in this vector.- Parameters:
vector- the other bit vector.- Returns:
trueif this bit vector is included a other specifiedBitVector;falseotherwise.
-
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.
-