/**
 * A parsed statement.
 * Can be one of several types.  An assignment statement, a conditional
 * statement or just a plain command.
 */

/*
 * $Id$
 */
public class Statement
{
	/*
	 * Possible types of statements.
	 */
	public static final int ASSIGN = 1;
	public static final int CONDITION = 2;

	public static final int COLOR = 3;
	public static final int LINEWIDTH = 4;
	public static final int POINT = 5;
	public static final int LINE = 6;
	public static final int STROKE = 7;

	private int mType;
	Statement mThenStatement;
	Statement mElseStatement;
	String mAssignedVariable;

	ArithmeticExpression []mExpressions;

	/**
	 * Looks up identifier for a statement name.
	 * @param s is the name of the statement.
	 * @returns numeric code for this statement, or -1 if statement
	 * is unknown.
	 */
	public static int getStatementType(String s)
	{
		int retval = -1;
		String sLower = s.toLowerCase();

		if (sLower.equals("color") || sLower.equals("colour"))
		{
			retval = COLOR;
		}
		else if (sLower.equals("linewidth"))
		{
			retval = LINEWIDTH;
		}
		else if (sLower.equals("point"))
		{
			retval = POINT;
		}
		else if (sLower.equals("line"))
		{
			retval = LINE;
		}
		else if (sLower.equals("stroke"))
		{
			retval = STROKE;
		}
		return(retval);
	}

	/**
	 * Creates a plain statement.
	 * @param type is the type of statement.
	 * @param expressions are the arguments for this statement.
	 */
	public Statement(int type, ArithmeticExpression []expressions)
	{
		mType = type;
		mExpressions = expressions;
	}

	/**
	 * Create an assignment statement.
	 * @param variableName is the name of the variable being assigned.
	 * @param value is the value being assigned to this variable.
	 */
	public Statement(String variableName, ArithmeticExpression value)
	{
		mType = ASSIGN;
		mAssignedVariable = variableName;
		mExpressions = new ArithmeticExpression[1];
		mExpressions[0] = value;
	}

	/**
	 * Creates a conditional statement.
	 * @param type is the type of statement.
	 * @param expressions are the arguments for this statement.
	 */
	public Statement(ArithmeticExpression condition,
		Statement thenStatement, Statement elseStatement)
	{
		mType = CONDITION;
		mExpressions = new ArithmeticExpression[1];
		//mExpressions[0] = value;
	}

	public int getType()
	{
		return(mType);
	}

	public Statement getThenStatement()
	{
		return(mThenStatement);
	}

	public Statement getElseStatement()
	{
		return(mElseStatement);
	}
}

@@ -397,21 +397,20 @@
 nal int 
-POINT
+MOVE
  = 5;%0A%09p
@@ -432,20 +432,20 @@
 nal int 
-LINE
+DRAW
  = 6;%0A%09p
@@ -583,26 +583,16 @@
 able;%0A%0A%09
-Arithmetic
 Expressi
@@ -1104,13 +1104,12 @@
 l = 
-POINT
+MOVE
 ;%0A%09%09
@@ -1160,20 +1160,20 @@
 etval = 
-LINE
+DRAW
 ;%0A%09%09%7D%0A%09%09
@@ -1428,26 +1428,16 @@
 t type, 
-Arithmetic
 Expressi
@@ -1723,26 +1723,16 @@
 leName, 
-Arithmetic
 Expressi
@@ -1815,34 +1815,24 @@
 sions = new 
-Arithmetic
 Expression%5B1
@@ -2033,26 +2033,16 @@
 atement(
-Arithmetic
 Expressi
@@ -2131,16 +2131,16 @@
 DITION;%0A
+
 %09%09mExpre
@@ -2156,18 +2156,8 @@
 new 
-Arithmetic
 Expr

Rename classes.