org.opengis.filter.FilterFactory2.greater()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中org.opengis.filter.FilterFactory2.greater()方法的一些代码示例,展示了FilterFactory2.greater()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilterFactory2.greater()方法的具体详情如下:
包路径:org.opengis.filter.FilterFactory2
类名称:FilterFactory2
方法名:greater

FilterFactory2.greater介绍

暂无

代码示例

代码示例来源:origin: geotools/geotools

public Object visit(PropertyIsGreaterThan filter, Object arg1) {
  Expression[][] expressions = visitBinaryComparisonOperator(filter);
  List combinedFilters = new ArrayList(expressions.length);
  for (int i = 0; i < expressions.length; i++) {
    Expression left = expressions[i][0];
    Expression right = expressions[i][1];
    Filter unrolled =
        ff.greater(left, right, filter.isMatchingCase(), filter.getMatchAction());
    combinedFilters.add(unrolled);
  }
  Filter unrolled = combineOred(combinedFilters);
  return unrolled;
}

代码示例来源:origin: geotools/geotools

isIncludedInThreshold = ff.greater(lookupExp, threshholdExp);
} else {
  isIncludedInThreshold = ff.greaterOrEqual(lookupExp, threshholdExp);

代码示例来源:origin: geotools/geotools

return factory.greater(expr1, expr2);

代码示例来源:origin: geotools/geotools

/** Delegates to FilterFactory2 */
public static boolean greaterThan(Object o1, Object o2) {
  return getFilterFactory2().greater(ff.literal(o1), ff.literal(o2)).evaluate(null);
}

代码示例来源:origin: geotools/geotools

return factory.greater(expr1, expr2);

代码示例来源:origin: geotools/geotools

static PropertyIsGreaterThan propertyFuncIsGreaterThan() {
  return f.greater(propertyNameIsFunc(), literal());
}

代码示例来源:origin: geotools/geotools

/**
 * Builds a filter that compares a and b: <code>a compare b</code>
 *
 * @param filterType
 * @param a
 * @param b
 * @return
 */
org.opengis.filter.Filter compare(
    Class filterType,
    org.opengis.filter.expression.Expression a,
    org.opengis.filter.expression.Expression b) {
  if (filterType == PropertyIsLessThan.class) {
    return fac.less(a, b);
  } else if (filterType == PropertyIsLessThanOrEqualTo.class) {
    return fac.lessOrEqual(a, b);
  }
  if (filterType == PropertyIsEqualTo.class) {
    return fac.equals(a, b);
  } else if (filterType == PropertyIsGreaterThanOrEqualTo.class) {
    return fac.greaterOrEqual(a, b);
  } else if (filterType == PropertyIsGreaterThan.class) {
    return fac.greater(a, b);
  } else {
    throw new IllegalArgumentException("Uknown compare filter type " + filterType);
  }
}

代码示例来源:origin: geotools/geotools

public static PropertyIsGreaterThan propertyIsGreaterThan() {
  return f.greater(propertyName(), literal());
}

代码示例来源:origin: geotools/geotools

PropertyIsBetween pb = (PropertyIsBetween) simplified;
  Filter lt = ff.less(pb.getExpression(), pb.getLowerBoundary());
  Filter gt = ff.greater(pb.getExpression(), pb.getUpperBoundary());
  return ff.or(lt, gt);
} else if (simplified instanceof PropertyIsEqualTo) {
} else if (simplified instanceof PropertyIsLessThanOrEqualTo) {
  PropertyIsLessThanOrEqualTo pl = (PropertyIsLessThanOrEqualTo) simplified;
  return ff.greater(pl.getExpression1(), pl.getExpression2(), pl.isMatchingCase());

代码示例来源:origin: geotools/geotools

static PropertyIsGreaterThan propertyIsGreaterThan() {
  return f.greater(propertyName(), literal());
}

代码示例来源:origin: geotools/geotools

public Object visit(PropertyIsGreaterThan filter, Object extraData) {
  Expression expr1 = visit(filter.getExpression1(), extraData);
  Expression expr2 = visit(filter.getExpression2(), extraData);
  return getFactory(extraData)
      .greater(expr1, expr2, filter.isMatchingCase(), filter.getMatchAction());
}

代码示例来源:origin: geotools/geotools

/** Example located on the wiki */
public void testDefaultFilterVisitorPropertyNameExample() {
  Filter myFilter = ff.greater(ff.add(ff.property("foo"), ff.property("bar")), ff.literal(1));
  class FindNames extends DefaultFilterVisitor {
    public Object visit(PropertyName expression, Object data) {
      Set set = (Set) data;
      set.add(expression.getPropertyName());
      return set;
    }
  }
  Set set = (Set) myFilter.accept(new FindNames(), new HashSet());
  assertTrue(set.contains("foo"));
}

代码示例来源:origin: geotools/geotools

@Test
  public void testOtherFilter() {
    PropertyName label = ff.property("label");
    Filter f1 = ff.greater(label, ff.literal("abc"));
    Filter f2 = ff.greater(label, ff.literal("adc"));
    Filter f3 = ff.notEqual(ff.function("random"), ff.property("i"));
    RangeCombiner rc = new RangeCombiner.And(ff, ft, Arrays.asList(f1, f2, f3));
    List<Filter> reduced = rc.getReducedFilters();
    assertEquals(2, reduced.size());
    assertTrue(reduced.contains(f2));
    assertTrue(reduced.contains(f3));
  }
}

