Package cleo.search.connection

Examples of cleo.search.connection.Connection


    List<SimpleElement> results;
   
    int uid = getConnectionsStoreIndexStart() + rand.nextInt(this.getConnectionsStoreCapacity());
    int elemId = getElementStoreIndexStart() + rand.nextInt(getElementStoreCapacity());
   
    Connection conn = new SimpleConnection(uid, elemId, true);
    conn.setTimestamp(System.currentTimeMillis());
   
    SimpleElement elem = new SimpleElement(elemId);
    elem.setTimestamp(System.currentTimeMillis());
    elem.setTerms("Bloom", "filter");
   
View Full Code Here


    List<SimpleElement> results;
   
    int uid = getConnectionsStoreIndexStart() + rand.nextInt(this.getConnectionsStoreCapacity());
    int elemId = getElementStoreIndexStart() + rand.nextInt(getElementStoreCapacity());
   
    Connection conn = new SimpleConnection(uid, elemId, true);
    conn.setTimestamp(System.currentTimeMillis());
   
    SimpleElement elem = new SimpleElement(elemId);
    elem.setTimestamp(System.currentTimeMillis());
    elem.setTerms("Bloom", "filter");
   
View Full Code Here

      int source = getConnectionsStoreIndexStart() + rand.nextInt(this.getConnectionsStoreCapacity());
      int target = getElementStoreIndexStart() + rand.nextInt(getElementStoreCapacity());
      String key = source + "=>" + target;
     
      if(!map.containsKey(key)) {
        Connection conn = new SimpleConnection(source, target, true);
        conn.setStrength(rand.nextInt(1000000));
       
        map.put(key, conn);
        list.add(conn);
      }
    }
   
    // Index active connections
    for(Connection conn : list) {
      conn.setTimestamp(scn++);
      typeahead.index(conn);
    }
   
    for(Connection conn : list) {
      assertEquals(conn.getStrength(), store.getWeight(conn.source(), conn.target()));
     
      int[][] dat = store.getWeightData(conn.source());
      assertEquals(2, dat.length);
      assertTrue(dat[ArrayStoreWeights.ELEMID_SUBARRAY_INDEX].length > 0);
      assertTrue(dat[ArrayStoreWeights.ELEMID_SUBARRAY_INDEX].length == dat[ArrayStoreWeights.WEIGHT_SUBARRAY_INDEX].length);
    }
   
    // Index inactive connections
    for(Connection conn : list) {
      conn.setActive(false);
      conn.setTimestamp(scn++);
      typeahead.index(conn);
    }
   
    for(Connection conn : list) {
      assertEquals(0, store.getWeight(conn.source(), conn.target()));
     
      int[][] dat = store.getWeightData(conn.source());
      assertEquals(2, dat.length);
      assertEquals(0, dat[ArrayStoreWeights.ELEMID_SUBARRAY_INDEX].length);
      assertTrue(dat[ArrayStoreWeights.ELEMID_SUBARRAY_INDEX].length == dat[ArrayStoreWeights.WEIGHT_SUBARRAY_INDEX].length);
    }
  }
View Full Code Here

      }
    }
    elemIdSet.addAll(uidSetDeg1);
   
    for(int target : uidSetDeg1) {
      Connection conn = new SimpleConnection(uid, target, true);
      conn.setStrength(rand.nextInt(10000));
      connList.add(conn);
    }
   
    for(int source : uidSetDeg1) {
      Set<Integer> uidSetDeg2 = new HashSet<Integer>();
     
      for(int i = 0, cnt = rand.nextInt(10) + 10; i < cnt; i++) {
        int target = rand.nextInt(uidMax);
        if(source != target && !uidSetDeg2.contains(target)) {
          uidSetDeg2.add(target);
        }
      }
     
      for(int target : uidSetDeg2) {
        Connection conn = new SimpleConnection(source, target, true);
        conn.setStrength(rand.nextInt(10000));
        connList.add(conn);
      }
     
      elemIdSet.addAll(uidSetDeg2);
      uidSetDeg2.clear();
    }
   
    // Index active connections
    for(Connection conn : connList) {
      conn.setTimestamp(System.currentTimeMillis());
      typeahead.index(conn);
    }
  }
View Full Code Here

     *   012 -> 121
     *  
     *   013 -> 001
     *   013 -> 131
     */
    Connection conn;
    conn = new SimpleConnection(1, 11, true);
    typeahead.index(conn);
   
    conn = new SimpleConnection(1, 12, true);
    typeahead.index(conn);
View Full Code Here

    int start = rand.nextInt(10000) + 100;
    int count = rand.nextInt(10000) + 100;
    Range sourceRange = new Range(start, count);
    ConnectionFilter connFilter = new SourcePartitionConnectionFilter(sourceRange);
   
    Connection conn = new SimpleConnection(0, rand.nextInt(), true);
    assertEquals(false, connFilter.accept(conn));
   
    conn = new SimpleConnection(rand.nextInt(start), rand.nextInt(), true);
    assertEquals(false, connFilter.accept(conn));
   
View Full Code Here

    int start = rand.nextInt(10000) + 100;
    int count = rand.nextInt(10000) + 100;
    Range targetRange = new Range(start, count);
    ConnectionFilter connFilter = new TargetPartitionConnectionFilter(targetRange);
   
    Connection conn = new SimpleConnection(rand.nextInt(), 0, true);
    assertEquals(false, connFilter.accept(conn));
   
    conn = new SimpleConnection(rand.nextInt(), rand.nextInt(start), true);
    assertEquals(false, connFilter.accept(conn));
   
View Full Code Here

  }
 
  public void testTransitivePartitionConnectionFilter() {
    Range range = new Range(3000, 1000); // [3000, 4000)
    ConnectionFilter connFilter = new TransitivePartitionConnectionFilter(range);
    Connection conn;
   
    // Source in range
    conn = new SimpleConnection(3100, 1, true);
    assertEquals(true, connFilter.accept(conn));
   
View Full Code Here

   
    int start = rand.nextInt(100000) + 100;
    int count = rand.nextInt(100000) + 100;
    Range range = new Range(start, count);
   
    Connection conn;
    ConnectionFilter connFilter = new TransitivePartitionConnectionFilter(range);
   
    source = range.getStart();
    target = range.getStart();
    conn = new SimpleConnection(source, target, true);
View Full Code Here

  }
 
  public void testRandomConnectionFilter() {
    int source = rand.nextInt(100000);
    int target = rand.nextInt(100000);
    Connection conn = new SimpleConnection(source, target, true);
    ConnectionFilter connFilter = new RandomConnectionFilter();
   
    boolean rejected = false;
    boolean accepted = false;
   
View Full Code Here

TOP

Related Classes of cleo.search.connection.Connection

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.