Package de.elo.ix.client
Class Bitset
java.lang.Object
de.elo.ix.client.Bitset
- All Implemented Interfaces:
Serializable
This class is used in the scripting API of Indexserver and provides bit operations on 64 bit
integers. JavaScript does not support bit operations for 64 bit integers. The global context of
the JavaScripts executed by Indexserver contain an object named Bitset which is an instance of
this class.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionand
(long r) Compute bit-and operation and return the result in a new objectlong
and
(long l, long r) Compute a bit-wise and operation.andNot
(long r) Compute bit-and operation with the bit-wise inverted parameter value: v & ~r.long
andNot
(long l, long r) Compute a bit-wise and operation with inverted right operand.boolean
int
hashCode()
boolean
isAllTrue
(long m) Tests wether all bits in m are set in v: (v & m) == m.boolean
isAllTrue
(long l, long m) Tests wether all bits in m are set in l.boolean
isEmpty()
Tests wether all bits are 0.boolean
isTrue
(long m) Tests wether any bit in m is included in v: (v & m) != 0.boolean
isTrue
(long l, long m) Tests wether any bit in m is set in l.not()
Compute bit-not operation and return the result in a new objectlong
not
(long r) Inverts all bits.or
(long r) Compute bit-or operation and return the result in a new objectlong
or
(long l, long r) Compute a bit-wise or operation.toString()
Convert the parameter into a binary string representationxor
(long r) Compute bit-xor operation and return the result in a new objectlong
xor
(long l, long r) Compute a bit-wise xor operation.
-
Field Details
-
v
protected long vInternal 64 bit integer value
-
-
Constructor Details
-
Bitset
public Bitset()Constructor -
Bitset
public Bitset(long v) Constructor- Parameters:
v
- Initial value
-
-
Method Details
-
and
Compute bit-and operation and return the result in a new object- Parameters:
r
- Rhight handed side of the operation.- Returns:
- Result object
-
or
Compute bit-or operation and return the result in a new object- Parameters:
r
- Rhight handed side of the operation.- Returns:
- Result object
-
not
Compute bit-not operation and return the result in a new object- Returns:
- Result object
-
andNot
Compute bit-and operation with the bit-wise inverted parameter value: v & ~r.- Parameters:
r
- Rhight handed side of the operation.- Returns:
- Result object
-
xor
Compute bit-xor operation and return the result in a new object- Parameters:
r
- Rhight handed side of the operation.- Returns:
- Result object
-
isTrue
public boolean isTrue(long m) Tests wether any bit in m is included in v: (v & m) != 0.- Parameters:
m
- Rhight handed side of the operation.- Returns:
- Result object
-
isAllTrue
public boolean isAllTrue(long m) Tests wether all bits in m are set in v: (v & m) == m.- Parameters:
m
- Rhight handed side of the operation.- Returns:
- Result object
-
isEmpty
public boolean isEmpty()Tests wether all bits are 0.- Returns:
- true, if no bit is set.
-
equals
-
hashCode
public int hashCode() -
toString
-
and
public long and(long l, long r) Compute a bit-wise and operation.- Parameters:
l
- Left operand.r
- Right operand.- Returns:
- l & r
-
or
public long or(long l, long r) Compute a bit-wise or operation.- Parameters:
l
- Left operand.r
- Right operand.- Returns:
- l | r
-
not
public long not(long r) Inverts all bits.- Parameters:
r
- Right operand.- Returns:
- ~r
-
andNot
public long andNot(long l, long r) Compute a bit-wise and operation with inverted right operand.- Parameters:
l
- Left operand.r
- Right operand.- Returns:
- l & ~r
-
xor
public long xor(long l, long r) Compute a bit-wise xor operation.- Parameters:
l
- Left operand.r
- Right operand.- Returns:
- l ^ r
-
isTrue
public boolean isTrue(long l, long m) Tests wether any bit in m is set in l.- Parameters:
l
- Left operand.m
- Right operand.- Returns:
- (l & r) != 0
-
isAllTrue
public boolean isAllTrue(long l, long m) Tests wether all bits in m are set in l.- Parameters:
l
- Left operand.m
- Right operand.- Returns:
- (l & m) == m
-
toString
Convert the parameter into a binary string representation- Parameters:
v
- Should be an integer value.- Returns:
- String
-