public void testTypes() throws Exception {
    assertTrue(!FilterUtils.areProperSubset(tf1, tf2));
    assertTrue(FilterUtils.areProperSubset(tf1, tf1));

    assertTrue(FilterUtils.areDisjoint(tf1, tf2));
    assertTrue(!FilterUtils.areDisjoint(tf1, tf1));
  }
  public void testOrAncestorDescendants() {
    FeatureFilter type_foo = new FeatureFilter.ByType("foo");
    FeatureFilter type_bar = new FeatureFilter.ByType("bar");
    FeatureFilter test = new FeatureFilter.ByAncestor(new FeatureFilter.OnlyDescendants(type_foo));

    assertTrue(FilterUtils.areDisjoint(type_bar, test));
    assertTrue(!FilterUtils.areDisjoint(type_foo, test));
  }
 public void testParentAncestor() throws Exception {
   assertTrue(
       FilterUtils.areProperSubset(parent_cf_ComponentFeature, ancestor_cf_ComponentFeature));
   assertTrue(
       !FilterUtils.areProperSubset(ancestor_cf_ComponentFeature, parent_cf_ComponentFeature));
   assertTrue(
       FilterUtils.areDisjoint(ancestor_cf_ComponentFeature, not_ancestor_cf_ComponentFeature));
   assertTrue(
       FilterUtils.areDisjoint(not_ancestor_cf_ComponentFeature, parent_cf_ComponentFeature));
 }
  public void testNot() throws Exception {
    assertTrue(FilterUtils.areProperSubset(ntf1, ntf1));
    assertTrue(!FilterUtils.areDisjoint(ntf1, ntf1));

    assertTrue(FilterUtils.areDisjoint(tf1, ntf1));
    assertTrue(!FilterUtils.areProperSubset(tf1, ntf1));

    assertTrue(!FilterUtils.areDisjoint(tf2, ntf1));
    assertTrue(FilterUtils.areProperSubset(tf2, ntf1));
  }
  public void testByProperty() throws Exception {
    assertTrue("are disjoint: " + pf4 + ", " + pf5, FilterUtils.areDisjoint(pf4, pf5));
    assertTrue("not disjoint: " + pf4 + ", " + pf6, !FilterUtils.areDisjoint(pf4, pf6));
    assertTrue("not disjoint: " + pf5 + ", " + pf6, !FilterUtils.areDisjoint(pf5, pf6));

    assertTrue("not subset: " + pf4 + ", " + pf5, !FilterUtils.areProperSubset(pf4, pf5));
    assertTrue("not subset: " + pf4 + ", " + pf6, !FilterUtils.areProperSubset(pf4, pf6));
    assertTrue("not subset: " + pf5 + ", " + pf6, !FilterUtils.areProperSubset(pf5, pf6));

    assertTrue("are subset: " + pf4 + ", " + pf4, FilterUtils.areProperSubset(pf4, pf4));
  }
  public void testOr() throws Exception {
    assertTrue(FilterUtils.areProperSubset(tf1, tf1_or_tf2));
    assertTrue(!FilterUtils.areDisjoint(tf1, tf1_or_tf2));
    assertTrue(FilterUtils.areDisjoint(tf3, tf1_or_tf2));

    assertTrue(!FilterUtils.areProperSubset(tf1_or_tf2, tf2_or_tf3));
    assertTrue(!FilterUtils.areDisjoint(tf1_or_tf2, tf2_or_tf3));

    assertTrue(FilterUtils.areProperSubset(tf1_or_tf2, tf1_or_tf2_or_tf3));
    assertTrue(FilterUtils.areProperSubset(tf2_or_tf3, tf1_or_tf2_or_tf3));
    assertTrue(FilterUtils.areProperSubset(tf1_or_tf3, tf1_or_tf2_or_tf3));
  }
 public void testDisjointAnnotationTypesContains() {
   AnnotationType atype = new AnnotationType.Impl();
   atype.setDefaultConstraints(PropertyConstraint.NONE, CardinalityConstraint.ZERO);
   atype.setConstraints("foo", PropertyConstraint.ANY, CardinalityConstraint.ONE);
   assertTrue(
       FilterUtils.areDisjoint(
           new FeatureFilter.ByAnnotationType(atype),
           new FeatureFilter.AnnotationContains("bar", "some_value")));
   assertTrue(
       !FilterUtils.areDisjoint(
           new FeatureFilter.ByAnnotationType(atype),
           new FeatureFilter.AnnotationContains("foo", "some_value")));
 }
  public void testAncestorLeafChildren() {
    FeatureFilter type_foo = new FeatureFilter.ByType("foo");
    FeatureFilter type_bar = new FeatureFilter.ByType("bar");
    FeatureFilter test =
        new FeatureFilter.ByAncestor(
            new FeatureFilter.OnlyChildren(new FeatureFilter.And(type_foo, FeatureFilter.leaf)));
    FeatureFilter test_nonleaf =
        new FeatureFilter.ByAncestor(new FeatureFilter.OnlyChildren(type_foo));

    assertTrue(FilterUtils.areDisjoint(type_bar, test));
    assertTrue(!FilterUtils.areDisjoint(type_bar, test_nonleaf));
    assertTrue(!FilterUtils.areDisjoint(type_foo, test));
  }
  public void testHasByProperty() throws Exception {
    assertTrue("not disjoint: " + pf1 + ", " + pf4, !FilterUtils.areDisjoint(pf1, pf4));
    assertTrue("not disjoint: " + pf2 + ", " + pf4, !FilterUtils.areDisjoint(pf2, pf4));
    assertTrue("not disjoint: " + pf3 + ", " + pf4, !FilterUtils.areDisjoint(pf3, pf4));

    assertTrue("not subset: " + pf1 + ", " + pf4, !FilterUtils.areProperSubset(pf1, pf4));
    assertTrue("are subset: " + pf4 + ", " + pf1, FilterUtils.areProperSubset(pf4, pf1));
    assertTrue("are subset: " + pf5 + ", " + pf1, FilterUtils.areProperSubset(pf5, pf1));
    assertTrue("not subset: " + pf6 + ", " + pf1, !FilterUtils.areProperSubset(pf6, pf1));

    assertTrue("not subset: " + pf2 + ", " + pf4, !FilterUtils.areProperSubset(pf2, pf4));
    assertTrue("not subset: " + pf4 + ", " + pf2, !FilterUtils.areProperSubset(pf4, pf2));
    assertTrue("not subset: " + pf5 + ", " + pf2, !FilterUtils.areProperSubset(pf5, pf2));
    assertTrue("are subset: " + pf6 + ", " + pf2, FilterUtils.areProperSubset(pf6, pf2));
  }
