Public Member Functions | |
BitSet () | |
BitSet (long[] bits_) | |
BitSet (int nbits) | |
void | add (int el) |
BitSet | and (BitSet a) |
void | andInPlace (BitSet a) |
void | clear () |
void | clear (int el) |
Object | clone () |
int | degree () |
boolean | equals (Object obj) |
void | growToInclude (int bit) |
boolean | member (int el) |
boolean | nil () |
BitSet | not () |
void | notInPlace () |
void | notInPlace (int maxBit) |
void | notInPlace (int minBit, int maxBit) |
BitSet | or (BitSet a) |
void | orInPlace (BitSet a) |
void | remove (int el) |
int | size () |
int | lengthInLongWords () |
boolean | subset (BitSet a) |
void | subtractInPlace (BitSet a) |
int[] | toArray () |
long[] | toPackedArray () |
String | toString () |
String | toString (String separator) |
String | toString (String separator, CharFormatter formatter) |
String | toString (String separator, Vector vocabulary) |
String | toStringOfHalfWords () |
String | toStringOfWords () |
String | toStringWithRanges (String separator, CharFormatter formatter) |
Static Public Member Functions | |
static Vector | getRanges (int[] elems) |
static BitSet | of (int el) |
Protected Attributes | |
long | bits [] |
Static Protected Attributes | |
static final int | BITS = 64 |
static final int | NIBBLE = 4 |
static final int | LOG_BITS = 6 |
static final int | MOD_MASK = BITS - 1 |
A BitSet to replace java.util.BitSet. Primary differences are that most set operators return new sets as opposed to oring and anding "in place". Further, a number of operations were added. I cannot contain a BitSet because there is no way to access the internal bits (which I need for speed) and, because it is final, I cannot subclass to add functionality. Consider defining set degree. Without access to the bits, I must call a method n times to test the ith bit...ack!
Also seems like or() from util is wrong when size of incoming set is bigger than this.bits.length.
antlr.collections.impl.BitSet.BitSet | ( | ) |
Construct a bitset of size one word (64 bits)
References antlr.collections.impl.BitSet.BITS.
Referenced by antlr.collections.impl.BitSet.of().
antlr.collections.impl.BitSet.BitSet | ( | long[] | bits_ | ) |
Construction from a static array of longs
References antlr.collections.impl.BitSet.bits.
antlr.collections.impl.BitSet.BitSet | ( | int | nbits | ) |
Construct a bitset given the size
nbits | The size of the bitset in bits |
References antlr.collections.impl.BitSet.bits, and antlr.collections.impl.BitSet.LOG_BITS.
void antlr.collections.impl.BitSet.add | ( | int | el | ) |
or this element into this set (grow as necessary to accommodate)
References antlr.collections.impl.BitSet.bits, and antlr.collections.impl.BitSet.growToInclude().
Referenced by antlr.CharLiteralElement.CharLiteralElement(), antlr.CharRangeElement.CharRangeElement(), antlr.TokenStreamRewriteEngine.discard(), antlr.TokenStreamBasicFilter.discard(), antlr.LLkAnalyzer.FOLLOW(), antlr.TokenStreamHiddenTokenFilter.hide(), antlr.LexerGrammar.LexerGrammar(), antlr.LLkAnalyzer.look(), antlr.Lookahead.of(), antlr.collections.impl.BitSet.of(), antlr.Tool.setArgOK(), and antlr.ANTLRParser.setBlockElement().
References antlr.collections.impl.BitSet.andInPlace(), and antlr.collections.impl.BitSet.clone().
Referenced by antlr.Lookahead.intersection(), and antlr.collections.impl.BitSet.subset().
void antlr.collections.impl.BitSet.andInPlace | ( | BitSet | a | ) |
References antlr.collections.impl.BitSet.bits.
Referenced by antlr.collections.impl.BitSet.and().
void antlr.collections.impl.BitSet.clear | ( | ) |
References antlr.collections.impl.BitSet.bits.
Referenced by antlr.LLkAnalyzer.look().
void antlr.collections.impl.BitSet.clear | ( | int | el | ) |
Object antlr.collections.impl.BitSet.clone | ( | ) |
References antlr.collections.impl.BitSet.bits, and antlr.collections.impl.BitSet.clone().
Referenced by antlr.collections.impl.BitSet.and(), antlr.Lookahead.clone(), antlr.collections.impl.BitSet.clone(), antlr.Lookahead.combineWith(), antlr.LLkAnalyzer.look(), antlr.CodeGenerator.markBitsetForGen(), antlr.collections.impl.BitSet.not(), and antlr.collections.impl.BitSet.or().
int antlr.collections.impl.BitSet.degree | ( | ) |
References antlr.collections.impl.BitSet.BITS, and antlr.collections.impl.BitSet.bits.
Referenced by antlr.PythonCodeGenerator.genCommonBlock(), antlr.JavaCodeGenerator.genCommonBlock(), antlr.CSharpCodeGenerator.genCommonBlock(), antlr.CppCodeGenerator.genCommonBlock(), antlr.PythonCodeGenerator.getLookaheadTestTerm(), antlr.JavaCodeGenerator.getLookaheadTestTerm(), antlr.CSharpCodeGenerator.getLookaheadTestTerm(), antlr.CppCodeGenerator.getLookaheadTestTerm(), antlr.LLkAnalyzer.lookaheadEquivForApproxAndFullAnalysis(), antlr.PythonCodeGenerator.lookaheadIsEmpty(), antlr.JavaCodeGenerator.lookaheadIsEmpty(), antlr.CSharpCodeGenerator.lookaheadIsEmpty(), antlr.CppCodeGenerator.lookaheadIsEmpty(), and antlr.collections.impl.BitSet.toArray().
boolean antlr.collections.impl.BitSet.equals | ( | Object | obj | ) |
code "inherited" from java.util.BitSet
References antlr.collections.impl.BitSet.bits.
Referenced by antlr.CodeGenerator.markBitsetForGen(), and antlr.collections.impl.BitSet.subset().
static Vector antlr.collections.impl.BitSet.getRanges | ( | int[] | elems | ) | [static] |
Find ranges in a set element array.
elems | The array of elements representing the set, usually from Bit Set.toArray(). |
References antlr.collections.impl.Vector.appendElement().
void antlr.collections.impl.BitSet.growToInclude | ( | int | bit | ) |
Grows the set to a larger number of bits.
bit | element that must fit in set |
References antlr.collections.impl.BitSet.bits.
Referenced by antlr.collections.impl.BitSet.add(), antlr.collections.impl.BitSet.clear(), antlr.PythonCodeGenerator.genBitsets(), antlr.JavaCodeGenerator.genBitsets(), antlr.CSharpCodeGenerator.genBitsets(), antlr.CppCodeGenerator.genBitsets(), antlr.CppCodeGenerator.genBitsetsHeader(), antlr.collections.impl.BitSet.notInPlace(), and antlr.collections.impl.BitSet.remove().
int antlr.collections.impl.BitSet.lengthInLongWords | ( | ) |
return how much space is being used by the bits array not how many actually have member bits on.
References antlr.collections.impl.BitSet.bits.
boolean antlr.collections.impl.BitSet.member | ( | int | el | ) |
References antlr.collections.impl.BitSet.bits.
Referenced by antlr.ANTLRParser.alternative(), PascalParser.caseStatement(), antlr.Tool.checkForInvalidArguments(), antlr.preprocessor.Preprocessor.class_def(), SymtabPhase.constList(), PascalTreeParserSuper.constList(), antlr.ANTLRParser.ebnf(), antlr.ANTLRParser.elementNoOptionSpec(), PascalParser.expression(), PascalParser.factor(), PascalParser.fileType(), SymtabPhase.formalParameterList(), PascalTreeParserSuper.formalParameterList(), antlr.CppCodeGenerator.genBitsets(), PascalParser.ifStatement(), antlr.preprocessor.PreprocessorLexer.mACTION(), antlr.actions.python.ActionLexer.mACTION(), antlr.actions.java.ActionLexer.mACTION(), antlr.actions.csharp.ActionLexer.mACTION(), antlr.actions.cpp.ActionLexer.mACTION(), antlr.preprocessor.PreprocessorLexer.mALT(), antlr.actions.python.ActionLexer.mARG(), antlr.actions.java.ActionLexer.mARG(), antlr.actions.csharp.ActionLexer.mARG(), antlr.actions.cpp.ActionLexer.mARG(), antlr.preprocessor.PreprocessorLexer.mARG_ACTION(), antlr.preprocessor.PreprocessorLexer.mASSIGN_RHS(), antlr.actions.python.ActionLexer.mAST_CONSTRUCTOR(), antlr.actions.java.ActionLexer.mAST_CONSTRUCTOR(), antlr.actions.csharp.ActionLexer.mAST_CONSTRUCTOR(), antlr.actions.python.ActionLexer.mAST_CTOR_ELEMENT(), antlr.actions.java.ActionLexer.mAST_CTOR_ELEMENT(), antlr.actions.csharp.ActionLexer.mAST_CTOR_ELEMENT(), antlr.actions.cpp.ActionLexer.mAST_CTOR_ELEMENT(), antlr.actions.python.ActionLexer.mAST_ITEM(), antlr.actions.java.ActionLexer.mAST_ITEM(), antlr.actions.csharp.ActionLexer.mAST_ITEM(), antlr.actions.cpp.ActionLexer.mAST_ITEM(), antlr.actions.python.ActionLexer.mCHAR(), antlr.actions.java.ActionLexer.mCHAR(), antlr.actions.csharp.ActionLexer.mCHAR(), antlr.actions.cpp.ActionLexer.mCHAR(), antlr.preprocessor.PreprocessorLexer.mCHAR_LITERAL(), antlr.ANTLRLexer.mCHAR_LITERAL(), PascalLexer.mCOMMENT_1(), PascalLexer.mCOMMENT_2(), antlr.preprocessor.PreprocessorLexer.mCURLY_BLOCK_SCARF(), antlr.preprocessor.PreprocessorLexer.mELEMENT(), antlr.actions.python.ActionLexer.mID(), antlr.actions.java.ActionLexer.mID(), antlr.actions.csharp.ActionLexer.mID(), antlr.actions.cpp.ActionLexer.mID(), antlr.actions.python.ActionLexer.mID_ELEMENT(), antlr.actions.java.ActionLexer.mID_ELEMENT(), antlr.actions.csharp.ActionLexer.mID_ELEMENT(), antlr.actions.cpp.ActionLexer.mID_ELEMENT(), antlr.preprocessor.PreprocessorLexer.mID_OR_KEYWORD(), antlr.actions.python.ActionLexer.mINT_OR_FLOAT(), antlr.actions.java.ActionLexer.mINT_OR_FLOAT(), antlr.actions.csharp.ActionLexer.mINT_OR_FLOAT(), antlr.actions.cpp.ActionLexer.mINT_OR_FLOAT(), antlr.ANTLRTokdefLexer.mML_COMMENT(), antlr.ANTLRLexer.mML_COMMENT(), antlr.ANTLRLexer.mNESTED_ACTION(), antlr.ANTLRLexer.mNESTED_ARG_ACTION(), antlr.preprocessor.PreprocessorLexer.mRULE_BLOCK(), antlr.ANTLRTokdefLexer.mSL_COMMENT(), antlr.ANTLRLexer.mSL_COMMENT(), antlr.ANTLRTokdefLexer.mSTRING(), antlr.actions.python.ActionLexer.mSTRING(), antlr.actions.java.ActionLexer.mSTRING(), antlr.actions.csharp.ActionLexer.mSTRING(), antlr.actions.cpp.ActionLexer.mSTRING(), antlr.preprocessor.PreprocessorLexer.mSTRING_LITERAL(), PascalLexer.mSTRING_LITERAL(), antlr.ANTLRLexer.mSTRING_LITERAL(), antlr.actions.python.CodeLexer.mSTUFF(), antlr.actions.python.ActionLexer.mSTUFF(), antlr.actions.java.ActionLexer.mSTUFF(), antlr.actions.csharp.ActionLexer.mSTUFF(), antlr.actions.cpp.ActionLexer.mSTUFF(), antlr.preprocessor.PreprocessorLexer.mSUBRULE_BLOCK(), antlr.actions.python.ActionLexer.mTEXT_ARG(), antlr.actions.java.ActionLexer.mTEXT_ARG(), antlr.actions.csharp.ActionLexer.mTEXT_ARG(), antlr.actions.cpp.ActionLexer.mTEXT_ARG(), antlr.actions.python.ActionLexer.mTEXT_ARG_ID_ELEMENT(), antlr.actions.java.ActionLexer.mTEXT_ARG_ID_ELEMENT(), antlr.actions.csharp.ActionLexer.mTEXT_ARG_ID_ELEMENT(), antlr.actions.cpp.ActionLexer.mTEXT_ARG_ID_ELEMENT(), antlr.actions.python.ActionLexer.mTEXT_ITEM(), antlr.actions.java.ActionLexer.mTEXT_ITEM(), antlr.actions.csharp.ActionLexer.mTEXT_ITEM(), antlr.actions.cpp.ActionLexer.mTEXT_ITEM(), antlr.actions.python.ActionLexer.mTREE_ELEMENT(), antlr.actions.java.ActionLexer.mTREE_ELEMENT(), antlr.actions.csharp.ActionLexer.mTREE_ELEMENT(), antlr.actions.cpp.ActionLexer.mTREE_ELEMENT(), antlr.ANTLRLexer.mWS_OPT(), antlr.TokenStreamRewriteEngine.nextToken(), antlr.TokenStreamHiddenTokenFilter.nextToken(), antlr.TokenStreamBasicFilter.nextToken(), antlr.preprocessor.PreprocessorLexer.nextToken(), SymtabPhase.parameterList(), PascalTreeParserSuper.parameterList(), SymtabPhase.recordVariableList(), PascalTreeParserSuper.recordVariableList(), antlr.ANTLRParser.rootNode(), antlr.ANTLRParser.rules(), SymtabPhase.set(), PascalTreeParserSuper.set(), PascalParser.simpleExpression(), PascalParser.simpleStatement(), PascalParser.simpleType(), SymtabPhase.statements(), PascalTreeParserSuper.statements(), PascalParser.tag(), antlr.collections.impl.BitSet.toArray(), antlr.collections.impl.BitSet.toString(), antlr.ANTLRParser.tree(), SymtabPhase.typeList(), PascalTreeParserSuper.typeList(), SymtabPhase.variable(), PascalTreeParserSuper.variable(), and PascalParser.variantPart().
boolean antlr.collections.impl.BitSet.nil | ( | ) |
References antlr.collections.impl.BitSet.bits.
Referenced by antlr.LLkAnalyzer.FOLLOW(), and antlr.Lookahead.nil().
BitSet antlr.collections.impl.BitSet.not | ( | ) |
void antlr.collections.impl.BitSet.notInPlace | ( | int | minBit, | |
int | maxBit | |||
) |
complement bits in the range minBit..maxBit.
References antlr.collections.impl.BitSet.bits, and antlr.collections.impl.BitSet.growToInclude().
void antlr.collections.impl.BitSet.notInPlace | ( | ) |
References antlr.collections.impl.BitSet.bits.
Referenced by antlr.LLkAnalyzer.look(), antlr.collections.impl.BitSet.not(), and antlr.collections.impl.BitSet.notInPlace().
void antlr.collections.impl.BitSet.notInPlace | ( | int | maxBit | ) |
complement bits in the range 0..maxBit.
References antlr.collections.impl.BitSet.notInPlace().
static BitSet antlr.collections.impl.BitSet.of | ( | int | el | ) | [static] |
References antlr.collections.impl.BitSet.add(), and antlr.collections.impl.BitSet.BitSet().
Referenced by antlr.LLkAnalyzer.look(), and antlr.ANTLRParser.setBlockElement().
return this | a in a new set
References antlr.collections.impl.BitSet.clone(), and antlr.collections.impl.BitSet.orInPlace().
void antlr.collections.impl.BitSet.orInPlace | ( | BitSet | a | ) |
References antlr.collections.impl.BitSet.bits.
Referenced by antlr.ANTLRParser.charSet(), antlr.Lookahead.combineWith(), and antlr.collections.impl.BitSet.or().
void antlr.collections.impl.BitSet.remove | ( | int | el | ) |
References antlr.collections.impl.BitSet.bits, and antlr.collections.impl.BitSet.growToInclude().
Referenced by antlr.LLkAnalyzer.look().
int antlr.collections.impl.BitSet.size | ( | ) |
References antlr.collections.impl.BitSet.bits, and antlr.collections.impl.BitSet.LOG_BITS.
Referenced by antlr.CppCodeGenerator.genBitsets().
boolean antlr.collections.impl.BitSet.subset | ( | BitSet | a | ) |
Is this contained within a?
References antlr.collections.impl.BitSet.and(), and antlr.collections.impl.BitSet.equals().
void antlr.collections.impl.BitSet.subtractInPlace | ( | BitSet | a | ) |
Subtract the elements of 'a' from 'this' in-place. Basically, just turn off all bits of 'this' that are in 'a'.
References antlr.collections.impl.BitSet.bits.
int [] antlr.collections.impl.BitSet.toArray | ( | ) |
References antlr.collections.impl.BitSet.bits, antlr.collections.impl.BitSet.degree(), antlr.collections.impl.BitSet.LOG_BITS, and antlr.collections.impl.BitSet.member().
Referenced by antlr.PythonCodeGenerator.genCases(), antlr.JavaCodeGenerator.genCases(), antlr.CSharpCodeGenerator.genCases(), antlr.CppCodeGenerator.genCases(), antlr.PythonCodeGenerator.getLookaheadTestTerm(), antlr.JavaCodeGenerator.getLookaheadTestTerm(), antlr.CSharpCodeGenerator.getLookaheadTestTerm(), antlr.CppCodeGenerator.getLookaheadTestTerm(), antlr.LLkAnalyzer.look(), antlr.HTMLCodeGenerator.printSet(), antlr.DocBookCodeGenerator.printSet(), antlr.DiagnosticCodeGenerator.printSet(), and antlr.collections.impl.BitSet.toStringWithRanges().
long [] antlr.collections.impl.BitSet.toPackedArray | ( | ) |
References antlr.collections.impl.BitSet.bits.
String antlr.collections.impl.BitSet.toString | ( | String | separator | ) |
Transform a bit set into a string by formatting each element as an integer The string to put in between elements
References antlr.collections.impl.BitSet.bits, antlr.collections.impl.BitSet.LOG_BITS, and antlr.collections.impl.BitSet.member().
String antlr.collections.impl.BitSet.toString | ( | ) |
Referenced by antlr.PythonCodeGenerator.getLookaheadTestExpression(), antlr.JavaCodeGenerator.getLookaheadTestExpression(), antlr.CSharpCodeGenerator.getLookaheadTestExpression(), antlr.CppCodeGenerator.getLookaheadTestExpression(), antlr.LLkAnalyzer.look(), antlr.Lookahead.toString(), and antlr.collections.impl.BitSet.toString().
String antlr.collections.impl.BitSet.toString | ( | String | separator, | |
Vector | vocabulary | |||
) |
Create a string representation where instead of integer elements, the ith element of vocabulary is displayed instead. Vocabulary is a Vector of Strings. The string to put in between elements
References antlr.collections.impl.BitSet.bits, antlr.collections.impl.Vector.elementAt(), antlr.collections.impl.BitSet.LOG_BITS, antlr.collections.impl.BitSet.member(), antlr.collections.impl.Vector.size(), and antlr.collections.impl.BitSet.toString().
String antlr.collections.impl.BitSet.toString | ( | String | separator, | |
CharFormatter | formatter | |||
) |
Transform a bit set into a string of characters. The string to put in between elements
formatter | An object implementing the CharFormatter interface. |
References antlr.collections.impl.BitSet.bits, antlr.CharFormatter.literalChar(), antlr.collections.impl.BitSet.LOG_BITS, and antlr.collections.impl.BitSet.member().
String antlr.collections.impl.BitSet.toStringOfHalfWords | ( | ) |
Dump a comma-separated list of the words making up the bit set. Split each 64 bit number into two more manageable 32 bit numbers. This generates a comma-separated list of C++-like unsigned long constants.
References antlr.collections.impl.BitSet.bits.
Referenced by antlr.CppCodeGenerator.genBitsets().
String antlr.collections.impl.BitSet.toStringOfWords | ( | ) |
Dump a comma-separated list of the words making up the bit set. This generates a comma-separated list of Java-like long int constants.
References antlr.collections.impl.BitSet.bits.
String antlr.collections.impl.BitSet.toStringWithRanges | ( | String | separator, | |
CharFormatter | formatter | |||
) |
Print out the bit set but collapse char ranges.
References antlr.CharFormatter.literalChar(), and antlr.collections.impl.BitSet.toArray().
final int antlr.collections.impl.BitSet.BITS = 64 [static, protected] |
Referenced by antlr.collections.impl.BitSet.BitSet(), and antlr.collections.impl.BitSet.degree().
long antlr.collections.impl.BitSet.bits[] [protected] |
The actual data bits
Referenced by antlr.collections.impl.BitSet.add(), antlr.collections.impl.BitSet.andInPlace(), antlr.collections.impl.BitSet.BitSet(), antlr.collections.impl.BitSet.clear(), antlr.collections.impl.BitSet.clone(), antlr.collections.impl.BitSet.degree(), antlr.collections.impl.BitSet.equals(), antlr.collections.impl.BitSet.growToInclude(), antlr.collections.impl.BitSet.lengthInLongWords(), antlr.collections.impl.BitSet.member(), antlr.collections.impl.BitSet.nil(), antlr.collections.impl.BitSet.notInPlace(), antlr.collections.impl.BitSet.orInPlace(), antlr.collections.impl.BitSet.remove(), antlr.collections.impl.BitSet.size(), antlr.collections.impl.BitSet.subtractInPlace(), antlr.collections.impl.BitSet.toArray(), antlr.collections.impl.BitSet.toPackedArray(), antlr.collections.impl.BitSet.toString(), antlr.collections.impl.BitSet.toStringOfHalfWords(), and antlr.collections.impl.BitSet.toStringOfWords().
final int antlr.collections.impl.BitSet.LOG_BITS = 6 [static, protected] |
final int antlr.collections.impl.BitSet.MOD_MASK = BITS - 1 [static, protected] |
final int antlr.collections.impl.BitSet.NIBBLE = 4 [static, protected] |