01: package org.geotools.filter.function;
02:
03: /*
04: * GeoTools - OpenSource mapping toolkit
05: * http://geotools.org
06: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Lesser General Public
10: * License as published by the Free Software Foundation;
11: * version 2.1 of the License.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Lesser General Public License for more details.
17: */
18:
19: //this code is autogenerated - you shouldnt be modifying it!
20: import org.geotools.filter.FunctionExpression;
21: import org.geotools.filter.FunctionExpressionImpl;
22:
23: public class FilterFunction_strSubstring extends FunctionExpressionImpl
24: implements FunctionExpression {
25:
26: public FilterFunction_strSubstring() {
27: super ("strSubstring");
28: }
29:
30: public int getArgCount() {
31: return 3;
32: }
33:
34: public Object evaluate(Object feature) {
35: String arg0;
36: int arg1;
37: int arg2;
38:
39: try { // attempt to get value and perform conversion
40: arg0 = (String) getExpression(0).evaluate(feature,
41: String.class); // extra
42: // protection
43: // for
44: // strings
45: } catch (Exception e) // probably a type error
46: {
47: throw new IllegalArgumentException(
48: "Filter Function problem for function strSubstring argument #0 - expected type String");
49: }
50:
51: try { // attempt to get value and perform conversion
52: arg1 = ((Number) getExpression(1).evaluate(feature))
53: .intValue();
54: } catch (Exception e) // probably a type error
55: {
56: throw new IllegalArgumentException(
57: "Filter Function problem for function strSubstring argument #1 - expected type int");
58: }
59:
60: try { // attempt to get value and perform conversion
61: arg2 = ((Number) getExpression(2).evaluate(feature))
62: .intValue();
63: } catch (Exception e) // probably a type error
64: {
65: throw new IllegalArgumentException(
66: "Filter Function problem for function strSubstring argument #2 - expected type int");
67: }
68:
69: return (StaticGeometry.strSubstring(arg0, arg1, arg2));
70: }
71: }
|