Package cleo.search.connection

Examples of cleo.search.connection.ConnectionFilter


 
  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;
   
    while(!rejected) {
      rejected = !connFilter.accept(conn);
    }
   
    while(!accepted) {
      accepted = connFilter.accept(conn);
    }
   
    assertEquals(true, rejected);
    assertEquals(true, accepted);
  }
View Full Code Here


    assertEquals(true, rejected);
    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));
   
    cf2 = new SourcePartitionConnectionFilter(range);
    assertTrue(cf1.equals(cf2));
    assertTrue(cf2.equals(cf1));
   
    assertTrue(cf1.equals(cf1));
    assertTrue(cf2.equals(cf2));
   
    assertEquals(cf1.hashCode(), cf2.hashCode());
   
    // Test TargetPartionConnectionFilter
    cf1 = new TargetPartitionConnectionFilter(range);
    cf2 = null;
    assertFalse(cf1.equals(cf2));
   
    cf2 = new TargetPartitionConnectionFilter(range);
    assertTrue(cf1.equals(cf2));
    assertTrue(cf2.equals(cf1));
   
    assertTrue(cf1.equals(cf1));
    assertTrue(cf2.equals(cf2));
   
    assertEquals(cf1.hashCode(), cf2.hashCode());
   
    // Test TransitivePartionConnectionFilter
    cf1 = new TransitivePartitionConnectionFilter(range);
    cf2 = null;
    assertFalse(cf1.equals(cf2));
   
    cf2 = new TransitivePartitionConnectionFilter(range);
    assertTrue(cf1.equals(cf2));
    assertTrue(cf2.equals(cf1));
   
    assertTrue(cf1.equals(cf1));
    assertTrue(cf2.equals(cf2));
   
    assertEquals(cf1.hashCode(), cf2.hashCode());
   
    // Test cross comparison
    cf1 = new SourcePartitionConnectionFilter(range);
    cf2 = new TargetPartitionConnectionFilter(range);
    cf3 = new TransitivePartitionConnectionFilter(range);
   
    assertFalse(cf1.equals(cf2));
    assertFalse(cf1.equals(cf3));
    assertFalse(cf2.equals(cf1));
    assertFalse(cf2.equals(cf3));
    assertFalse(cf3.equals(cf1));
    assertFalse(cf3.equals(cf2));
  }
View Full Code Here

TOP

Related Classes of cleo.search.connection.ConnectionFilter

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.