Statistics
| Revision:

root / trunk / libraries / libGeocoding / src-filter / org / gvsig / data / vectorial / filter / ModuleImpl.java @ 23019

History | View | Annotate | Download (2.15 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2008 PRODEVELOP                Main development
26
 */
27

    
28
/**
29
 * 
30
 */
31
package org.gvsig.data.vectorial.filter;
32

    
33
import org.opengis.filter.expression.Expression;
34
import org.opengis.filter.expression.ExpressionVisitor;
35

    
36
/**
37
 * @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
38
 * 
39
 */
40
public class ModuleImpl implements Expression {
41
    Expression exp1;
42
    Expression exp2;
43

    
44
    public ModuleImpl(Expression exp1, Expression exp2) {
45
        super();
46
        this.exp1 = exp1;
47
        this.exp2 = exp2;
48
    }
49

    
50
    public Object accept(ExpressionVisitor visitor, Object extraData) {
51
        return null;
52
    }
53

    
54
    /*
55
     * (non-Javadoc)
56
     * 
57
     * @see org.opengis.filter.expression.Expression#evaluate(java.lang.Object)
58
     */
59
    public Object evaluate(Object arg0) {
60
        
61
        Object value1 = exp1.evaluate(arg0);
62
        Object value2 = exp2.evaluate(arg0);
63
        
64
        Double doub1 = (Double) value1;
65
        Double doub2 = (Double) value2;
66
        
67
        return doub1%doub2;
68
    }
69

    
70
    /*
71
     * (non-Javadoc)
72
     * 
73
     * @see org.opengis.filter.expression.Expression#evaluate(java.lang.Object,
74
     *      java.lang.Class)
75
     */
76
    public Object evaluate(Object arg0, Class arg1) {
77
        return evaluate(arg0);
78
    }
79

    
80
}