src/horaris/Horaro.java
author viric@mandarina
Sun, 01 Jul 2007 19:19:19 +0200
changeset 13 6696ab405c36
permissions -rw-r--r--
I don't remember this changes

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);
	}
}