equal
deleted
inserted
replaced
|
1 public class Horaro extends IParserHandler |
|
2 { |
|
3 private final int S_RADIKO = 0; |
|
4 private final int S_TAGOJ = 1; |
|
5 private final int S_ENTAGO = 2; |
|
6 private final int S_LOKOJ = 3; |
|
7 private final int S_SENCOJ = 4; |
|
8 private final int S_FINO = 5; |
|
9 private Vector tagoj; |
|
10 private String defaulttago; |
|
11 private Vector lokoj; |
|
12 private Vector sencoj; |
|
13 private Hashtable sencolokoj; |
|
14 private int state; |
|
15 private int nivelo; |
|
16 |
|
17 public Horaro |
|
18 { |
|
19 tagoj = new Vector(); |
|
20 defaulttago = null; |
|
21 lokoj = new Vector(); |
|
22 sencoj = new Vector(); |
|
23 } |
|
24 |
|
25 private void addTago(String s); |
|
26 { |
|
27 tagoj.addElement(s); |
|
28 } |
|
29 |
|
30 private void addLoko(String s) |
|
31 { |
|
32 lokoj.addElement(s); |
|
33 } |
|
34 |
|
35 private void addSenco(String s) |
|
36 { |
|
37 lokoj.addElement(s); |
|
38 } |
|
39 |
|
40 private void add(String s) |
|
41 { |
|
42 if (nivelo == 0) |
|
43 { |
|
44 System.err.println("Nivelo 0: " + s); |
|
45 if (s.equals("Dies")) |
|
46 state = S_TAGOJ; |
|
47 else if (s.equals("Sentits")) |
|
48 state = S_SENCOJ; |
|
49 else if (s.equals("Llocs")) |
|
50 state = S_LOKOJ; |
|
51 else if (s.equals("Comboi")) |
|
52 state = S_FINO; |
|
53 break; |
|
54 } else if (nivelo == 1) |
|
55 { |
|
56 System.err.println("Nivelo 1: " + s); |
|
57 switch(state) |
|
58 { |
|
59 case S_RADIKO: |
|
60 case S_TAGOJ: |
|
61 addTago(s); |
|
62 break; |
|
63 case S_LOKOJ: |
|
64 addLoko(s); |
|
65 case S_SENCOJ: |
|
66 addSenco(s); |
|
67 break; |
|
68 } |
|
69 } else if (nivelo == 1) { |
|
70 System.err.println("Nivelo 2"); |
|
71 } |
|
72 |
|
73 } |
|
74 |
|
75 public boolean event(int speco, int level, String s) |
|
76 { |
|
77 if (speco != OgdlParser.CONTENT) |
|
78 return; |
|
79 |
|
80 if (s == null) return; |
|
81 |
|
82 nivelo = level; |
|
83 add(s); |
|
84 } |
|
85 } |