Package weka.core.mathematicalexpression

Examples of weka.core.mathematicalexpression.Parser


   * @throws Exception  if something goes wrong
   */
  public static double evaluate(String expr, HashMap symbols) throws Exception {
    SymbolFactory     sf;
    ByteArrayInputStream   parserInput;
    Parser       parser;
   
    sf          = new DefaultSymbolFactory();
    parserInput = new ByteArrayInputStream(expr.getBytes());
    parser      = new Parser(new Scanner(parserInput, sf), sf);
    parser.setSymbols(symbols);
    parser.parse();
   
    return parser.getResult();
  }
View Full Code Here


   * @return    the calculated value, Double.NaN in case of an error
   */
  protected double eval(HashMap symbols) {
    SymbolFactory     sf;
    ByteArrayInputStream   parserInput;
    Parser       parser;
    double      result;
   
    try {
      sf          = new DefaultSymbolFactory();
      parserInput = new ByteArrayInputStream(m_expression.getBytes());
      parser      = new Parser(new Scanner(parserInput, sf), sf);
      parser.setSymbols(symbols);
      parser.parse();
      result = parser.getResult();
    }
    catch (Exception e) {
      result = Double.NaN;
      e.printStackTrace();
    }
View Full Code Here

   * @throws Exception  if something goes wrong
   */
  public static double evaluate(String expr, HashMap symbols) throws Exception {
    SymbolFactory     sf;
    ByteArrayInputStream   parserInput;
    Parser       parser;
   
    sf          = new DefaultSymbolFactory();
    parserInput = new ByteArrayInputStream(expr.getBytes());
    parser      = new Parser(new Scanner(parserInput, sf), sf);
    parser.setSymbols(symbols);
    parser.parse();
   
    return parser.getResult();
  }
View Full Code Here

   * @return    the calculated value, Double.NaN in case of an error
   */
  protected double eval(HashMap symbols) {
    SymbolFactory     sf;
    ByteArrayInputStream   parserInput;
    Parser       parser;
    double      result;
   
    try {
      sf          = new DefaultSymbolFactory();
      parserInput = new ByteArrayInputStream(m_expression.getBytes());
      parser      = new Parser(new Scanner(parserInput, sf), sf);
      parser.setSymbols(symbols);
      parser.parse();
      result = parser.getResult();
    }
    catch (Exception e) {
      result = Double.NaN;
      e.printStackTrace();
    }
View Full Code Here

   * @throws Exception  if something goes wrong
   */
  public static double evaluate(String expr, HashMap symbols) throws Exception {
    SymbolFactory     sf;
    ByteArrayInputStream   parserInput;
    Parser       parser;
   
    sf          = new DefaultSymbolFactory();
    parserInput = new ByteArrayInputStream(expr.getBytes());
    parser      = new Parser(new Scanner(parserInput, sf), sf);
    parser.setSymbols(symbols);
    parser.parse();
   
    return parser.getResult();
  }
View Full Code Here

   * @return    the calculated value, Double.NaN in case of an error
   */
  protected double eval(HashMap symbols) {
    SymbolFactory     sf;
    ByteArrayInputStream   parserInput;
    Parser       parser;
    double      result;
   
    try {
      sf          = new DefaultSymbolFactory();
      parserInput = new ByteArrayInputStream(m_expression.getBytes());
      parser      = new Parser(new Scanner(parserInput, sf), sf);
      parser.setSymbols(symbols);
      parser.parse();
      result = parser.getResult();
    }
    catch (Exception e) {
      result = Double.NaN;
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of weka.core.mathematicalexpression.Parser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.