public class BitSet extends Object implements IntSet, Cloneable
Modifier and Type | Field | Description |
---|---|---|
protected long[] |
bits |
The actual data bits
|
protected static int |
BITS |
|
protected static int |
LOG_BITS |
|
protected static int |
MOD_MASK |
Constructor | Description |
---|---|
BitSet() |
Construct a bitset of size one word (64 bits)
|
BitSet(int nbits) |
Construct a bitset given the size
|
BitSet(long[] bits_) |
Construction from a static array of longs
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(int el) |
or this element into this set (grow as necessary to accommodate)
|
void |
addAll(int[] elements) |
|
void |
addAll(Iterable<Integer> elements) |
|
void |
addAll(IntSet set) |
Add all elements from incoming set to this set.
|
IntSet |
and(IntSet a) |
Return the intersection of this set with the argument, creating
a new set.
|
void |
andInPlace(BitSet a) |
|
void |
clear() |
|
void |
clear(int el) |
|
Object |
clone() |
|
IntSet |
complement() |
|
IntSet |
complement(IntSet set) |
|
boolean |
equals(Object other) |
|
int |
getSingleElement() |
Get the first element you find and return it.
|
void |
growToInclude(int bit) |
Grows the set to a larger number of bits.
|
boolean |
isNil() |
|
int |
lengthInLongWords() |
return how much space is being used by the bits array not
how many actually have member bits on.
|
boolean |
member(int el) |
|
void |
notInPlace() |
|
void |
notInPlace(int maxBit) |
complement bits in the range 0..maxBit.
|
void |
notInPlace(int minBit,
int maxBit) |
complement bits in the range minBit..maxBit.
|
int |
numBits() |
|
static BitSet |
of(int el) |
|
static BitSet |
of(Collection<? extends Integer> elements) |
|
static BitSet |
of(Map<? extends Integer,?> elements) |
|
static BitSet |
of(IntSet set) |
|
IntSet |
or(IntSet a) |
return this | a in a new set
|
void |
orInPlace(BitSet a) |
|
static BitSet |
range(int a,
int b) |
|
void |
remove(int el) |
remove this element from this set
|
int |
size() |
Return the size of this set (not the underlying implementation's
allocated memory size, for example).
|
boolean |
subset(BitSet a) |
Is this contained within a?
|
IntSet |
subtract(IntSet a) |
|
void |
subtractInPlace(BitSet a) |
Subtract the elements of 'a' from 'this' in-place.
|
int[] |
toArray() |
|
List<Integer> |
toList() |
|
long[] |
toPackedArray() |
|
String |
toString() |
|
String |
toString(String separator,
List<String> vocabulary) |
Create a string representation where instead of integer elements, the
ith element of vocabulary is displayed instead.
|
String |
toString(Grammar g) |
Transform a bit set into a string by formatting each element as an integer
separator The string to put in between elements
|
String |
toStringOfHalfWords() |
Dump a comma-separated list of the words making up the bit set.
|
String |
toStringOfWords() |
Dump a comma-separated list of the words making up the bit set.
|
String |
toStringWithRanges() |
protected static final int BITS
protected static final int LOG_BITS
protected static final int MOD_MASK
protected long[] bits
public BitSet()
public BitSet(long[] bits_)
public BitSet(int nbits)
nbits
- The size of the bitset in bitspublic void add(int el)
public void addAll(IntSet set)
IntSet
public void addAll(int[] elements)
public IntSet and(IntSet a)
IntSet
public void andInPlace(BitSet a)
public void clear()
public void clear(int el)
public int size()
IntSet
public boolean equals(Object other)
public void growToInclude(int bit)
bit
- element that must fit in setpublic int getSingleElement()
getSingleElement
in interface IntSet
public IntSet complement()
public IntSet complement(IntSet set)
complement
in interface IntSet
public void notInPlace()
public void notInPlace(int maxBit)
public void notInPlace(int minBit, int maxBit)
public static BitSet of(int el)
public static BitSet of(Collection<? extends Integer> elements)
public static BitSet range(int a, int b)
public void orInPlace(BitSet a)
public void remove(int el)
IntSet
public int numBits()
public int lengthInLongWords()
public boolean subset(BitSet a)
public void subtractInPlace(BitSet a)
public int[] toArray()
public long[] toPackedArray()
public String toString()
public String toString(Grammar g)
public String toString(String separator, List<String> vocabulary)
public String toStringOfHalfWords()
public String toStringOfWords()
public String toStringWithRanges()
Copyright © 1992–2019 ANTLR. All rights reserved.