Top Description Inners Fields Constructors Methods
com.sun.tools.javac.util

public Class Bits

extends Object
Class Inheritance
Imports
java.util.Arrays

A class for extensible, mutable bit sets.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static enum

Field Summary

Modifier and TypeField and Description
public int[]
protected Bits.BitsState
private static final int[]
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
Bits()

Construct an initially empty set.

public
Bits(Bits someBits)

public
Bits(boolean reset)

protected
Bits(int[] bits, Bits.BitsState initState)

Construct a set consisting initially of given bit vector.

Method Summary

Modifier and TypeMethod and Description
public Bits
andSet(Bits xs)

this set = this set & xs.

public Bits
assign(Bits someBits)

public void
clear()

This set = {}.

public Bits
diffSet(Bits xs)

this set = this set \ xs.

public Bits
dup()

Return a copy of this set.

protected int[]
public void
excl(int x)

Exclude x from this set.

public void
excludeFrom(int start)

Exclude [start...end] from this set.

public void
incl(int x)

Include x in this set.

public void
inclRange(int start, int limit)

Include [start..limit) in this set.

protected void
protected void
public boolean
isMember(int x)

Is x an element of this set?

public boolean
public int
nextBit(int x)

Return the index of the least bit position ≥ x that is set.

public Bits
orSet(Bits xs)

this set = this set | xs.

public void
protected void
sizeTo(int len)

public String
toString()

Overrides java.lang.Object.toString.

a string representation of this set.

private static int
trailingZeroBits(int x)

Count trailing zero bits in an int.

public Bits
xorSet(Bits xs)

this set = this set ^ xs.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bitsback to summary
public int[] bits
currentStateback to summary
protected Bits.BitsState currentState
unassignedBitsback to summary
private static final int[] unassignedBits
wordlenback to summary
private static final int wordlen
wordmaskback to summary
private static final int wordmask
wordshiftback to summary
private static final int wordshift

Constructor Detail

Bitsback to summary
public Bits()

Construct an initially empty set.

Bitsback to summary
public Bits(Bits someBits)
Bitsback to summary
public Bits(boolean reset)
Bitsback to summary
protected Bits(int[] bits, Bits.BitsState initState)

Construct a set consisting initially of given bit vector.

Method Detail

andSetback to summary
public Bits andSet(Bits xs)

this set = this set & xs.

assignback to summary
public Bits assign(Bits someBits)
clearback to summary
public void clear()

This set = {}.

diffSetback to summary
public Bits diffSet(Bits xs)

this set = this set \ xs.

dupback to summary
public Bits dup()

Return a copy of this set.

dupBitsback to summary
protected int[] dupBits()
exclback to summary
public void excl(int x)

Exclude x from this set.

excludeFromback to summary
public void excludeFrom(int start)

Exclude [start...end] from this set.

inclback to summary
public void incl(int x)

Include x in this set.

inclRangeback to summary
public void inclRange(int start, int limit)

Include [start..limit) in this set.

internalAndSetback to summary
protected void internalAndSet(Bits xs)
internalResetback to summary
protected void internalReset()
isMemberback to summary
public boolean isMember(int x)

Is x an element of this set?

isResetback to summary
public boolean isReset()
nextBitback to summary
public int nextBit(int x)

Return the index of the least bit position ≥ x that is set. If none are set, returns -1. This provides a nice way to iterate over the members of a bit set:

for (int i = bits.nextBit(0); i>=0; i = bits.nextBit(i+1)) ...
orSetback to summary
public Bits orSet(Bits xs)

this set = this set | xs.

resetback to summary
public void reset()
sizeToback to summary
protected void sizeTo(int len)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

a string representation of this set.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

Annotations
@Override
trailingZeroBitsback to summary
private static int trailingZeroBits(int x)

Count trailing zero bits in an int. Algorithm from "Hacker's Delight" by Henry S. Warren Jr. (figure 5-13)

xorSetback to summary
public Bits xorSet(Bits xs)

this set = this set ^ xs.

com.sun.tools.javac.util back to summary

protected final Enum Bits.BitsState

extends Enum<Bits.BitsState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Bits.BitsState
public static final Bits.BitsState
public static final Bits.BitsState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static Bits.BitsState
getState(int[] someBits, boolean reset)

public static Bits.BitsState
public static Bits.BitsState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

NORMALback to summary
public static final Bits.BitsState NORMAL
UNINITback to summary
public static final Bits.BitsState UNINIT
UNKNOWNback to summary
public static final Bits.BitsState UNKNOWN

Constructor Detail

BitsStateback to summary
private BitsState()

Method Detail

getStateback to summary
pack-priv static Bits.BitsState getState(int[] someBits, boolean reset)
valueOfback to summary
public static Bits.BitsState valueOf(String name)
valuesback to summary
public static Bits.BitsState[] values()