Examples of Bits


Examples of com.badlogic.gdx.utils.Bits

   */
  public Entity(){
    components = new Bag<Component>();
    componentsArray = new Array<Component>();
    immutableComponentsArray = new ImmutableArray<Component>(componentsArray);
    componentBits = new Bits();
    familyBits = new Bits();
    flags = 0;
   
    index = nextIndex++;
   
    componentAdded = new Signal<Entity>();
View Full Code Here

Examples of ivory.lsh.data.Bits

    assertTrue(!s.get(0));
  }

  @Test
  public void testHammingDistance() {
    Bits b1 = new Bits("11100011010111101010");// 11000001011100011110001111100000101001011110111111010111101100101111101100110001110000101000011010001000001001111010111001101001100100011100101010111100000110001101001001010000100001111000000110011110001010101110001001001111010111010111100011001111111000110110000010001100111000001010010000110000000010100101110011001110111011110011010001000110110100111000001001111000111110111111100101011000010110000110100101001101000001110001110110010101000101001001000000000110110101001011111010111010101010001010010000111000001100100101110001111111011100001101011101000011110011111111010001001100001100111110000010111110101010000000101100011110011000010100001011101011001111111011011110010011110101000010001110011100111100101000110111010100011111101000100111010111111100001110110001011010110000000011100000001011101100000001100110010100100000011111001110010101111100100100000110010100010011110111001101110010111010001101110110001010000000000101010010011111010110000110110111100101110010100111");
    NBitSignature s1 = new NBitSignature(b1);
    Bits b2 = new Bits("11101111111111110000");// 01110010110000000101011111000000101001011111111000000110011010111100100111110000010010010101001101101000100100010111111101101001000010010101111110111100010110000100100000010101100010001000100110110110001001100100000111000100010111000101101001001011110001110011000000000010100100001011001110100010001100000100100000111110111110101011000101000111111010001000001101011110100001110110110111110100000010011100000100101101000010110001100110110111000001001000011110000100011001010100100011111110101010000100110000100010000000100101110100011111101110101001011001100100010011111011000110101000010101110000101111100100101001011111110110100110011010000111111001001010100111100111000100000000010011000010101110001101011110110000110011010111000110100100000111001111110101011010110110001000111011111010100010011001100110001000110110111100011101011111001111100101000000010000010111011011011101101100100110111010101111010101110010111011101100011111110010110110010010101010000101101000111100010110");
    NBitSignature s2 = new NBitSignature(b2);

    assertTrue(7 == s1.hammingDistance(s2));
    assertTrue(7 == s2.hammingDistance(s1));
  }
View Full Code Here

Examples of org.apache.lucene.util.Bits

    public void undeleteAll()  {
      final int maxDoc = in.maxDoc();
      liveDocs = new FixedBitSet(in.maxDoc());
      if (in.hasDeletions()) {
        final Bits oldLiveDocs = in.getLiveDocs();
        assert oldLiveDocs != null;
        // this loop is a little bit ineffective, as Bits has no nextSetBit():
        for (int i = 0; i < maxDoc; i++) {
          if (oldLiveDocs.get(i)) liveDocs.set(i);
        }
      } else {
        // mark all docs as valid
        liveDocs.set(0, maxDoc);
      }
View Full Code Here

Examples of org.apache.lucene.util.Bits

    }
   
    @Override
    public Bits getDocsWithField(FieldInfo field) throws IOException {
      assert field.getDocValuesType() != null;
      Bits bits = in.getDocsWithField(field);
      assert bits != null;
      assert bits.length() == maxDoc;
      return new AssertingAtomicReader.AssertingBits(bits);
    }
View Full Code Here

