DivNode.java

Go to the documentation of this file.
00001 package com.graphbuilder.math;
00002 
00006 public class DivNode extends OpNode {
00007 
00008     public DivNode(Expression leftChild, Expression rightChild) {
00009         super(leftChild, rightChild);
00010     }
00011 
00015     public double eval(VarMap v, FuncMap f) {
00016         double a = leftChild.eval(v, f);
00017         double b = rightChild.eval(v, f);
00018         // Laks 2008.05.16: check if the b is zero or not (to avoid an exception)
00019         if(b!=0)
00020             return a / b;
00021         else
00022             return 0;
00023     }
00024 
00025     public String getSymbol() {
00026         return "/";
00027     }
00028 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1