Esempio n. 10
0
  public void testLocation() throws Exception {
    // Simple comparison of locations.

    assertTrue(FilterUtils.areProperSubset(olf1, olf1));
    assertTrue(!FilterUtils.areProperSubset(olf1, olf2));
    assertTrue(!FilterUtils.areDisjoint(olf1, olf1));

    // Assymetry between containment and overlapping

    assertTrue(FilterUtils.areProperSubset(clf1, olf1));
    assertTrue(!FilterUtils.areProperSubset(olf1, clf1));

    assertTrue(FilterUtils.areDisjoint(olf1, clf2));
    assertTrue(FilterUtils.areDisjoint(clf1, olf2));
  }
Esempio n. 11
0
  public void testParentChildren() {
    FeatureFilter type_foo = new FeatureFilter.ByType("foo");
    FeatureFilter type_bar = new FeatureFilter.ByType("bar");
    FeatureFilter type_baz = new FeatureFilter.ByType("baz");
    FeatureFilter test =
        new FeatureFilter.ByParent(
            new FeatureFilter.OnlyChildren(
                new FeatureFilter.And(
                    type_foo,
                    new FeatureFilter.OnlyChildren(
                        new FeatureFilter.And(type_baz, FeatureFilter.leaf)))));

    assertTrue(FilterUtils.areDisjoint(type_bar, test));
    assertTrue(!FilterUtils.areDisjoint(type_foo, test));
    assertTrue(FilterUtils.areDisjoint(type_baz, test));
  }
