Package cleo.search.util

Examples of cleo.search.util.Range


  }
 
  public void testTargetPartitionConnectionFilter() {
    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));
   
    conn = new SimpleConnection(rand.nextInt(), start + rand.nextInt(count), true);
    assertEquals(true, connFilter.accept(conn));
   
    conn = new SimpleConnection(rand.nextInt(), targetRange.getEnd(), true);
    assertEquals(false, connFilter.accept(conn));
   
    conn = new SimpleConnection(rand.nextInt(), targetRange.getEnd() + rand.nextInt(count), true);
    assertEquals(false, connFilter.accept(conn));
  }
View Full Code Here


    conn = new SimpleConnection(rand.nextInt(), targetRange.getEnd() + rand.nextInt(count), true);
    assertEquals(false, connFilter.accept(conn));
  }
 
  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);
View Full Code Here

    int source;
    int target;
   
    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);
    assertEquals(true, connFilter.accept(conn));

    source = range.getStart();
    target = range.getStart() - rand.nextInt(range.getStart());
    conn = new SimpleConnection(source, target, true);
    assertEquals(true, connFilter.accept(conn));
   
    source = range.getStart();
    target = range.getEnd();
    conn = new SimpleConnection(source, target, true);
    assertEquals(true, connFilter.accept(conn));
   
    source = range.getStart();
    target = range.getEnd() + rand.nextInt(range.getEnd());
    conn = new SimpleConnection(source, target, true);
    assertEquals(true, connFilter.accept(conn));
   
    for(int i = 0, cnt = rand.nextInt(100); i < cnt; i++) {
      source = range.getStart() + rand.nextInt(range.getCount());
      target = Math.abs(rand.nextInt());
      conn = new SimpleConnection(source, target, true);
      assertEquals(true, connFilter.accept(conn));

      source = Math.abs(rand.nextInt());
      target = range.getStart() + rand.nextInt(range.getCount());
      conn = new SimpleConnection(source, target, true);
      assertEquals(true, connFilter.accept(conn));
    }
   
    for(int i = 0, cnt = rand.nextInt(100); i < cnt; i++) {
      source = range.getStart() - rand.nextInt(range.getStart()) - 1;
      target = range.getStart() - rand.nextInt(range.getStart()) - 1;
      conn = new SimpleConnection(source, target, true);
      assertEquals(false, connFilter.accept(conn));
     
      source = range.getStart() - rand.nextInt(range.getStart()) - 1;
      target = range.getEnd() + rand.nextInt(range.getEnd());
      conn = new SimpleConnection(source, target, true);
      assertEquals(false, connFilter.accept(conn));
     
      source = range.getEnd() + rand.nextInt(range.getEnd());
      target = range.getStart() - rand.nextInt(range.getStart()) - 1;
      conn = new SimpleConnection(source, target, true);
      assertEquals(false, connFilter.accept(conn));
     
      source = range.getEnd() + rand.nextInt(range.getEnd());
      target = range.getEnd() + rand.nextInt(range.getEnd());
      conn = new SimpleConnection(source, target, true);
      assertEquals(false, connFilter.accept(conn));
    }
  }
View Full Code Here

    assertEquals(true, accepted);
  }
 
  public void testEquals() {
    ConnectionFilter cf1, cf2, cf3;
    Range range = new Range(rand.nextInt(10000), rand.nextInt(10000) + 100);
   
    // Test SourcePartionConnectionFilter
    cf1 = new SourcePartitionConnectionFilter(range);
    cf2 = null;
    assertFalse(cf1.equals(cf2));
View Full Code Here

TOP

Related Classes of cleo.search.util.Range

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.