JavaScript is disabled on your browser.
javolution.util

Class FastBitSet

    • Constructor Detail

      • FastBitSet

        public FastBitSet()
        Creates an empty bit set.
      • FastBitSet

        protected FastBitSet(BitSetService impl)
        Creates a fast bit set based on the specified implementation.
    • Method Detail

      • and

        @Realtime(limit=LINEAR)
        public void and(FastBitSet that)
        Performs the logical AND operation on this bit set and the given bit set. This means it builds the intersection of the two sets. The result is stored into this bit set.
        Parameters:
        that - the second bit set.
      • andNot

        @Realtime(limit=LINEAR)
        public void andNot(FastBitSet that)
        Performs the logical AND operation on this bit set and the complement of the given bit set. This means it selects every element in the first set, that isn't in the second set. The result is stored into this bit set.
        Parameters:
        that - the second bit set
      • cardinality

        public int cardinality()
        Returns the number of bits set to true (or the size of this set).
        Returns:
        the number of bits being set.
      • clear

        public void clear(int bitIndex)
        Removes the specified integer value from this set. That is the corresponding bit is cleared.
        Parameters:
        bitIndex - a non-negative integer.
        Throws:
        IndexOutOfBoundsException - if index < 0
      • clear

        @Realtime(limit=LINEAR)
        public void clear(int fromIndex,
         int toIndex)
        Sets the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive) to false.
        Parameters:
        fromIndex - index of the first bit to be cleared.
        toIndex - index after the last bit to be cleared.
        Throws:
        IndexOutOfBoundsException - if (fromIndex < 0) | (toIndex < fromIndex)
      • flip

        public void flip(int bitIndex)
        Sets the bit at the index to the opposite value.
        Parameters:
        bitIndex - the index of the bit.
        Throws:
        IndexOutOfBoundsException - if bitIndex < 0
      • flip

        @Realtime(limit=LINEAR)
        public void flip(int fromIndex,
         int toIndex)
        Sets a range of bits to the opposite value.
        Parameters:
        fromIndex - the low index (inclusive).
        toIndex - the high index (exclusive).
        Throws:
        IndexOutOfBoundsException - if (fromIndex < 0) | (toIndex < fromIndex)
      • get

        public boolean get(int bitIndex)
        Returns true if the specified integer is in this bit set; false otherwise.
        Parameters:
        bitIndex - a non-negative integer.
        Returns:
        the value of the bit at the specified index.
        Throws:
        IndexOutOfBoundsException - if bitIndex < 0
      • get

        @Realtime(limit=LINEAR)
        public FastBitSet get(int fromIndex,
         int toIndex)
        Returns a new bit set composed of a range of bits from this one.
        Parameters:
        fromIndex - the low index (inclusive).
        toIndex - the high index (exclusive).
        Returns:
        a context allocated bit set instance.
        Throws:
        IndexOutOfBoundsException - if (fromIndex < 0) | (toIndex < fromIndex)
      • intersects

        @Realtime(limit=LINEAR)
        public boolean intersects(FastBitSet that)
        Returns true if this bit set shares at least one common bit with the specified bit set.
        Parameters:
        that - the bit set to check for intersection
        Returns:
        true if the sets intersect; false otherwise.
      • length

        public int length()
        Returns the logical number of bits actually used by this bit set. It returns the index of the highest set bit plus one.

        Note: This method does not return the number of set bits which is returned by FastSet.size()

        Returns:
        the index of the highest set bit plus one.
      • nextClearBit

        public int nextClearBit(int fromIndex)
        Returns the index of the next false bit, from the specified bit (inclusive).
        Parameters:
        fromIndex - the start location.
        Returns:
        the first false bit.
        Throws:
        IndexOutOfBoundsException - if fromIndex < 0
      • nextSetBit

        public int nextSetBit(int fromIndex)
        Returns the index of the next true bit, from the specified bit (inclusive). If there is none, -1 is returned. The following code will iterates through the bit set:
         for (int i=nextSetBit(0); i >= 0; i = nextSetBit(i+1)) {
         ...
         }
        Parameters:
        fromIndex - the start location.
        Returns:
        the first false bit.
        Throws:
        IndexOutOfBoundsException - if fromIndex < 0
      • previousClearBit

        public int previousClearBit(int fromIndex)
        Returns the index of the previous false bit, from the specified bit (inclusive).
        Parameters:
        fromIndex - the start location.
        Returns:
        the first false bit.
        Throws:
        IndexOutOfBoundsException - if fromIndex < -1
      • previousSetBit

        public int previousSetBit(int fromIndex)
        Returns the index of the previous true bit, from the specified bit (inclusive). If there is none, -1 is returned. The following code will iterates through the bit set:
         for (int i = length(); (i = previousSetBit(i-1)) >= 0; ) {
         ...
         }
        Parameters:
        fromIndex - the start location.
        Returns:
        the first false bit.
        Throws:
        IndexOutOfBoundsException - if fromIndex < -1
      • or

        @Realtime(limit=LINEAR)
        public void or(FastBitSet that)
        Performs the logical OR operation on this bit set and the one specified. In other words, builds the union of the two sets. The result is stored into this bit set.
        Parameters:
        that - the second bit set.
      • set

        public void set(int bitIndex)
        Adds the specified integer to this set (corresponding bit is set to true.
        Parameters:
        bitIndex - a non-negative integer.
        Throws:
        IndexOutOfBoundsException - if bitIndex < 0
      • set

        public void set(int bitIndex,
         boolean value)
        Sets the bit at the given index to the specified value.
        Parameters:
        bitIndex - the position to set.
        value - the value to set it to.
        Throws:
        IndexOutOfBoundsException - if bitIndex < 0
      • set

        @Realtime(limit=LINEAR)
        public void set(int fromIndex,
         int toIndex)
        Sets the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive) to true.
        Parameters:
        fromIndex - index of the first bit to be set.
        toIndex - index after the last bit to be set.
        Throws:
        IndexOutOfBoundsException - if (fromIndex < 0) | (toIndex < fromIndex)
      • set

        @Realtime(limit=LINEAR)
        public void set(int fromIndex,
         int toIndex,
         boolean value)
        Sets the bits between from (inclusive) and to (exclusive) to the specified value.
        Parameters:
        fromIndex - the start range (inclusive).
        toIndex - the end range (exclusive).
        value - the value to set it to.
        Throws:
        IndexOutOfBoundsException - if bitIndex < 0
      • xor

        @Realtime(limit=LINEAR)
        public void xor(FastBitSet that)
        Performs the logical XOR operation on this bit set and the one specified. In other words, builds the symmetric remainder of the two sets (the elements that are in one set, but not in the other). The result is stored into this bit set.
        Parameters:
        that - the second bit set.
      • addAll

        public FastBitSet addAll(Index... elements)
        Description copied from class: FastCollection
        Returns this collection with the specified element added.
        Overrides:
        addAll in class FastSet<Index>
        Parameters:
        elements - the elements to be added.
        Returns:
        this

Copyright © 2005-2013 Javolution. All Rights Reserved.

AltStyle によって変換されたページ (->オリジナル) /