Class NumberToBitVector

java.lang.Object
it.unimi.dsi.sux4j.scratch.NumberToBitVector
All Implemented Interfaces:
it.unimi.dsi.bits.TransformationStrategy<BigInteger>, Serializable

public class NumberToBitVector extends Object implements it.unimi.dsi.bits.TransformationStrategy<BigInteger>
A transformation strategy that converts strings representing integers between 0 (inclusive) and 2k (exclusive)) into fixed-length binary vectors (most-significant bit is the 0-th).
See Also:
  • Constructor Details

    • NumberToBitVector

      public NumberToBitVector(int width)
      Creates a transformation strategy with given number of binary digits.
      Parameters:
      width - number of binary digits;
  • Method Details

    • copy

      public it.unimi.dsi.bits.TransformationStrategy<BigInteger> copy()
      Specified by:
      copy in interface it.unimi.dsi.bits.TransformationStrategy<BigInteger>
    • numBits

      public long numBits()
      Specified by:
      numBits in interface it.unimi.dsi.bits.TransformationStrategy<BigInteger>
    • length

      public long length(BigInteger x)
      Specified by:
      length in interface it.unimi.dsi.bits.TransformationStrategy<BigInteger>
    • toBitVector

      public it.unimi.dsi.bits.BitVector toBitVector(BigInteger x)
      Specified by:
      toBitVector in interface it.unimi.dsi.bits.TransformationStrategy<BigInteger>
    • main

      public static void main(String[] arg)