8 |
import gzz.potion.potions.*; |
import gzz.potion.potions.*; |
9 |
|
|
10 |
public class OlderFilterFn extends AbstractHead implements Function { |
public class OlderFilterFn extends AbstractHead implements Function { |
11 |
|
public static boolean dbg = false; |
12 |
|
private static void pa(String s) { System.out.println(s); } |
13 |
|
|
14 |
public OlderFilterFn() { |
public OlderFilterFn() { |
15 |
super(new Object[] { |
super(new Object[] { |
21 |
|
|
22 |
List result = new ArrayList(); |
List result = new ArrayList(); |
23 |
for(Iterator i = params[0].iterator(); i.hasNext();) { |
for(Iterator i = params[0].iterator(); i.hasNext();) { |
24 |
Date d = (Date)i.next(); |
String s = (String)i.next(); |
25 |
|
int a = s.indexOf("."), b = s.indexOf(".", a+1); |
26 |
|
int day = Integer.parseInt(s.substring(0, a)); |
27 |
|
int month = Integer.parseInt(s.substring(a+1, b)) - 1; |
28 |
|
int year = Integer.parseInt(s.substring(b+1)); |
29 |
|
if(year < 50) |
30 |
|
year = 100 + year; |
31 |
|
else if(year < 100) |
32 |
|
year = year; |
33 |
|
else |
34 |
|
year = year - 1900; |
35 |
|
Date d = new Date(year, month, day); |
36 |
|
if(dbg) pa("<<<"+d+">>> -- "+day+", "+month+", "+year); |
37 |
OlderFilter o = new OlderFilter(d); |
OlderFilter o = new OlderFilter(d); |
38 |
result.add(o); |
result.add(o); |
39 |
} |
} |