Examples of BitSet


Examples of antlr.collections.impl.BitSet

   */
  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);
        }
    }
View Full Code Here

Examples of beaver.comp.util.BitSet

      }
    }

    static private void writeStaticReturns(Grammar grammar, Writer out) throws IOException
    {
      BitSet ret_elems = new BitSet();
      for (int i = 0; i < grammar.rules.length; i++)
      {
        Production rule = grammar.rules[i];
        if (rule.code == null && rule.rhs.size() > 1)
        {
          int n = indexOfLastReferencedSymbol(rule.rhs);
                    if (n == 0)
                        continue;
                    if (n < 0)
                        n = rule.rhs.size() - 1;
          if (ret_elems.add(n))
          {
            out.write("\n\tstatic final Action RETURN");
            out.write(String.valueOf(n + 1));
            out.write(" = new Action() {\n");
            out.write("\t\tpublic Symbol reduce(Symbol[] _symbols, int offset) {\n");
View Full Code Here

Examples of com.carrotsearch.hppc.BitSet

    public static void before()
    {
        final int MB = 1024 * 1024;
        final int bits = 128 * MB * 4;

        hppc = new BitSet(bits);
        jre = new java.util.BitSet(bits);

        // Randomly fill every bits (this is fairly dense distribution).
        for (int i = 0; i < bits; i += 1 + rnd.nextInt(10))
        {
View Full Code Here

Examples of com.salesforce.phoenix.util.BitSet

                } else {
                    dataRowKeyLocator[0][pos] = 0;
                    dataRowKeyLocator[1][pos] = 0;
                }
            }
            BitSet descIndexColumnBitSet = rowKeyMetaData.getDescIndexColumnBitSet();
            int j = 0;
            Iterator<ColumnReference> iterator = indexedColumns.iterator();
            for (int i = 0; i < nIndexedColumns; i++) {
                PDataType dataColumnType;
                boolean isNullable = true;
                boolean isDataColumnInverted = false;
                ColumnModifier dataColumnModifier = null;
                if (dataPkPosition[i] == -1) {
                    dataColumnType = indexedColumnTypes.get(j);
                    ImmutableBytesPtr value = valueGetter.getLatestValue(iterator.next());
                    if (value == null) {
                        ptr.set(ByteUtil.EMPTY_BYTE_ARRAY);
                    } else {
                        ptr.set(value.copyBytesIfNecessary());
                    }
                    j++;
               } else {
                   Field field = dataRowKeySchema.getField(dataPkPosition[i]);
                    dataColumnType = field.getDataType();
                    ptr.set(rowKeyPtr.get(), dataRowKeyLocator[0][i], dataRowKeyLocator[1][i]);
                    dataColumnModifier = field.getColumnModifier();
                    isDataColumnInverted = dataColumnModifier != null;
                    isNullable = field.isNullable();
                }
                PDataType indexColumnType = IndexUtil.getIndexColumnDataType(isNullable, dataColumnType);
                boolean isBytesComparable = dataColumnType.isBytesComparableWith(indexColumnType) ;
                if (isBytesComparable && isDataColumnInverted == descIndexColumnBitSet.get(i)) {
                    output.write(ptr.get(), ptr.getOffset(), ptr.getLength());
                } else {
                    if (!isBytesComparable)  {
                        indexColumnType.coerceBytes(ptr, dataColumnType, dataColumnModifier, null);
                    }
                    if (descIndexColumnBitSet.get(i) != isDataColumnInverted) {
                        writeInverted(ptr.get(), ptr.getOffset(), ptr.getLength(), output);
                    } else {
                        output.write(ptr.get(), ptr.getOffset(), ptr.getLength());
                    }
                }
View Full Code Here

Examples of java.util.BitSet

     */
    private int updateTablesForFeature(Prototypes protos, Feature f) {
        Arrays.fill(this.mrsFeatureEvidence, (short) 0);
        int ActualProtoNum = 0;
        for (Prototype proto : protos) {
            BitSet bsProtoPruner[][] = proto.getProtoPruner();
            /* Prune Protos of current Proto Set */
            BitSet bsProto = (BitSet) bsProtoPruner[0][(f.getX()+128) >> 2].clone();
            bsProto.and(bsProtoPruner[1][(f.getY()+128) >> 2]);
            bsProto.and(bsProtoPruner[2][f.getTheta() >> 2]);
           
            if (!bsProto.isEmpty()) {
                for (int nProto=0;
                    -1 != (nProto = bsProto.nextSetBit(nProto));
                    nProto++) {
                    LearntFeature lf = proto.get(nProto);
                    byte rbConfigs[] = lf.getConfigs();
                    int nX = Math.abs(lf.getA() * f.getX() - lf.getB() * f.getY() + lf.getC());
                    int nY = Math.abs((f.getTheta() - lf.getAngle()) << 8);
View Full Code Here

Examples of java.util.BitSet

     * Sets the config bits.
     *
     * @param nInts the new config bits
     */
    private void setConfigBits(int[] nInts) {
      BitSet Configs = new BitSet(Prototypes.MAX_NUM_CONFIGS);
        int k = 0;
        for (int n: nInts) {
            int nBit = 1;
            for (int j=0; j<32; j++, nBit <<= 1) {
                if ((nBit & n) != 0) {
                    Configs.set(k);
                }
                k++;
            }
        }
        this.mrbConfig = new byte[Configs.cardinality()];
        int nBit = 0;
        for (int nConfig = 0;
        -1 != (nConfig = Configs.nextSetBit(nConfig));
        nConfig++) {
          this.mrbConfig[nBit++] = (byte) nConfig;
        }
    }
View Full Code Here

Examples of java.util.BitSet

        this(field, new String[] { value });
    }

    public BitSet bits(IndexReader reader) throws IOException {
        //Create a new BitSet with a capacity equal to the size of the index.
        BitSet bits = new BitSet(reader.maxDoc());
        //Match all search terms.
        for (int i=0; i < searchTerms.length; i++) {
            //Get an enumeration of all the documents that match the specified
            //field value.
            TermDocs matchingDocs = reader.termDocs(searchTerms[i]);
            try {
                if (matchingDocs != null) {
                    while(matchingDocs.next()) {
                        bits.set(matchingDocs.doc());
                    }
                }
            }
            finally {
                if (matchingDocs != null) {
View Full Code Here

Examples of java.util.BitSet

        if (start < 0 || end < 0) {
            return null;
        }

        BitSet bitSet = new BitSet();
        bitSetAsStr = bitSetAsStr.substring(start + 1, end);
        for (String str : bitSetAsStr.split(",")) {
            str = str.trim();
            if (str.length() > 0)
                bitSet.set(Integer.parseInt(str.trim()));
        }
        return bitSet;
    }
View Full Code Here

Examples of java.util.BitSet

        for (Object obj : constrElement.elements()) {
            Element element = (Element) obj;
            Constraint constraint = null;

            if (RasterConstraint.class.getSimpleName().equals(element.getName())) {
                BitSet bs = getResult(obj, BitSet.class, element);
                int length = Integer.parseInt(element.attributeValue("length"));
                constraint = new RasterConstraint(new WeekRasterImpl(
                        new BitRasterImpl(bs, length)));

            } else if (EventOrderConstraint.class.getSimpleName().equals(element.getName())) {
View Full Code Here

Examples of java.util.BitSet

    private BitSet bitSet;
    private int iSize;

    public BitRasterImpl(int length) {
        bitSet = new BitSet(length);
        iSize = length;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.