retval = new Argument(d);
if (d == 0.0) retval = mZeroArgument; else if (d == 1.0) retval = mOneArgument; else retval = new Argument(d);
		private Argument traverse(ExpressionTreeNode t, ContextStack context)			throws MapyrusException		{			Argument retval;			Argument leftValue, rightValue;			int op;			double d;			if (t.mIsLeaf)			{				/*				 * Evaluate any variable name.				 */				if (t.mLeafArg.getType() == Argument.VARIABLE)				{					retval = context.getVariableValue(t.mLeafArg.getVariableName());					if (retval == null)					{						throw new MapyrusException("Variable " +							t.mLeafArg.getVariableName() + " not defined");					}				}				else				{					retval = t.mLeafArg;				}			}			else			{				/*				 * Either expressions can be numeric or string.				 */				leftValue = traverse(t.mLeftBranch, context);				rightValue = traverse(t.mRightBranch, context);				/*				 * Evaluate any variable names.				 */				if (leftValue.getType() == Argument.VARIABLE)				{					Argument leftVarValue =						context.getVariableValue(leftValue.getVariableName());					if (leftVarValue == null)					{						throw new MapyrusException("Variable " +							leftValue.getVariableName() + " not defined");					}					leftValue = leftVarValue;				}				if (rightValue.getType() == Argument.VARIABLE)				{					Argument rightVarValue =						context.getVariableValue(rightValue.getVariableName());					if (rightVarValue == null)					{						throw new MapyrusException("Variable " +							rightValue.getVariableName() + " not defined");					}					rightValue = rightVarValue;				}				/*				 * Check types for operation.  Multiplying a string by a number is OK				 * but everything else requires matching types.				 */				op = t.mOperation;				if (op == MULTIPLY_OPERATION && leftValue.getType() == Argument.STRING)				{					if (rightValue.getType() != Argument.NUMERIC)					{						throw new MapyrusException("Wrong types for mulitplication");					}				}				else if (leftValue.getType() != rightValue.getType())				{					throw new MapyrusException("Types do match in expression");				}								/*				 * Do string and numeric operations separately.				 */				if (leftValue.getType() == Argument.NUMERIC)				{					double l = leftValue.getNumericValue();					double r = rightValue.getNumericValue();										if (op == PLUS_OPERATION)						d = l + r;					else if (op == MINUS_OPERATION)						d = l - r;					else if (op == MULTIPLY_OPERATION)						d = l * r;					else if (op == DIVIDE_OPERATION)						d = l / r;					else if (op == EQUALS_OPERATION)						d = (l == r) ? 1 : 0;					else if (op == NOT_EQUALS_OPERATION)						d = (l != r) ? 1 : 0;					else if (op == GREATER_THAN_OPERATION)						d = (l > r) ? 1 : 0;					else if (op == GREATER_EQUAL_OPERATION)						d = (l >= r) ? 1 : 0;					else if (op == LESS_THAN_OPERATION)						d = (l < r) ? 1 : 0;					else if (op == LESS_EQUAL_OPERATION)						d = (l <= r) ? 1 : 0;					else if (op == AND_OPERATION)					{						d = (l != 0.0 &&							r != 0.0) ? 1 : 0;					}					else if (op == OR_OPERATION)					{						d = (l != 0.0 ||							r != 0.0) ? 1 : 0;					}					else					{						throw new MapyrusException("Operation not permitted between numbers");					}					retval = new Argument(d);				}				else				{					StringBuffer s;					String l = leftValue.getStringValue();					if (op == MULTIPLY_OPERATION)					{						/*						 * Repeat string N times.						 */						s = new StringBuffer();						for (int i = 0; i < rightValue.getNumericValue(); i++)						{							s.append(l);						}						retval = new Argument(Argument.STRING, s.toString());					}					else if (op == PLUS_OPERATION)					{						String r = rightValue.getStringValue();						retval = new Argument(Argument.STRING, l + r);					}					else					{						String r = rightValue.getStringValue();						if (op == EQUALS_OPERATION)							d = l.equals(r) ? 1 : 0;						else if (op == NOT_EQUALS_OPERATION)							d = l.equals(r) ? 0 : 1;						else if (op == CONTAINS_OPERATION)							d = (l.indexOf(r) > 0) ? 1 : 0;						else if (op == GREATER_THAN_OPERATION)							d = (l.compareTo(r) > 0) ? 1 : 0;						else if (op == GREATER_EQUAL_OPERATION)							d = (l.compareTo(r) >= 0) ? 1 : 0;						else if (op == LESS_THAN_OPERATION)							d = (l.compareTo(r) < 0) ? 1 : 0;						else if (op == LESS_EQUAL_OPERATION)							d = (l.compareTo(r) <= 0) ? 1 : 0;						else						{							throw new MapyrusException("Operation not permitted between strings");						}						retval = new Argument(d);					}				}			}			return(retval);		}