Package org.opengis.filter

Examples of org.opengis.filter.Or


        Filter f1 = CompilerUtil.parseFilter(this.language,"[[[ X < 4 ] AND NOT [ Y < 4 ]] AND [ Z < 4 ]]");
        Assert.assertTrue(f1 instanceof And);
       
        Filter f2 = CompilerUtil.parseFilter(this.language, "[X<4 AND Y<4 ] OR Z<4");
        Or orf2 = (Or) f2;
        Filter leftf2 =  orf2.getChildren().get(0);
        Assert.assertTrue(leftf2 instanceof And);
       
        Filter rightf2 = orf2.getChildren().get(1);
        Assert.assertTrue(rightf2 instanceof PropertyIsLessThan);

        Filter f3 = CompilerUtil.parseFilter(this.language,"[([ X < 4 ] AND NOT [ Y < 4 ]) AND [ Z < 4 ]]");
        Assert.assertTrue(f3 instanceof And);
View Full Code Here


    }


    private Or buildBeforeOrDuring()
            throws CQLException {
        Or filter = null;

        Result node = this.builder.peekResult();

        switch (node.getNodeType()) {
        case JJTPERIOD_BETWEEN_DATES_NODE:
View Full Code Here

        return filter;
    }

    private Or buildDuringOrAfter()
            throws CQLException {
        Or filter = null;

        Result node = this.builder.peekResult();

        switch (node.getNodeType()) {
        case JJTPERIOD_BETWEEN_DATES_NODE:
View Full Code Here

        // Set up false sub filter
        PropertyIsEqualTo filterFalse = fac.equals(testAttribute, fac.literal("incorrect test string data"));

        // Test OR for false negatives
        Or filter = fac.or(Arrays.asList((org.opengis.filter.Filter) filterFalse,
                (org.opengis.filter.Filter) filterTrue));

        assertAttributeName(filter, "testString");
    }
View Full Code Here

    public void testGetFeaturesWithORLogicFilter() throws Exception {
        init();
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo property1 = ff.equals(ff.property("vendor_s"), ff.literal("D-Link"));
        PropertyIsEqualTo property2 = ff.equals(ff.property("vendor_s"), ff.literal("Linksys"));
        Or filter = ff.or(property1, property2);
        SimpleFeatureCollection features = featureSource.getFeatures(filter);
        assertEquals(4, features.size());
        SimpleFeatureIterator iterator = features.features();
        while (iterator.hasNext()) {
            SimpleFeature f = iterator.next();
View Full Code Here

   */
  public void testVisitLogicFilterOR() throws Exception {
      Set<FeatureId> fidSet1 = Collections.singleton(ff.featureId("new1"));
      Set<FeatureId> fidSet2 = Collections.singleton(ff.featureId("new2"));
       
      Or before = ff.or( ff.id( fidSet1 ), ff.id( fidSet2 ) );
     
      Or after = (Or) before.accept( visitor, null );
    assertSame( after, after );
      assertTrue( ((Id)after.getChildren().get(0)).getIDs().contains("final1") );
      assertTrue( ((Id)after.getChildren().get(1)).getIDs().contains("final2") );
  }
View Full Code Here

    public void testCoalesheNestedOr()
    {
        Filter eq = ff.equal(ff.property("A"), ff.literal("3"), true);
        Filter gt = ff.greater(ff.property("b"), ff.literal("3"));
        Filter lt = ff.less(ff.property("c"), ff.literal("5"));
        Or nested = ff.or(Arrays.asList(ff.or(Arrays.asList(eq, gt)), lt));
       
        Or simplified = (Or) nested.accept(visitor, null);
        assertEquals(3, simplified.getChildren().size());
        assertEquals(ff.or(Arrays.asList(eq, gt, lt)), simplified);
    }
View Full Code Here

        assertEquals(3, simplified.getChildren().size());
        assertEquals(ff.or(Arrays.asList(eq, gt, lt)), simplified);
    }
   
    public void testDualFilterOr() {
        Or or = ff.or(Arrays.asList(ff.not(ff.equal(ff.property("a"), ff.literal(3), true)), ff.equal(ff.property("a"), ff.literal(3), true)));
        assertEquals(Filter.INCLUDE, or.accept(visitor, null));
    }
View Full Code Here

    public void testMassOrFilter() throws Exception {
        List filters = new ArrayList();
        for (int i = 0; i < 10000; i++) {
            filters.add(ff.equals(ff.property(nameAtt), ff.literal("" + i)));
        }
        Or orFilter = ff.or(filters);
        visitor = newVisitor(simpleLogicalCaps);
        // this would have throw the thing into a stack overflow error
        orFilter.accept(visitor, null);
        assertEquals(orFilter, visitor.getFilterPre());
        assertEquals(Filter.INCLUDE, visitor.getFilterPost());
    }
View Full Code Here

        assertSame("Include should be returned when same filter", Filter.INCLUDE, results);
    }

    @Test
    public void testRemoveFilterCompound() {
        Or childOr = ff.or(Arrays.asList(new Filter[]{b, c, d}));
        And base = ff.and(a, childOr);

        Filter results = Filters.removeFilter(base, d, false);
        assertEquals("Filter should not be removed because it should not recurse", base, results);
View Full Code Here

TOP

Related Classes of org.opengis.filter.Or

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.