svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.swing / org.gvsig.fmap.dal.swing.impl / src / main / java / org / gvsig / fmap / dal / swing / impl / searchPostProcess / distinctOn / LastAggregateOperation.java @ 45537
History | View | Annotate | Download (1.25 KB)
1 | 45537 | jolivas | /*
|
---|---|---|---|
2 | * To change this license header, choose License Headers in Project Properties.
|
||
3 | * To change this template file, choose Tools | Templates
|
||
4 | * and open the template in the editor.
|
||
5 | */
|
||
6 | package org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn; |
||
7 | |||
8 | /**
|
||
9 | *
|
||
10 | * @author jovivas
|
||
11 | */
|
||
12 | public class LastAggregateOperation implements AggregateOperation { |
||
13 | public static class LastAggregateOperationFactory implements AggregateOperationFactory{ |
||
14 | |||
15 | @Override
|
||
16 | public String getName() { |
||
17 | return "Last value"; |
||
18 | } |
||
19 | |||
20 | @Override
|
||
21 | public AggregateOperation create(Object... os) { |
||
22 | return new LastAggregateOperation(); |
||
23 | } |
||
24 | |||
25 | @Override
|
||
26 | public boolean isApplicable(Object... value) { |
||
27 | return Comparable.class.isAssignableFrom((Class<?>) value[0]); |
||
28 | } |
||
29 | } |
||
30 | |||
31 | Object last;
|
||
32 | |||
33 | public LastAggregateOperation() {
|
||
34 | this.last = null; |
||
35 | } |
||
36 | |||
37 | @Override
|
||
38 | public boolean isApplicable(Object... value) { |
||
39 | return true; |
||
40 | } |
||
41 | |||
42 | @Override
|
||
43 | public void reset() { |
||
44 | this.last = null; |
||
45 | } |
||
46 | |||
47 | @Override
|
||
48 | public void perform(Object value) { |
||
49 | this.last = value;
|
||
50 | } |
||
51 | |||
52 | @Override
|
||
53 | public Object getValue() { |
||
54 | return this.last; |
||
55 | } |
||
56 | |||
57 | } |