OpNode.java

Go to the documentation of this file.
00001 package com.graphbuilder.math;
00002 
00007 public abstract class OpNode extends Expression {
00008 
00009     protected Expression leftChild = null;
00010     protected Expression rightChild = null;
00011 
00012     public OpNode(Expression leftChild, Expression rightChild) {
00013         setLeftChild(leftChild);
00014         setRightChild(rightChild);
00015     }
00016 
00017     public void setLeftChild(Expression x) {
00018         checkBeforeAccept(x);
00019         if (leftChild != null)
00020             leftChild.parent = null;
00021         x.parent = this;
00022         leftChild = x;
00023     }
00024 
00025     public void setRightChild(Expression x) {
00026         checkBeforeAccept(x);
00027         if (rightChild != null)
00028             rightChild.parent = null;
00029         x.parent = this;
00030         rightChild = x;
00031     }
00032 
00033     public Expression getLeftChild() {
00034         return leftChild;
00035     }
00036 
00037     public Expression getRightChild() {
00038         return rightChild;
00039     }
00040 
00044     public abstract String getSymbol();
00045 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1