package ca.uwaterloo.joos.ast.expr;

import ca.uwaterloo.joos.ast.ASTNode;
import ca.uwaterloo.joos.parser.ParseTree.Node;

public class UnaryExpression extends Expression {

	public UnaryExpression(Node node, ASTNode parent) throws Exception {
		super(node, parent);
		// TODO Auto-generated constructor stub
	}

}

@@ -41,273 +41,1816 @@
 ort 
-ca.uwaterloo.joos.ast.ASTNode;%0Aimport ca.uwaterloo.joos.parser.ParseTree.Node;%0A%0Apublic class UnaryExpression extends Expression %7B%0A%0A%09public UnaryExpression(Node node, ASTNode parent) throws Exception %7B%0A%09%09super(node, parent);%0A%09%09// TODO Auto-generated constructor stub
+java.util.List;%0A%0Aimport ca.uwaterloo.joos.ast.AST.ASTConstructException;%0Aimport ca.uwaterloo.joos.ast.ASTNode;%0Aimport ca.uwaterloo.joos.ast.descriptor.ChildDescriptor;%0Aimport ca.uwaterloo.joos.ast.descriptor.SimpleDescriptor;%0Aimport ca.uwaterloo.joos.parser.ParseTree.LeafNode;%0Aimport ca.uwaterloo.joos.parser.ParseTree.Node;%0Aimport ca.uwaterloo.joos.parser.ParseTree.TreeNode;%0A%0Apublic class UnaryExpression extends Expression %7B%0A%09%0A%09public static final SimpleDescriptor OPERATOR = new SimpleDescriptor(UnaryOperator.class);%0A%09public static final ChildDescriptor OPERAND = new ChildDescriptor(UnaryExpression.class);%0A%09%0A%09public static enum UnaryOperator %7B%0A%09%09MINUS, NOT, %0A%09%7D%0A%09%0A%09public UnaryExpression(Node node, ASTNode parent) throws Exception %7B%0A%09%09super(node, parent);%0A%09%7D%0A%09%0A%09private UnaryOperator stringToUnaryOperator(String name) throws ASTConstructException %7B%0A%09%09for(UnaryOperator operator: UnaryOperator.values()) %7B%0A%09%09%09if(operator.name().equals(name)) return operator;%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%09%0A%09public UnaryOperator getOperator() throws ChildTypeUnmatchException %7B%0A%09%09return (UnaryOperator) this.getChildByDescriptor(OPERATOR);%0A%09%7D%0A%09%0A%09public UnaryExpression getOperand() throws ChildTypeUnmatchException %7B%0A%09%09return (UnaryExpression) this.getChildByDescriptor(OPERAND);%0A%09%7D%0A%09%0A%09@Override%0A%09public List%3CNode%3E processTreeNode(TreeNode treeNode) throws Exception %7B%0A%09%09if(treeNode.children.size() == 2) %7B%0A%09%09%09Node first = treeNode.children.get(0);%0A%09%09%09Node second = treeNode.children.get(1);%0A%09%09%09%0A%09%09%09UnaryOperator operator = stringToUnaryOperator(first.getKind().toUpperCase());%0A%09%09%09this.addChild(OPERATOR, operator);%0A%09%09%09%0A%09%09%09Expression operand = Expression.newExpression(second, this);%0A%09%09%09this.addChild(OPERAND, operand);%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%0A%09@Override%0A%09public void processLeafNode(LeafNode leafNode) throws Exception %7B%0A%09%09
 %0A%09%7D%0A

Complete Unary Expression