choco.kernel.memory
Interface IStateBitSet

All Known Implementing Classes:
OneWordSBitSet32, OneWordSBitSet64, SBitSet, SBitSet2

public interface IStateBitSet

Created by IntelliJ IDEA. User: julien Date: 12 juil. 2007 Time: 10:16:08


Method Summary
 void and(IStateBitSet other)
           
 void andNot(IStateBitSet other)
           
 int capacity()
           
 int cardinality()
          Number of bits on.
 void clear()
          Remove all bits;
 void clear(int bitIndex)
          Puts the specified bit off.
 void clear(int fromIndex, int toIndex)
           
 IStateBitSet copy()
           
 BitSet copyToBitSet()
           
 void flip(int bitIndex)
           
 void flip(int fromIndex, int toIndex)
           
 boolean get(int bitIndex)
           
 boolean intersects(IStateBitSet setI)
           
 boolean isEmpty()
           
 int nextClearBit(int fromIndex)
           
 int nextSetBit(int fromIndex)
          Returns the index of the first bit that is set to true that occurs on or after the specified starting index.
 void or(IStateBitSet other)
           
 int prevClearBit(int fromIndex)
           
 int prevSetBit(int fromIndex)
          Returns the index of the first bit that is set to true that occurs on or before the specified starting index.
 void set(int bitIndex)
          Puts the specified bit on.
 void set(int index, boolean value)
           
 void set(int fromIdex, int toIndex)
           
 int size()
          Size of the bitset
 void xor(IStateBitSet other)
           
 

Method Detail

cardinality

int cardinality()
Number of bits on. Sums the number of on bits in each integer.

Returns:
the total number of bits on

size

int size()
Size of the bitset

Returns:

set

void set(int bitIndex)
Puts the specified bit on.

Parameters:
bitIndex - the bit to put on

clear

void clear(int bitIndex)
Puts the specified bit off.

Parameters:
bitIndex - the bit to put off

clear

void clear()
Remove all bits;


clear

void clear(int fromIndex,
           int toIndex)

set

void set(int index,
         boolean value)

set

void set(int fromIdex,
         int toIndex)

get

boolean get(int bitIndex)

nextSetBit

int nextSetBit(int fromIndex)
Returns the index of the first bit that is set to true that occurs on or after the specified starting index. If no such bit exists then -1 is returned.

To iterate over the true bits in a BitSet, use the following loop:

for(int i=bs.nextSetBit(0); i>=0; i=bs.nextSetBit(i+1)) { // operate on index i here }

Parameters:
fromIndex - the index to start checking from (inclusive).
Returns:
the index of the next set bit.
Throws:
IndexOutOfBoundsException - if the specified index is negative.
Since:
1.4

prevSetBit

int prevSetBit(int fromIndex)
Returns the index of the first bit that is set to true that occurs on or before the specified starting index. If no such bit exists then -1 is returned.

Parameters:
fromIndex - the index to start checking from (inclusive).
Returns:
the index of the previous set bit.
Throws:
IndexOutOfBoundsException - if the specified index is negative or too large

nextClearBit

int nextClearBit(int fromIndex)

prevClearBit

int prevClearBit(int fromIndex)

capacity

int capacity()

copy

IStateBitSet copy()

copyToBitSet

BitSet copyToBitSet()

or

void or(IStateBitSet other)

and

void and(IStateBitSet other)

xor

void xor(IStateBitSet other)

andNot

void andNot(IStateBitSet other)

intersects

boolean intersects(IStateBitSet setI)

flip

void flip(int bitIndex)

flip

void flip(int fromIndex,
          int toIndex)

isEmpty

boolean isEmpty()


Copyright © 2012. All Rights Reserved.