Graphity for TypeScript 3.0.0
    Preparing search index...

    A set of non-negative integers, one bit each, that grows as needed. It is the counterpart of java.util.BitSet, with the part of it that the API of the library needs: the visited nodes of a FrontierTraverser, which a subclass may mark, and the selection of NodeMapping.forSubgraph. JavaScript has no bit set of its own.

    The bits are kept in 32-bit words, where Java keeps them in 64-bit words; the set grows when a bit beyond its capacity is set. Instances are mutable.

    Memory: 1 bit per bit up to the highest set or the initial capacity, in words of 4 bytes.

    Index
    • Creates an empty set with room for the bits 0..nbits-1 before it grows. The default is 64, as in Java.

      Time: O(nbits).

      Parameters

      • nbits: number = 64

        the number of bits to make room for

      Returns BitSet

      Error if nbits is negative (Java: NegativeArraySizeException) or not an integer in the 32-bit range

    • Clears bit index.

      Time: O(1).

      Parameters

      • index: number

        bit index, 0 or more

      Returns void

      RangeError if index is negative or not an integer

    • Returns whether bit index is set; false beyond the capacity.

      Time: O(1).

      Parameters

      • index: number

        bit index, 0 or more

      Returns boolean

      RangeError if index is negative or not an integer

    • Returns whether no bit is set.

      Time: O(capacity / 32), where Java answers in O(1).

      Returns boolean

    • Returns the index of the highest set bit plus one, or 0 if no bit is set.

      Time: O(capacity / 32), where Java keeps the number of words in use and answers in O(1).

      Returns number

    • Returns the index of the first clear bit at or after from.

      Time: O(capacity / 32).

      Parameters

      • from: number

        bit index to start at, 0 or more

      Returns number

      RangeError if from is negative or not an integer

    • Returns the index of the first set bit at or after from, or -1 if there is none.

      Time: O(capacity / 32).

      Parameters

      • from: number

        bit index to start at, 0 or more

      Returns number

      RangeError if from is negative or not an integer

    • Sets bit index, and grows the set if the bit lies beyond its capacity.

      Time: O(1) amortized.

      Parameters

      • index: number

        bit index, 0 or more

      Returns void

      RangeError if index is negative or not an integer