代码示例来源:origin: geotools/geotools

@Override
public Object visit(PropertyIsGreaterThan filter, Object extraData) {
  Class targetType = getTargetType(filter.getExpression1(), filter.getExpression2());
  Expression expr1 = optimize(filter.getExpression1(), extraData, targetType);
  Expression expr2 = optimize(filter.getExpression2(), extraData, targetType);
  boolean matchCase = filter.isMatchingCase();
  return getFactory(extraData).greater(expr1, expr2, matchCase, filter.getMatchAction());
}

代码示例来源:origin: geotools/geotools

public void testSafeConversions() {
  Literal d = fac.literal(1.1);
  Literal i = fac.literal(1);
  Filter f1 = fac.greater(d, i);
  assertTrue(f1.evaluate(null));
  Filter f2 = fac.less(i, d);
  assertTrue(f2.evaluate(null));
}

代码示例来源:origin: geotools/geotools

public void testLogicFilterDuplication() throws IllegalFilterException {
  // create a filter
  PropertyIsGreaterThan greater = fac.greater(fac.literal(2), fac.literal(1));
  PropertyIsLessThan less = fac.less(fac.literal(3), fac.literal(4));
  And and = fac.and(greater, less);
  // duplicate it
  DuplicatingFilterVisitor visitor = new DuplicatingFilterVisitor();
  Filter newFilter = (Filter) and.accept(visitor, fac);
  // compare it
  assertNotNull(newFilter);
  assertEquals(and, newFilter);
}

代码示例来源:origin: geotools/geotools

private void testLogicFilter(Class<?> filterType) throws Exception {
  BinaryLogicOperator complexLogicFilter;
  PropertyIsGreaterThan resultFilter =
      ff.greater(ff.property("measurement/result"), ff.literal(Integer.valueOf(5)));

代码示例来源:origin: geotools/geotools

@BeforeClass
public static void setUpBeforeClass() throws Exception {
  ff = CommonFactoryFinder.getFilterFactory2(null);
  filters = new Filters(ff);
  a = ff.greater(ff.property("zone"), ff.literal(7));
  b = ff.like(ff.property("suburb"), "N%");
  c = ff.equals(ff.property("Subject"), ff.literal("foo"));
  d = ff.equals(ff.property("Subject"), ff.literal("bar"));
}

代码示例来源:origin: geotools/geotools

@Test
public void testLogicFilterAnd() throws Exception {
  PropertyIsEqualTo equals = ff.equals(ff.property("measurement/result"), ff.literal(1.1));
  PropertyIsGreaterThan greater =
      ff.greater(ff.property("measurement/determinand_description"), ff.literal("desc1"));
  And logicFilter = ff.and(equals, greater);
  Filter unrolled = (Filter) logicFilter.accept(visitor, null);
  assertNotNull(unrolled);
  assertTrue(unrolled instanceof And);
  assertNotSame(equals, unrolled);
  And sourceAnd = (And) unrolled;
  assertEquals(2, sourceAnd.getChildren().size());
  Filter sourceEquals = (Filter) sourceAnd.getChildren().get(0);
  assertTrue(sourceEquals instanceof PropertyIsEqualTo);
  Expression left = ((PropertyIsEqualTo) sourceEquals).getExpression1();
  Expression right = ((PropertyIsEqualTo) sourceEquals).getExpression2();
  assertTrue(left instanceof PropertyName);
  assertTrue(right instanceof Literal);
  assertEquals("results_value", ((PropertyName) left).getPropertyName());
  assertEquals(new Double(1.1), ((Literal) right).getValue());
  Filter sourceGreater = (Filter) sourceAnd.getChildren().get(1);
  assertTrue(sourceGreater instanceof PropertyIsGreaterThan);
  left = ((PropertyIsGreaterThan) sourceGreater).getExpression1();
  right = ((PropertyIsGreaterThan) sourceGreater).getExpression2();
  assertTrue(left instanceof PropertyName);
  assertTrue(right instanceof Literal);
  assertEquals("determinand_description", ((PropertyName) left).getPropertyName());
  assertEquals("desc1", ((Literal) right).getValue());
}

代码示例来源:origin: geotools/geotools

/**
 * Test that Filter works over Object as expected, provided there exists a {@link
 * PropertyAccessor} for the given kind of object.
 */
public void testEvaluateNonFeatureObject() {
  MockDataObject object = new MockDataObject();
  object.intVal = 5;
  object.stringVal = "cinco";
  org.opengis.filter.Filter f = fac.greater(fac.property("intVal"), fac.literal(3));
  assertTrue(f.evaluate(object));
  org.opengis.filter.Filter f2 =
      fac.and(f, fac.equals(fac.property("stringVal"), fac.literal("cinco")));
  assertTrue(f2.evaluate(object));
  org.opengis.filter.Filter f3 =
      fac.and(f, fac.equals(fac.property("stringVal"), fac.literal("seis")));
  assertFalse(f3.evaluate(object));
  org.opengis.filter.Filter f4 =
      fac.not(fac.and(f, fac.equals(fac.property("stringVal"), fac.literal("cinco"))));
  assertFalse(f4.evaluate(object));
}

相关文章