/** or this element into this set (grow as necessary to accommodate) */ public void add(int el) { //System.out.println("add("+el+")"); int n = wordNumber(el); //System.out.println("word number is "+n); //System.out.println("bits.length "+bits.length); if (n >= bits.length) { growToInclude(el); } bits[n] |= bitMask(el); }
/** complement bits in the range minBit..maxBit.*/ public void notInPlace(int minBit, int maxBit) { // make sure that we have room for maxBit growToInclude(maxBit); for (int i = minBit; i <= maxBit; i++) { int n = wordNumber(i); bits[n] ^= bitMask(i); } }
public void clear(int el) { int n = wordNumber(el); if (n >= bits.length) { // grow as necessary to accommodate growToInclude(el); } bits[n] &= ~bitMask(el); }
public void remove(int el) { int n = wordNumber(el); if (n >= bits.length) { growToInclude(el); } bits[n] &= ~bitMask(el); }
/** Generate all the bitsets to be used in the parser or lexer * Generate the raw bitset data like "long _tokenSet1_data[] = {...};" * and the BitSet object declarations like "BitSet _tokenSet1 = new BitSet(_tokenSet1_data);" * Note that most languages do not support object initialization inside a * class definition, so other code-generators may have to separate the * bitset declarations from the initializations (e.g., put the initializations * in the generated constructor instead). * @param bitsetList The list of bitsets to generate. * @param maxVocabulary Ensure that each generated bitset can contain at least this value. */ protected void genBitsets( Vector bitsetList, int maxVocabulary ) { println(""); for (int i = 0; i < bitsetList.size(); i++) { BitSet p = (BitSet)bitsetList.elementAt(i); // Ensure that generated BitSet is large enough for vocabulary p.growToInclude(maxVocabulary); genBitSet(p, i); } }
/** Generate all the bitsets to be used in the parser or lexer * Generate the raw bitset data like "long _tokenSet1_data[] = {...}" * and the BitSet object declarations like "BitSet _tokenSet1 = new BitSet(_tokenSet1_data)" * Note that most languages do not support object initialization inside a * class definition, so other code-generators may have to separate the * bitset declarations from the initializations (e.g., put the initializations * in the generated constructor instead). * @param bitsetList The list of bitsets to generate. * @param maxVocabulary Ensure that each generated bitset can contain at least this value. */ protected void genBitsets(Vector bitsetList, int maxVocabulary ) { println(""); for (int i = 0; i < bitsetList.size(); i++) { BitSet p = (BitSet)bitsetList.elementAt(i); // Ensure that generated BitSet is large enough for vocabulary p.growToInclude(maxVocabulary); genBitSet(p, i); } }
/** Generate all the bitsets to be used in the parser or lexer * Generate the raw bitset data like "long _tokenSet1_data[] = {...};" * and the BitSet object declarations like "BitSet _tokenSet1 = new BitSet(_tokenSet1_data);" * Note that most languages do not support object initialization inside a * class definition, so other code-generators may have to separate the * bitset declarations from the initializations (e.g., put the initializations * in the generated constructor instead). * @param bitsetList The list of bitsets to generate. * @param maxVocabulary Ensure that each generated bitset can contain at least this value. */ protected void genBitsets(Vector bitsetList, int maxVocabulary ) { println("", NO_MAPPING); for (int i = 0; i < bitsetList.size(); i++) { BitSet p = (BitSet)bitsetList.elementAt(i); // Ensure that generated BitSet is large enough for vocabulary p.growToInclude(maxVocabulary); genBitSet(p, i); } }
protected void genBitsetsHeader( Vector bitsetList, int maxVocabulary ) { println(""); for (int i = 0; i < bitsetList.size(); i++) { BitSet p = (BitSet)bitsetList.elementAt(i); // Ensure that generated BitSet is large enough for vocabulary p.growToInclude(maxVocabulary); // initialization data println("static const unsigned long " + getBitsetName(i) + "_data_" + "[];"); // BitSet object println("static const "+namespaceAntlr+"BitSet " + getBitsetName(i) + ";"); } } /** Generate the finish of a block, using a combination of the info
p.growToInclude(maxVocabulary);