Statistics
| Revision:

root / org.gvsig.legend.aggregate / trunk / org.gvsig.legend.aggregate / org.gvsig.legend.aggregate.lib / org.gvsig.legend.aggregate.lib.impl / src / main / java / org / gvsig / legend / aggregate / lib / impl / operation / MinOperation.java @ 1846

History | View | Annotate | Download (859 Bytes)

1
package org.gvsig.legend.aggregate.lib.impl.operation;
2

    
3
import org.gvsig.fmap.dal.feature.Feature;
4
import org.gvsig.legend.aggregate.lib.api.AbstractOperation;
5

    
6
public class MinOperation extends AbstractOperation {
7

    
8
    private int min = 0;
9

    
10
    public MinOperation() {
11
        super("_Minimun", "_Calculate_the_minimum_of_the_selected_attribute_for_the_grouped_features");
12
    }
13

    
14
    @Override
15
    public boolean isAttributeRequiered() {
16
        return true;
17
    }
18

    
19
    @Override
20
    public void reset() {
21
        min = 0;
22
    }
23

    
24
    @Override
25
    public void perform(Feature feature) {
26
        try {
27
            int x = feature.getInt(this.getAttributeName());
28
            if( x > min ) {
29
                min = x;
30
            }
31
        } catch (Exception ex) {
32
        }
33
    }
34

    
35
    @Override
36
    public Object getValue() {
37
        return this.min;
38
    }
39

    
40
}