1
2
3
4
5
6
7
8
9 package net.kwfgrid.gwes.jaxen;
10
11 import org.jaxen.Function;
12 import org.jaxen.Context;
13 import org.jaxen.FunctionCallException;
14
15 import java.util.List;
16 import java.util.Calendar;
17
18
19
20
21
22
23
24
25 public class Ms2yearFunction implements Function {
26
27 public Object call(Context context, List args) throws FunctionCallException {
28 if (args.isEmpty()) throw new FunctionCallException("Argument missing.");
29 if (args.size() > 1) throw new FunctionCallException("Too many arguments.");
30 Double dms = (Double)args.get(0);
31 long ms = dms.longValue();
32 TimeScheme time = new TimeScheme(ms);
33 Integer ivalue = time.getCal().get(Calendar.YEAR);
34 return ivalue.doubleValue();
35 }
36
37 }