예제 #1
0
  public void testChildAddition() {
    // Test child addition
    CompositeFilter testCmpFilter = new CompositeFilter("testCmpFilter5");
    testCmpFilter.addChild(locationFilter);
    testCmpFilter.setRelation(Relation.AND);
    testCmpFilter.setNetwork(cyNetwork);

    testCmpFilter.apply();

    BitSet expectedNodeBitSet = new BitSet(4);
    expectedNodeBitSet.set(0, false);
    expectedNodeBitSet.set(1, false);
    expectedNodeBitSet.set(2, true);
    expectedNodeBitSet.set(3, true);

    assertEquals(expectedNodeBitSet.toString(), testCmpFilter.getNodeBits().toString());

    // Add new child
    testCmpFilter.addChild(rankFilter);

    testCmpFilter.apply();

    expectedNodeBitSet.set(0, false);
    expectedNodeBitSet.set(1, false);
    expectedNodeBitSet.set(2, true);
    expectedNodeBitSet.set(3, false);

    assertEquals(expectedNodeBitSet.toString(), testCmpFilter.getNodeBits().toString());
  }
예제 #2
0
  public void testChildDeletion() {
    // Test child deletion
    CompositeFilter testCmpFilter = new CompositeFilter("testCmpFilter4");
    testCmpFilter.addChild(locationFilter);
    testCmpFilter.addChild(rankFilter);
    testCmpFilter.setRelation(Relation.AND);
    testCmpFilter.setNetwork(cyNetwork);

    testCmpFilter.apply();

    // Before deletion
    BitSet expectedBitSet4 = new BitSet();
    expectedBitSet4.set(2, true);

    assertEquals(expectedBitSet4.toString(), testCmpFilter.getNodeBits().toString());

    testCmpFilter.removeChild(locationFilter);
    testCmpFilter.apply();

    // after deletion
    expectedBitSet4.set(0, true);
    expectedBitSet4.set(1, false);
    expectedBitSet4.set(2, true);
    expectedBitSet4.set(3, false);

    assertEquals(expectedBitSet4.toString(), testCmpFilter.getNodeBits().toString());
  }
예제 #3
0
  /**
   * DOCUMENT ME!
   *
   * @throws Exception DOCUMENT ME!
   */
  public void testAND1() {
    CompositeFilter testCmpFilter = new CompositeFilter("testCmpFilter1");
    testCmpFilter.addChild(locationFilter);
    testCmpFilter.addChild(rankFilter);
    testCmpFilter.setRelation(Relation.AND);
    testCmpFilter.setNetwork(cyNetwork);
    testCmpFilter.apply();

    BitSet expectedNodeBitSet = new BitSet(4);
    expectedNodeBitSet.set(2, true);

    assertEquals(expectedNodeBitSet.toString(), testCmpFilter.getNodeBits().toString());
  }
예제 #4
0
  public void testAND2() {
    // (node filter) AND (edge filter) ==> return empty bitSet -- false for all bits
    CompositeFilter testCmpFilter = new CompositeFilter("testCmpFilter2");
    testCmpFilter.addChild(locationFilter); // node filter
    testCmpFilter.addChild(pmidFilter); // edge filter
    testCmpFilter.setRelation(Relation.AND);
    testCmpFilter.setNetwork(cyNetwork);
    testCmpFilter.apply();

    BitSet expectedBitSet = new BitSet(4);

    assertEquals(expectedBitSet.toString(), testCmpFilter.getNodeBits().toString());
    assertEquals(expectedBitSet.toString(), testCmpFilter.getEdgeBits().toString());
  }
예제 #5
0
  public void testOR1() {
    CompositeFilter testCmpFilter = new CompositeFilter("testCmpFilter3");
    testCmpFilter.addChild(locationFilter);
    testCmpFilter.addChild(rankFilter);
    testCmpFilter.setRelation(Relation.OR);
    testCmpFilter.setNetwork(cyNetwork);

    testCmpFilter.apply();
    // System.out.println("testCmpFilter.toString() ="+ testCmpFilter.toString());

    BitSet expectedNodeBitSet = new BitSet(4);
    expectedNodeBitSet.set(0, true);
    expectedNodeBitSet.set(2, true);
    expectedNodeBitSet.set(3, true);

    assertEquals(expectedNodeBitSet.toString(), testCmpFilter.getNodeBits().toString());
  }