OperatorNodeIF.java

package edu.udel.cis.vsl.tass.ast.IF.expression;

import java.util.NoSuchElementException;

/**
 * Wrapper for basic operators. Has 1,2, or 3 children, depending on the
 * operator.
 */
public interface OperatorNodeIF extends PureExpressionNodeIF {

	public enum AST_OPERATOR {
		ADD, 						//arithmetic add
		ADD_POINTER_INT, 	// p+i
		ADDRESS_OF, 			// "&" in C
		BIT_AND, 
		BIT_NOT, 
		BIT_OR, 
		BIT_XOR, 
		COND, 						// "(expr ? trueValue : falseValue)" in C
		COMMA,
		DIVIDE, 						// arithmetic divide (integers or reals)
		EQUALS, 					// ==
		GREATER_THAN, 		// >
		GTE, 							// >=
		LEQ, 							// <=
		LESS_THAN, 				// <
		LOGICAL_AND, 			// &&
		LOGICAL_NOT, 			// !
		LOGICAL_OR, 			// ||
		MODULO,					// %
		MULTIPLY, 				// arithmetic multiply (integers or reals)
		NEGATIVE, 
		NOT_EQUALS, 			// !=
		SHIFT_LEFT, 
		SHIFT_RIGHT, 
		SUBTRACT, 
		SUBTRACT_POINTER_INT, 
		SUBTRACT_POINTER_POINTER
	}
	
	/** The operator for this node. */
	AST_OPERATOR getOperator();
	
	/** Will have 1,2, or 3 children depending on the operator */
	ExpressionNodeIF getArgument(int i) throws NoSuchElementException;
	
	/** Set the operator for this node. */
	void setOperator(AST_OPERATOR operator);
	
	/** Set argument i */
	void setArgument(int i, ExpressionNodeIF child) throws NoSuchElementException;

}