Examples of org.apache.lucene.util.Bits

    // expected term:
    assertEquals(term, termsEnum.term());

    // 50% of the time time pass liveDocs:
    boolean useLiveDocs = options.contains(Option.LIVE_DOCS) && random().nextBoolean();
    Bits liveDocs;
    if (useLiveDocs) {
      liveDocs = globalLiveDocs;
      if (VERBOSE) {
        System.out.println("  use liveDocs");
      }
View Full Code Here

Examples of org.apache.lucene.util.Bits

    DirectoryReader reader = w.getReader();
    assertEquals(docCount, reader.numDocs());
    List<AtomicReaderContext> leaves = reader.leaves();
    for (AtomicReaderContext atomicReaderContext : leaves) {
      AtomicReader ar = atomicReaderContext.reader();
      Bits liveDocs = ar.getLiveDocs();
      int maxDoc = ar.maxDoc();
      for (int i = 0; i < maxDoc; i++) {
        if (liveDocs == null || liveDocs.get(i)) {
          assertTrue(liveIds.remove(ar.document(i).get("id")));
        }
      }
    }
    assertTrue(liveIds.isEmpty());
View Full Code Here

Examples of org.apache.lucene.util.Bits

    boolean rootWritten = false;
    int delta = atomicReader.maxDoc() / 100;
    if (delta == 0) delta = 1;
    int cnt = 0;
    bw = new BufferedWriter(new OutputStreamWriter(output, "UTF-8"));
    Bits live = atomicReader.getLiveDocs();
    try {
      // write out XML preamble
      if (preamble) {
        bw.write("<?xml version='1.0' encoding='UTF-8'?>\n");
      }
      bw.write("<" + rootElementName + ">\n");
      rootWritten = true;
      if (info) {
        // write out some statistics
        writeIndexInfo(bw);
      }
      Document doc = null;
      int i = -1;
      if (ranges == null) {
        ranges = new Ranges();
        ranges.set(0, atomicReader.maxDoc());
      }
      if (ranges.cardinality() > 0) {
        while ( (i = ranges.nextSetBit(++i)) != -1) {
          if (i >= atomicReader.maxDoc()) {
            break;
          }
          if (abort) {
            pn.message = "User requested abort.";
            pn.aborted = true;
            running = false;
            setChanged();
            notifyObservers(pn);
            break;
          }
          if (live != null && !live.get(i)) continue; // skip deleted docs
          doc = atomicReader.document(i);
          // write out fields
          writeDoc(bw, i, doc, decode, live);
          pn.curValue = i + 1;
          cnt++;
View Full Code Here

Examples of org.apache.lucene.util.Bits

 
  public static long getTotalTermFreq(IndexReader reader, String field, BytesRef termtext) throws Exception {
    BytesRef br = termtext;
    long totalTF = 0;
    try {
      Bits liveDocs = MultiFields.getLiveDocs(reader);
      //totalTF = MultiFields.totalTermFreq(reader, field, termtext);     
      totalTF = reader.totalTermFreq(new Term(field, br));
      return totalTF;
    } catch (Exception e) {
      return 0;
View Full Code Here

Examples of org.apache.lucene.util.Bits

    public Scorer scorer(final AtomicReaderContext context, final boolean scoreDocsInOrder,
                         final boolean topScorer, final Bits acceptDocs)
    throws IOException {
      assert !terms.isEmpty();
      final AtomicReader reader = context.reader();
      final Bits liveDocs = acceptDocs;
      final PostingsAndPosition[] postings = new PostingsAndPosition[terms.size()];

      final Terms fieldTerms = reader.terms(field);
      if (fieldTerms == null) {
        return null;
View Full Code Here

Examples of org.apache.lucene.util.Bits

    try {
      int next = docsEnum.nextDoc();
      if (next == DocIdSetIterator.NO_MORE_DOCS) {
        return false;
      }
      Bits liveDocs = MultiFields.getLiveDocs(reader);
      if (liveDocs != null) {
        while (!liveDocs.get(docsEnum.docID())) {
          next = docsEnum.nextDoc();
        }
      }
      return next == DocIdSetIterator.NO_MORE_DOCS ? false : true;
    } catch (IOException e) {
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.