ExpressionVerification.java

Go to the documentation of this file.
00001 
00004 package edu.rice.cs.hpc.viewer.metric;
00005 
00006 import com.graphbuilder.math.Expression;
00007 import edu.rice.cs.hpc.data.experiment.metric.ExtFuncMap;
00008 import edu.rice.cs.hpc.data.experiment.metric.MetricVarMap;
00009 
00014 public class ExpressionVerification {
00015     
00016     private ExtFuncMap fctMap;
00017     
00018     public ExpressionVerification ( ExtFuncMap fm ) {
00019         fctMap = fm;
00020     }
00021     
00022     public boolean check ( Expression objExpression ) {
00023         MetricVarMap vm = new MetricVarMap(false /* case sensitive */);
00024 
00025         vm.setScope(null);
00026         try {
00027             double dValue = objExpression.eval(vm, fctMap);
00028             return (dValue == 0);
00029         } catch(java.lang.Exception e) {
00030             // should throw an exception
00031             e.printStackTrace();
00032         }
00033 
00034         return false;
00035     }
00036 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1