Examples of IntSet


Examples of org.apache.hadoop.hbase.regionserver.idx.support.sets.IntSet

    // set up the indices
    byte[] column1 = Bytes.toBytes("column1");
    byte[] qualifier1 = Bytes.toBytes("qualifier1");
    byte[] value1 = Bytes.toBytes("value1");
    IdxIndex index1 = EasyMock.createMock(IdxIndex.class);
    IntSet bitSet1 = new IntSetBuilder().start().addAll(1,2,3,4,5).finish(100);
    EasyMock.expect(index1.head(value1, false)).andReturn(bitSet1);
    EasyMock.expect(index1.probeToString(value1)).andReturn(Bytes.toString(value1)).anyTimes();
    EasyMock.replay(index1);
    searchContext.indices.put(Pair.of(column1, qualifier1), index1);

    IdxIndex index2 = EasyMock.createMock(IdxIndex.class);
    byte[] column2 = Bytes.toBytes("column2");
    byte[] qualifier2 = Bytes.toBytes("qualifier2");
    byte[] value2 = Bytes.toBytes("value2");
    IntSet bitSet2 = new IntSetBuilder().start().addAll(6, 7, 8, 9, 10).finish(100);
    EasyMock.expect(index2.tail(value2, false)).andReturn(bitSet2);
    EasyMock.expect(index2.probeToString(value2)).andReturn(Bytes.toString(value2)).anyTimes();
    EasyMock.replay(index2);
    searchContext.indices.put(Pair.of(column2, qualifier2), index2);

    // perform the test
    IdxExpressionEvaluator evaluator = new IdxExpressionEvaluator();
    Expression exp = Expression.or(
        Expression.comparison(column1, qualifier1, Comparison.Operator.LT, value1),
        Expression.comparison(column2, qualifier2, Comparison.Operator.GT, value2)
    );
    IntSet intSet = evaluator.evaluate(searchContext, exp);

    // assert the evaluator interacted with the indices correctly
    Assert.assertNotNull("The response from the evaluator should not be null", intSet);
    for (int i = 1; i <= 10; i++) {
      Assert.assertTrue("The resulting IntSet should contain " + i, intSet.contains(i));
    }
    EasyMock.verify(index1, index2);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.regionserver.idx.support.sets.IntSet

    // set up the indices
    byte[] column1 = Bytes.toBytes("column1");
    byte[] qualifier1 = Bytes.toBytes("qualifier1");
    byte[] value1 = Bytes.toBytes("value1");
    IdxIndex index1 = EasyMock.createMock(IdxIndex.class);
    IntSet bitSet1 = new IntSetBuilder().start().addAll(1, 2, 3, 4, 5, 6).finish(100);
    EasyMock.expect(index1.head(value1, true)).andReturn(bitSet1);
    EasyMock.expect(index1.probeToString(value1)).andReturn(Bytes.toString(value1)).anyTimes();
    EasyMock.replay(index1);
    searchContext.indices.put(Pair.of(column1, qualifier1), index1);

    IdxIndex index2 = EasyMock.createMock(IdxIndex.class);
    byte[] column2 = Bytes.toBytes("column2");
    byte[] qualifier2 = Bytes.toBytes("qualifier2");
    byte[] value2 = Bytes.toBytes("value2");
    IntSet bitSet2 = new IntSetBuilder().start().addAll(5, 6, 7, 8, 9, 10).finish(100);
    EasyMock.expect(index2.tail(value2, true)).andReturn(bitSet2);
    EasyMock.expect(index2.probeToString(value2)).andReturn(Bytes.toString(value2)).anyTimes();
    EasyMock.replay(index2);
    searchContext.indices.put(Pair.of(column2, qualifier2), index2);

    // perform the test
    IdxExpressionEvaluator evaluator = new IdxExpressionEvaluator();
    Expression exp = Expression.and(
        Expression.comparison(column1, qualifier1, Comparison.Operator.LTE, value1),
        Expression.comparison(column2, qualifier2, Comparison.Operator.GTE, value2)
    );
    IntSet intSet = evaluator.evaluate(searchContext, exp);

    // assert the evaluator interacted with the indices correctly
    Assert.assertNotNull("The response from the evaluator should not be null", intSet);
    Assert.assertEquals("The resulting IntSet contained the wrong number of results", 2, intSet.size());
    for (int i : new int[]{5, 6}) {
      Assert.assertTrue("The resulting IntSet should contain " + i, intSet.contains(i));
    }
    EasyMock.verify(index1, index2);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.regionserver.idx.support.sets.IntSet

    // set up the indices
    IdxIndex index1 = EasyMock.createMock(IdxIndex.class);
    byte[] column1 = Bytes.toBytes("column1");
    byte[] qualifier1 = Bytes.toBytes("qualifier1");
    byte[] value1 = Bytes.toBytes("value1");
    IntSet bitSet1 = new IntSetBuilder().start().addAll(1,2,3,4,5,6).finish(100);
    EasyMock.expect(index1.head(value1, true)).andReturn(bitSet1);
    EasyMock.expect(index1.probeToString(value1)).andReturn(Bytes.toString(value1)).anyTimes();
    EasyMock.replay(index1);
    searchContext.indices.put(Pair.of(column1, qualifier1), index1);

    IdxIndex index2 = EasyMock.createMock(IdxIndex.class);
    byte[] column2 = Bytes.toBytes("column2");
    byte[] qualifier2 = Bytes.toBytes("qualifier2");
    byte[] value2 = Bytes.toBytes("value2");
    IntSet bitSet2 = new IntSetBuilder().start().addAll(5, 6, 7, 8, 9, 10).finish(100);
    EasyMock.expect(index2.tail(value2, true)).andReturn(bitSet2);
    EasyMock.expect(index2.probeToString(value2)).andReturn(Bytes.toString(value2)).anyTimes();
    EasyMock.replay(index2);
    searchContext.indices.put(Pair.of(column2, qualifier2), index2);

    IdxIndex index3 = EasyMock.createMock(IdxIndex.class);
    byte[] column3 = Bytes.toBytes("column3");
    byte[] qualifier3 = Bytes.toBytes("qualifier3");
    byte[] value3 = Bytes.toBytes("value3");
    IntSet bitSet3 = new IntSetBuilder().start().addAll(11).finish(100);
    EasyMock.expect(index3.lookup(value3)).andReturn(bitSet3);
    EasyMock.expect(index3.probeToString(value3)).andReturn(Bytes.toString(value3)).anyTimes();
    EasyMock.replay(index3);
    searchContext.indices.put(Pair.of(column3, qualifier3), index3);

    // perform the test
    IdxExpressionEvaluator evaluator = new IdxExpressionEvaluator();
    Expression exp = Expression.or(
        Expression.and(
            Expression.comparison(column1, qualifier1, Comparison.Operator.LTE, value1),
            Expression.comparison(column2, qualifier2, Comparison.Operator.GTE, value2)
        ),
        Expression.comparison(column3, qualifier3, Comparison.Operator.EQ, value3)
    );

    IntSet intSet = evaluator.evaluate(searchContext, exp);

    // assert the evaluator interacted with the indices correctly
    Assert.assertNotNull("The response from the evaluator should not be null", intSet);
    Assert.assertEquals("The resulting IntSet contained the wrong number of results", 3, intSet.size());
    for (int i : new int[]{5, 6, 11}) {
      Assert.assertTrue("The resulting IntSet should contain " + i, intSet.contains(i));
    }
    EasyMock.verify(index1, index2, index3);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.regionserver.idx.support.sets.IntSet

  /**
   * Test that ensures that a null expression is handled correctly.
   */
  public void testNullExpression() {
    IdxExpressionEvaluator evaluator = new IdxExpressionEvaluator();
    IntSet result = evaluator.evaluate(searchContext, (Expression) null);

    Assert.assertNull("The result should be null", result);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.regionserver.idx.support.sets.IntSet

   */
  public void testNullIndex() {
    Expression exp = Expression.comparison("column", "qualifier", Comparison.Operator.EQ, Bytes.toBytes("value"));

    IdxExpressionEvaluator evaluator = new IdxExpressionEvaluator();
    IntSet result = null;
    try {
      result = evaluator.evaluate(searchContext, exp);
      Assert.fail("An exception should have been thrown");
    } catch (IllegalStateException e) {
      Assert.assertTrue("Exception did not contain the correct message", e.getMessage().contains("Could not find an index"));
View Full Code Here

Examples of org.apache.uima.internal.util.IntSet

    this.cas = cas;
    this.typeSystem = cas.getTypeSystemImpl();
    this.name2indexMap = new HashMap<String, IndexIteratorCachePair>();
    this.indexUpdates = new IntVector();
    this.indexUpdateOperation = new BitSet();
    this.fsAddedToIndex = new IntSet();
    this.fsDeletedFromIndex = new IntSet();
    this.fsReindexed = new IntSet();
    this.logProcessed = false;
    init();
  }
View Full Code Here

Examples of org.apache.uima.internal.util.IntSet

    this.cas = cas;
    this.typeSystem = cas.getTypeSystemImpl();
    this.name2indexMap = new HashMap<String, IndexIteratorCachePair>();
    this.indexUpdates = new IntVector();
    this.indexUpdateOperation = new BitSet();
    this.fsAddedToIndex = new IntSet();
    this.fsDeletedFromIndex = new IntSet();
    this.fsReindexed = new IntSet();
    this.logProcessed = false;
    init();
    final Set<String> keys = baseIndexRepo.name2indexMap.keySet();
    if (!keys.isEmpty()) {
      final Iterator<String> keysIter = keys.iterator();
View Full Code Here

Examples of org.apache.uima.internal.util.IntSet

        v.get(j).index.flush();
      }
    }
    this.indexUpdates.removeAllElements();
    this.indexUpdateOperation.clear();
    this.fsAddedToIndex = new IntSet();
    this.fsDeletedFromIndex = new IntSet();
    this.fsReindexed = new IntSet();
    this.logProcessed = false;
    this.usedIndexes.removeAllElements();
  }
View Full Code Here

Examples of org.jacoco.core.instr.IntSet

  private IntSet intset;

  @Before
  public void setup() {
    intset = new IntSet();
  }
View Full Code Here

Examples of org.mindswap.pellet.utils.intset.IntSet

   * @param ds
   * @param doExplanation
   * @return
   */
  public DependencySet union(DependencySet ds, boolean doExplanation) {
    IntSet newDepends = depends.union( ds.depends );
    Set<ATermAppl> newExplain;
   
    if( doExplanation ) {
      newExplain = SetUtils.union( explain, ds.explain );
    }
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.