Package cleo.search.util

Examples of cleo.search.util.Weight


    int numBrowseHits = 0;
    int numFilterHits = 0;
    int numResultHits = 0;
   
    Weight w = new Weight(0, 0);
    SelectorContext ctx = new SelectorContext();
   
    while(connStrengthIter.hasNext()) {
      numBrowseHits++;
      connStrengthIter.next(w);
View Full Code Here


    int numBrowseHits = 0;
    int numFilterHits = 0;
    int numResultHits = 0;
   
    Weight w = new Weight(0, 0);
    SelectorContext ctx = new SelectorContext();
   
    while(connStrengthIter.hasNext()) {
      numBrowseHits++;
      connStrengthIter.next(w);
View Full Code Here

    int numBrowseHits = 0;
    int numFilterHits = 0;
    int numResultHits = 0;
   
    Weight w = new Weight(0, 0);
    SelectorContext ctx = new SelectorContext();
   
    while(connStrengthIterator.hasNext()) {
      numBrowseHits++;
      connStrengthIterator.next(w);
View Full Code Here

    if(oldWeightData != null) {
      int[] elemIds = oldWeightData[ArrayStoreWeights.ELEMID_SUBARRAY_INDEX];
      int[] weights = oldWeightData[ArrayStoreWeights.WEIGHT_SUBARRAY_INDEX];
      for(int i = 0, cnt = elemIds.length; i < cnt; i++) {
        if(connectionFilter.accept(source, elemIds[i], true)) {
          oldList.add(new Weight(elemIds[i], weights[i]));
        }
      }
    }
   
    if(newWeightData != null) {
      int[] elemIds = newWeightData[ArrayStoreWeights.ELEMID_SUBARRAY_INDEX];
      int[] weights = newWeightData[ArrayStoreWeights.WEIGHT_SUBARRAY_INDEX];
      for(int i = 0, cnt = elemIds.length; i < cnt; i++) {
        if(connectionFilter.accept(source, elemIds[i], true)) {
          newList.add(new Weight(elemIds[i], weights[i]));
        }
      }
    }
   
    List<Weight> list = Weights.merge(oldList, newList);
View Full Code Here

           
            int[] connections = weightData[ArrayStoreWeights.ELEMID_SUBARRAY_INDEX];
            int[] weights = weightData[ArrayStoreWeights.WEIGHT_SUBARRAY_INDEX];
            for(int i = 0; i < connections.length; i++) {
              if(targetFilter.accept(index, connections[i], true)) {
                weightList.add(new Weight(connections[i], weights[i]));
              }
            }
           
            if(connections.length != weightList.size()) {
              connections = new int[weightList.size()];
              weights = new int[weightList.size()];
              for(int i = 0; i < connections.length; i++) {
                Weight w = weightList.get(i);
                connections[i] = w.elementId;
                weights[i] = w.elementWeight;
              }
             
              weightData = new int[][] { connections, weights };
View Full Code Here

      int[] elemFilters = new int[num];
      ByteBuffer bb = ByteBuffer.wrap(bytes);
      ArrayList<Weight> list = new ArrayList<Weight>(num);
     
      for(int i = 0; i < num; i++) {
        Weight weight = new Weight(i, rand.nextInt(10000));
        list.add(weight);
        bb.putInt(weight.elementId);
        bb.putInt(weight.elementWeight);
        elemIds[i] = weight.elementId;
        elemFilters[i] = weight.elementWeight;
View Full Code Here

    bytes = new byte[length];
    ByteBuffer bb = ByteBuffer.wrap(bytes);
    ArrayList<Weight> list1 = new ArrayList<Weight>(cnt);
   
    for(int i = 0; i < cnt; i++) {
      Weight weight = new Weight(i, rand.nextInt(10000));
      list1.add(weight);
      bb.putInt(weight.elementId);
      bb.putInt(weight.elementWeight);
    }
   
    ArrayList<Weight> list2 = new ArrayList<Weight>(cnt);
    iter = new WeightIteratorFromBytes(bytes, offset, length);
    while(iter.hasNext()) {
      Weight weight = new Weight(0, 0);
      iter.next(weight);
      list2.add(weight);
    }
   
    ArrayList<Weight> list3 = new ArrayList<Weight>(cnt);
View Full Code Here

  private Random rand = new Random();
 
  public void testApiBasics() {
    int elemId = rand.nextInt();
   
    Weight w1 = new Weight(elemId, rand.nextInt());
    Weight w2 = new Weight(elemId, rand.nextInt());
    Weight w3 = new Weight(elemId, rand.nextInt());
   
    assertTrue(w1.equals(w2));
    assertTrue(w2.equals(w3));
    assertEquals(w1.hashCode(), w2.hashCode());
    assertEquals(w2.hashCode(), w3.hashCode());
   
    HashSet<Weight> set1 = new HashSet<Weight>();
    set1.add(w1);
    set1.add(w2);
    set1.add(w3);
    assertEquals(1, set1.size());
   
    HashSet<Weight> set2 = new HashSet<Weight>();
    set2.add(w1);
    set2.add(w2);
    set2.add(w3);
   
    Weight w4 = new Weight(++elemId, rand.nextInt());
    Weight w5 = new Weight(++elemId, rand.nextInt());
    set2.add(w4);
    set2.add(w5);
    assertEquals(3, set2.size());
   
    List<Weight> list1 = new ArrayList<Weight>();
View Full Code Here

    List<Weight> changeList = new ArrayList<Weight>();
    List<Weight> resultList;
   
    int elemId = rand.nextInt();
   
    Weight w1 = new Weight(elemId, rand.nextInt());
    Weight w2 = new Weight(elemId, rand.nextInt());
    Weight w3 = new Weight(elemId, rand.nextInt());
   
    Weight w4 = new Weight(++elemId, rand.nextInt());
    Weight w5 = new Weight(++elemId, rand.nextInt());
    Weight w6 = new Weight(++elemId, rand.nextInt());
   
    // Test Set
    activeSet.add(w1);
    activeSet.add(w2);
    activeSet.add(w3);
View Full Code Here

   
    int cnt = weightData.size();
    int[] elemIds = new int[cnt];
    int[] weights = new int[cnt];
    for(int i = 0; i < cnt; i++) {
      Weight w = weightData.get(i);
      elemIds[i] = w.elementId;
      weights[i] = w.elementWeight;
    }
   
    set(index, new int[][]{elemIds, weights}, scn);
View Full Code Here

TOP

Related Classes of cleo.search.util.Weight

Copyright © 2018 www.massapicom. 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.