Esempio n. 12
0
  public void testAnd() throws Exception {
    // all_and_all vs all
    assertTrue(
        "are subset: " + all_and_all + ", " + FeatureFilter.all,
        FilterUtils.areProperSubset(all_and_all, FeatureFilter.all));
    assertTrue(
        "not disjoint: " + all_and_all + ", " + FeatureFilter.all,
        !FilterUtils.areDisjoint(all_and_all, FeatureFilter.all));
    assertTrue(
        "are subset: " + FeatureFilter.all + ", " + all_and_all,
        FilterUtils.areProperSubset(FeatureFilter.all, all_and_all));
    assertTrue(
        "not disjoint: " + FeatureFilter.all + ", " + all_and_all,
        !FilterUtils.areDisjoint(FeatureFilter.all, all_and_all));

    // all_and_all vs none
    assertTrue(
        "not subset: " + all_and_all + ", " + FeatureFilter.none,
        !FilterUtils.areProperSubset(all_and_all, FeatureFilter.none));
    assertTrue(
        "are disjoint: " + all_and_all + ", " + FeatureFilter.none,
        FilterUtils.areDisjoint(all_and_all, FeatureFilter.none));
    assertTrue(
        "are subset: " + FeatureFilter.none + ", " + all_and_all,
        FilterUtils.areProperSubset(FeatureFilter.none, all_and_all));
    assertTrue(
        "are disjoint: " + FeatureFilter.none + ", " + all_and_all,
        FilterUtils.areDisjoint(FeatureFilter.none, all_and_all));

    // all_and_none vs all
    assertTrue(
        "are subset: " + all_and_none + ", " + FeatureFilter.all,
        FilterUtils.areProperSubset(all_and_none, FeatureFilter.all));
    assertTrue(
        "are disjoint: " + all_and_none + ", " + FeatureFilter.all,
        FilterUtils.areDisjoint(all_and_none, FeatureFilter.all));
    assertTrue(
        "not subset: " + FeatureFilter.all + ", " + all_and_none,
        !FilterUtils.areProperSubset(FeatureFilter.all, all_and_none));
    assertTrue(
        "are disjoint: " + FeatureFilter.all + ", " + all_and_none,
        FilterUtils.areDisjoint(FeatureFilter.all, all_and_none));

    // all_and_none vs none
    assertTrue(
        "are subset: " + all_and_none + ", " + FeatureFilter.none,
        FilterUtils.areProperSubset(all_and_none, FeatureFilter.none));
    assertTrue(
        "are disjoint: " + all_and_none + ", " + FeatureFilter.none,
        FilterUtils.areDisjoint(all_and_none, FeatureFilter.none));
    assertTrue(
        "are subset: " + FeatureFilter.none + ", " + all_and_none,
        FilterUtils.areProperSubset(FeatureFilter.none, all_and_none));
    assertTrue(
        "are disjoint: " + FeatureFilter.none + ", " + all_and_none,
        FilterUtils.areDisjoint(FeatureFilter.none, all_and_none));

    // none_and_all vs all
    assertTrue(
        "are subset: " + none_and_all + ", " + FeatureFilter.all,
        FilterUtils.areProperSubset(none_and_all, FeatureFilter.all));
    assertTrue(
        "are disjoint: " + none_and_all + ", " + FeatureFilter.all,
        FilterUtils.areDisjoint(none_and_all, FeatureFilter.all));
    assertTrue(
        "not subset: " + FeatureFilter.all + ", " + none_and_all,
        !FilterUtils.areProperSubset(FeatureFilter.all, none_and_all));
    assertTrue(
        "are disjoint: " + FeatureFilter.all + ", " + none_and_all,
        FilterUtils.areDisjoint(FeatureFilter.all, none_and_all));

    // none_and_all vs none
    assertTrue(
        "are subset: " + none_and_all + ", " + FeatureFilter.none,
        FilterUtils.areProperSubset(none_and_all, FeatureFilter.none));
    assertTrue(
        "are disjoint: " + none_and_all + ", " + FeatureFilter.none,
        FilterUtils.areDisjoint(none_and_all, FeatureFilter.none));
    assertTrue(
        "are subset: " + FeatureFilter.none + ", " + none_and_all,
        FilterUtils.areProperSubset(FeatureFilter.none, none_and_all));
    assertTrue(
        "are disjoint: " + FeatureFilter.none + ", " + none_and_all,
        FilterUtils.areDisjoint(FeatureFilter.none, none_and_all));

    // none_and_none vs all
    assertTrue(
        "are subset: " + none_and_none + ", " + FeatureFilter.all,
        FilterUtils.areProperSubset(none_and_none, FeatureFilter.all));
    assertTrue(
        "are disjoint: " + none_and_none + ", " + FeatureFilter.all,
        FilterUtils.areDisjoint(none_and_none, FeatureFilter.all));
    assertTrue(
        "not subset: " + FeatureFilter.all + ", " + none_and_none,
        !FilterUtils.areProperSubset(FeatureFilter.all, none_and_none));
    assertTrue(
        "are disjoint: " + FeatureFilter.all + ", " + none_and_none,
        FilterUtils.areDisjoint(FeatureFilter.all, none_and_none));

    // none_and_none vs none
    assertTrue(
        "are subset: " + none_and_none + ", " + FeatureFilter.none,
        FilterUtils.areProperSubset(none_and_none, FeatureFilter.none));
    assertTrue(
        "are disjoint: " + none_and_none + ", " + FeatureFilter.none,
        FilterUtils.areDisjoint(none_and_none, FeatureFilter.none));
    assertTrue(
        "are subset: " + FeatureFilter.none + ", " + none_and_none,
        FilterUtils.areProperSubset(FeatureFilter.none, none_and_none));
    assertTrue(
        "are disjoint: " + FeatureFilter.none + ", " + none_and_none,
        FilterUtils.areDisjoint(FeatureFilter.none, none_and_none));

    // pf1_and_pf2 vs pf1, pf2
    assertTrue(
        "are subset: " + pf1_and_pf2 + ", " + pf1, FilterUtils.areProperSubset(pf1_and_pf2, pf1));
    assertTrue(
        "not disjoint: " + pf1_and_pf2 + ", " + pf1, !FilterUtils.areDisjoint(pf1_and_pf2, pf1));
    assertTrue(
        "are subset: " + pf1_and_pf2 + ", " + pf2, FilterUtils.areProperSubset(pf1_and_pf2, pf2));
    assertTrue(
        "not disjoint: " + pf1_and_pf2 + ", " + pf2, !FilterUtils.areDisjoint(pf1_and_pf2, pf2));

    assertTrue(
        "not subset: " + pf1_and_pf2 + ", " + pf3, !FilterUtils.areProperSubset(pf1_and_pf2, pf3));
    assertTrue(
        "not subset: " + pf2_and_pf3 + ", " + pf1_and_pf2,
        !FilterUtils.areProperSubset(pf2_and_pf3, pf1_and_pf2));
    assertTrue(
        "are subset: " + pf1_and_pf2_and_pf3 + ", " + pf1_and_pf2,
        FilterUtils.areProperSubset(pf1_and_pf2_and_pf3, pf1_and_pf2));
    assertTrue(
        "are subset: " + pf1_and_pf2_and_pf3 + ", " + pf2_and_pf3,
        FilterUtils.areProperSubset(pf1_and_pf2_and_pf3, pf2_and_pf3));

    assertTrue(
        "are subset: " + pf1_and_pf2_and_tf1 + ", " + pf1_and_pf2,
        FilterUtils.areProperSubset(pf1_and_pf2_and_tf1, pf1_and_pf2));
    assertTrue(
        "are subset: " + pf1_and_pf2_and_tf1 + ", " + pf1_and_tf1,
        FilterUtils.areProperSubset(pf1_and_pf2_and_tf1, pf1_and_tf1));

    assertTrue(
        "are disjoint: " + pf1_and_tf1 + ", " + tf2, FilterUtils.areDisjoint(pf1_and_tf1, tf2));
    assertTrue(
        "are disjoint: " + pf1_and_pf2_and_tf1 + ", " + tf2,
        FilterUtils.areDisjoint(pf1_and_pf2_and_tf1, tf2));
  }
Esempio n. 13
0
 public void testByClass() throws Exception {
   assertTrue(FilterUtils.areProperSubset(cf_HomologyFeature, cf_StrandedFeature));
   assertTrue(FilterUtils.areProperSubset(cf_ComponentFeature, cf_StrandedFeature));
   assertTrue(FilterUtils.areDisjoint(cf_ComponentFeature, cf_HomologyFeature));
 }