--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/horaris/Horaro.java Sun Jul 01 19:19:19 2007 +0200
@@ -0,0 +1,85 @@
+public class Horaro extends IParserHandler
+{
+ private final int S_RADIKO = 0;
+ private final int S_TAGOJ = 1;
+ private final int S_ENTAGO = 2;
+ private final int S_LOKOJ = 3;
+ private final int S_SENCOJ = 4;
+ private final int S_FINO = 5;
+ private Vector tagoj;
+ private String defaulttago;
+ private Vector lokoj;
+ private Vector sencoj;
+ private Hashtable sencolokoj;
+ private int state;
+ private int nivelo;
+
+ public Horaro
+ {
+ tagoj = new Vector();
+ defaulttago = null;
+ lokoj = new Vector();
+ sencoj = new Vector();
+ }
+
+ private void addTago(String s);
+ {
+ tagoj.addElement(s);
+ }
+
+ private void addLoko(String s)
+ {
+ lokoj.addElement(s);
+ }
+
+ private void addSenco(String s)
+ {
+ lokoj.addElement(s);
+ }
+
+ private void add(String s)
+ {
+ if (nivelo == 0)
+ {
+ System.err.println("Nivelo 0: " + s);
+ if (s.equals("Dies"))
+ state = S_TAGOJ;
+ else if (s.equals("Sentits"))
+ state = S_SENCOJ;
+ else if (s.equals("Llocs"))
+ state = S_LOKOJ;
+ else if (s.equals("Comboi"))
+ state = S_FINO;
+ break;
+ } else if (nivelo == 1)
+ {
+ System.err.println("Nivelo 1: " + s);
+ switch(state)
+ {
+ case S_RADIKO:
+ case S_TAGOJ:
+ addTago(s);
+ break;
+ case S_LOKOJ:
+ addLoko(s);
+ case S_SENCOJ:
+ addSenco(s);
+ break;
+ }
+ } else if (nivelo == 1) {
+ System.err.println("Nivelo 2");
+ }
+
+ }
+
+ public boolean event(int speco, int level, String s)
+ {
+ if (speco != OgdlParser.CONTENT)
+ return;
+
+ if (s == null) return;
+
+ nivelo = level;
+ add(s);
+ }
+}