Class Bitset

java.lang.Object
de.elo.ix.client.Bitset
All Implemented Interfaces:
Serializable

public class Bitset extends Object implements 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
    Modifier and Type
    Field
    Description
    protected long
    Internal 64 bit integer value
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor
    Bitset(long v)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    and(long r)
    Compute bit-and operation and return the result in a new object
    long
    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
     
    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
    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 object
    long
    not(long r)
    Inverts all bits.
    or(long r)
    Compute bit-or operation and return the result in a new object
    long
    or(long l, long r)
    Compute a bit-wise or operation.
     
    Convert the parameter into a binary string representation
    xor(long r)
    Compute bit-xor operation and return the result in a new object
    long
    xor(long l, long r)
    Compute a bit-wise xor operation.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • v

      protected long v
      Internal 64 bit integer value
  • Constructor Details

    • Bitset

      public Bitset()
      Constructor
    • Bitset

      public Bitset(long v)
      Constructor
      Parameters:
      v - Initial value
  • Method Details

    • and

      public Bitset and(long r)
      Compute bit-and operation and return the result in a new object
      Parameters:
      r - Rhight handed side of the operation.
      Returns:
      Result object
    • or

      public Bitset or(long r)
      Compute bit-or operation and return the result in a new object
      Parameters:
      r - Rhight handed side of the operation.
      Returns:
      Result object
    • not

      public Bitset not()
      Compute bit-not operation and return the result in a new object
      Returns:
      Result object
    • andNot

      public Bitset andNot(long r)
      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

      public Bitset xor(long r)
      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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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

      public String toString(Object v)
      Convert the parameter into a binary string representation
      Parameters:
      v - Should be an integer value.
      Returns:
      String