Examples of IntArray


Examples of org.apache.lucene.facet.collections.IntArray

    assertTrue(array.equals(array));
  }
 
  @Test
  public void test1() {
    IntArray array = new IntArray();
    IntArray array2 = new IntArray();
   
    assertEquals(0, array.size());
   
    for (int i = 0; i < 100; ++i) {
      array.addToArray(99-i);
      array2.addToArray(99-i);
    }
   
    assertEquals(100, array.size());
    for (int i = 0; i < 100; ++i) {
      assertEquals(i, array.get(99-i));
View Full Code Here

Examples of org.apache.lucene.facet.collections.IntArray

    assertTrue(array.equals(array2));
  }
 
  @Test
  public void test2() {
    IntArray array = new IntArray();
    IntArray array2 = new IntArray();
    IntArray array3 = new IntArray();
   
    for (int i = 0; i < 100; ++i) {
      array.addToArray(i);
    }

    for (int i = 0; i < 100; ++i) {
      array2.addToArray(i*2);
    }

    for (int i = 0; i < 50; ++i) {
      array3.addToArray(i*2);
    }

    assertFalse(array.equals(array2));
   
    array.intersect(array2);
View Full Code Here

Examples of org.apache.lucene.facet.collections.IntArray

  @Test
  public void testSet() {
    int[] original = new int[] { 2,4,6,8,10,12,14 };
    int[] toSet = new int[] { 1,3,5,7,9,11};
   
    IntArray arr = new IntArray();
    for (int val : original) {
      arr.addToArray(val);
    }
   
    for (int i = 0; i < toSet.length; i++ ) {
      int val = toSet[i];
      arr.set(i, val);
    }
   
    // Test to see if the set worked correctly
    for (int i = 0; i < toSet.length; i++ ) {
      assertEquals(toSet[i], arr.get(i));
    }
   
    // Now attempt to set something outside of the array
    try {
      arr.set(100, 99);
      fail("IntArray.set should have thrown an exception for attempting to set outside the array");
    } catch (ArrayIndexOutOfBoundsException e) {
      // We expected this to happen so let it fall through
      // silently
    }
View Full Code Here

Examples of org.apache.lucene.util.collections.IntArray

public class IntArrayTest extends LuceneTestCase {
 
  @Test
  public void test0() {
    IntArray array = new IntArray();
   
    assertEquals(0, array.size());
   
    for (int i = 0; i < 100; ++i) {
      array.addToArray(i);
    }
   
    assertEquals(100, array.size());
    for (int i = 0; i < 100; ++i) {
      assertEquals(i, array.get(i));
    }
   
    assertTrue(array.equals(array));
  }
View Full Code Here

Examples of org.apache.lucene.util.collections.IntArray

    assertTrue(array.equals(array));
  }
 
  @Test
  public void test1() {
    IntArray array = new IntArray();
    IntArray array2 = new IntArray();
   
    assertEquals(0, array.size());
   
    for (int i = 0; i < 100; ++i) {
      array.addToArray(99-i);
      array2.addToArray(99-i);
    }
   
    assertEquals(100, array.size());
    for (int i = 0; i < 100; ++i) {
      assertEquals(i, array.get(99-i));
View Full Code Here

Examples of org.apache.lucene.util.collections.IntArray

    assertTrue(array.equals(array2));
  }
 
  @Test
  public void test2() {
    IntArray array = new IntArray();
    IntArray array2 = new IntArray();
    IntArray array3 = new IntArray();
   
    for (int i = 0; i < 100; ++i) {
      array.addToArray(i);
    }

    for (int i = 0; i < 100; ++i) {
      array2.addToArray(i*2);
    }

    for (int i = 0; i < 50; ++i) {
      array3.addToArray(i*2);
    }

    assertFalse(array.equals(array2));
   
    array.intersect(array2);
View Full Code Here

Examples of org.apache.lucene.util.collections.IntArray

  @Test
  public void testSet() {
    int[] original = new int[] { 2,4,6,8,10,12,14 };
    int[] toSet = new int[] { 1,3,5,7,9,11};
   
    IntArray arr = new IntArray();
    for (int val : original) {
      arr.addToArray(val);
    }
   
    for (int i = 0; i < toSet.length; i++ ) {
      int val = toSet[i];
      arr.set(i, val);
    }
   
    // Test to see if the set worked correctly
    for (int i = 0; i < toSet.length; i++ ) {
      assertEquals(toSet[i], arr.get(i));
    }
   
    // Now attempt to set something outside of the array
    try {
      arr.set(100, 99);
      fail("IntArray.set should have thrown an exception for attempting to set outside the array");
    } catch (ArrayIndexOutOfBoundsException e) {
      // We expected this to happen so let it fall through
      // silently
    }
View Full Code Here

Examples of org.apache.lucene.util.collections.IntArray

      FacetIndexingParams iparams, CategoryListParams clp) throws IOException {
 
    final int maxDoc = reader.maxDoc();
    int[][][]dpf  = new int[maxDoc][][];
    int numPartitions = (int)Math.ceil(taxo.getSize()/(double)iparams.getPartitionSize());
    IntArray docCategories = new IntArray();
    for (int part=0; part<numPartitions; part++) {
      CategoryListIterator cli = clp.createCategoryListIterator(reader, part);
      if (cli.init()) {
        for (int doc=0; doc<maxDoc; doc++) {
          if (cli.skipTo(doc)) {
            docCategories.clear(false);
            if (dpf[doc]==null) {
              dpf[doc] = new int[numPartitions][];
            }
            long category;
            while ((category = cli.nextCategory()) <= Integer.MAX_VALUE) {
              docCategories.addToArray((int)category);
            }
            final int size = docCategories.size();
            dpf[doc][part] = new int[size];
            for (int i=0; i<size; i++) {
              dpf[doc][part][i] = docCategories.get(i);
            }
          }
        }
      }
    }
View Full Code Here

Examples of org.apache.marmotta.commons.sesame.tripletable.IntArray

            KiWiTriple result = new KiWiTriple(subject,predicate,object,context, importDate);

            // statement existance check; use the triple registry to lookup if there are any concurrent triple creations
            if(config.isStatementExistanceCheck()) {
                IntArray cacheKey = IntArray.createSPOCKey(subject, predicate, object, context);
                long tripleId = registry.lookupKey(cacheKey);

                if(tripleId >= 0) {
                    // try getting id from registry
                    result.setId(tripleId);
View Full Code Here

Examples of org.apache.marmotta.kiwi.model.caching.IntArray

     * @param inferred if true, inferred triples are included in the result; if false not
     * @return the result set if the query is found in the cache, returns null if the query is not found
     */
    @SuppressWarnings("unchecked")
  public List<KiWiTriple> listTriples(KiWiResource subject, KiWiUriResource property, KiWiNode object, KiWiUriResource context, boolean inferred) {
        IntArray key = createCacheKey(subject,property,object,context,inferred);
        if(queryCache.get(key) != null) return (List<KiWiTriple>)queryCache.get(key).getObjectValue();
        else
            return null;
    }
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.