Package jmt.engine.math.parser

Examples of jmt.engine.math.parser.Parser$Element


   * @param meanExpression expression to be evaluated to find mean value
   */
  public synchronized void setRangeDistributionMean(Object key, String meanExpression) {
    Range tmp = ranges.get(key);
    // Calculates min value using parser and sets it into distribution
    Parser parser = new Parser(meanExpression, true);

    try {
      parser.setVariable(VAR, tmp.from);
      tmp.distribution.setMean(parser.getValue());
      // Allow range only if its value in 'from' point is assignable to
      // current distribution
      if (tmp.distribution.getMean() - parser.getValue() < 1e-5) {
        tmp.meanExpression = parser.getExpression();
      }
    } catch (ParseError e) {
      // Do nothing
    } catch (EvaluationException e) {
      // Do nothing
View Full Code Here


  public double getMeanValue(int jobs) {
    // Finds key of right range
    Object key = ranges.headMap(new Integer(jobs + 1)).lastKey();
    Range range = ranges.get(key);

    Parser parser = new Parser(range.meanExpression, true);

    try {
      parser.setVariable(VAR, jobs);
      return parser.getValue();
    } catch (ParseError e) {
      // Do nothing
    } catch (EvaluationException e) {
      // Do nothing
    }
View Full Code Here

  /* (non-Javadoc)
   * @see jmt.gui.exact.ld.eval.Evaluator#evaluate(java.lang.String, double)
   */
  public double evaluate(String expression, double x) throws ExpressionParseException {
    try {
      Parser p = new Parser(expression, true);
      p.setVariable(X, x);
      return p.getValue();
    } catch (RuntimeException ex) {
      throw new ExpressionParseException(ex.getMessage());
    }
  }
View Full Code Here

  /* (non-Javadoc)
   * @see jmt.gui.exact.ld.eval.Evaluator#evaluate(java.lang.String, double[])
   */
  public double[] evaluate(String expression, double[] x) throws ExpressionParseException {
    try {
      Parser p = new Parser(expression, true);
      double[] y = new double[x.length];
      for (int i = 0; i < x.length; i++) {
        p.setVariable(X, x[i]);
        y[i] = p.getValue();
      }
      return y;
    } catch (RuntimeException ex) {
      throw new ExpressionParseException(ex.getMessage());
    }
View Full Code Here

    this.from = from.intValue();
    this.distribution = distr;
    this.parameter = parameter;
    if (function != null) {
      this.function = function.toLowerCase();
      parser = new Parser(function, true);
    }

  }
View Full Code Here

    /**
     * @see org.andromda.metafacades.uml.EventFacade#getTransition()
     */
    protected java.lang.Object handleGetTransition()
    {
        Element owner = this.metaObject.getOwner();
        if (owner instanceof Transition)
        {
            return owner;
        }
        return null;
View Full Code Here

    /**
     * @see org.andromda.metafacades.uml.EventFacade#getState()
     */
    protected java.lang.Object handleGetState()
    {
        Element owner = this.metaObject.getOwner();
        if (owner instanceof State)
        {
            return owner;
        }
        return null;
View Full Code Here

    /**
     * @see org.andromda.metafacades.uml.FrontEndController#getUseCase()
     */
    protected java.lang.Object handleGetUseCase()
    {
        Element owner = (Classifier)this.metaObject;
        while (!(owner == null || owner instanceof UseCase))
        {
            owner = owner.getOwner();
        }
        return owner;
    }
View Full Code Here

    /**
     * @see org.andromda.metafacades.uml.ActivityGraphFacade#getUseCase()
     */
    protected java.lang.Object handleGetUseCase()
    {
        Element owner = (this.metaObject).getOwner();
        if (owner instanceof UseCase)
        {
            return owner;
        }

View Full Code Here

    {
        // TODO: What should this method return ?
      // As I've seen in uml1.4 impl, it should return the statemachine which this element is the context for.
      // Let's say for UML2: Return the owner if the latter is a StateMachine
      StateMachine stateMachine = null;
        Element owner = this.metaObject.getOwner();
        if(owner instanceof StateMachine)
        {
          stateMachine = (StateMachine) owner;
        }
        return stateMachine;
View Full Code Here

TOP

Related Classes of jmt.engine.math.parser.Parser$Element

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.