Examples of UndefinedResultException


Examples of lipstone.joshua.parser.exceptions.UndefinedResultException

    else {
      if (parser.containsVariables(equationParts.get(0), vars)) {
        equation = equationParts.get(0);
        ConsCell temp = parser.run(parser.preProcess(equationParts.get(1)));
        if (temp.getCarType() != ConsType.NUMBER || temp.length() != 1)
          throw new UndefinedResultException("The NumericalSolver requires that the equation contain only one variable.", null);
        answer = (BigDec) temp.getCar();
      }
      if (parser.containsVariables(equationParts.get(1), vars)) {
        equation = equationParts.get(1);
        ConsCell temp = parser.run(parser.preProcess(equationParts.get(0)));
        if (temp.getCarType() != ConsType.NUMBER || temp.length() != 1)
          throw new UndefinedResultException("The NumericalSolver requires that the equation contain only one variable.", null);
        answer = (BigDec) temp.getCar();
      }
    }
    this.equation = parser.preProcess(equation).clone();
    variableCells = new ArrayList<ConsCell>();
View Full Code Here

Examples of lipstone.joshua.parser.exceptions.UndefinedResultException

  private BigDec getY(BigDec x) throws ParserException {
    for (ConsCell c : variableCells)
      c.replaceCar(new ConsCell(x, ConsType.NUMBER));
    ConsCell result = parser.run(equation);
    if (result.getCarType() != ConsType.NUMBER || result.length() != 1)
      throw new UndefinedResultException("The NumericalSolver requires that the equation contain only one variable.", null);
    return (BigDec) result.getCar();
  }
View Full Code Here

Examples of lipstone.joshua.parser.exceptions.UndefinedResultException

    matrix[row][col] = entry;
  }
 
  public BigDec determinant() throws ParserException {
    if (!isSquare())
      throw new UndefinedResultException("The determinant operation is only valid for square matricies.", parser.getLastPlugin());
    if (getCols() == 1)
      return (BigDec) parser.run(get(0, 0)).getCar();
   
    String determinant = "0";
    for (int i = 0; i < getCols(); i++) {
View Full Code Here

Examples of lipstone.joshua.parser.exceptions.UndefinedResultException

    return matrixOp(m2, "-");
  }
 
  public Matrix multiply(Matrix m2) throws SyntaxException, UnbalancedParenthesesException, ParserException {
    if (!isRectangular || !m2.isRectangular || getCols() != m2.getRows())
      throw new UndefinedResultException("Matrix multiplication requires that the number of columns in the first matrix is equal to the number of rows in the second.", parser.getLastPlugin());
    Matrix m = new Matrix(getRows(), m2.getCols());
    for (int r = 0; r < m.getRows(); r++) {
      for (int c = 0; c < m.getCols(); c++) {
        String entry = "0";
        for (int i = 0, a = 0; i < m2.getRows() && a < getCols(); i++, a++)
View Full Code Here

Examples of lipstone.joshua.parser.exceptions.UndefinedResultException

    slopeCells.get(1).replaceCar(new ConsCell(point2[1], ConsType.NUMBER));
    slopeCells.get(2).replaceCar(new ConsCell(point1[0], ConsType.NUMBER));
    slopeCells.get(3).replaceCar(new ConsCell(point2[0], ConsType.NUMBER));
    ConsCell result = parser.run(equation);
    if (result.getCarType() != ConsType.NUMBER || result.length() != 1)
      throw new UndefinedResultException("The NumericalSolver requires that the equation contain only one variable.", null);
    return (BigDec) result.getCar();
  }
View Full Code Here

Examples of lipstone.joshua.parser.exceptions.UndefinedResultException

    return m.compress();
  }
 
  public Matrix divide(Matrix m2) throws UndefinedResultException, ParserException {
    if (!isRectangular || !m2.isInvertible() || getCols() != m2.getRows())
      throw new UndefinedResultException("Matrix division is only applicable when the divisor is an invertable matrix and the number of columns of the dividend equals the number of rows in the divisor.", parser.getLastPlugin());
    return multiply(m2.invert());
  }
View Full Code Here

Examples of lipstone.joshua.parser.exceptions.UndefinedResultException

    return m.compress();
  }
 
  public Matrix invert() throws UndefinedResultException, ParserException {
    if (!isInvertible())
      throw new UndefinedResultException("The matrix is not invertable.", parser.getLastPlugin());
    Matrix output = new Matrix(this);
    output = output.multiply(BigDec.MINUSONE);
    for (int r = 0; r < getRows(); r++)
      output.set(get(getRows() - 1 - r, getCols() - 1 - r), r, r);
    return output.divide(determinant());
View Full Code Here

Examples of scriptingLanguage.errors.UndefinedResultException

    this.parameters = parameters;
  }
 
  @Override
  public Token eval(AbstractClass<?> caller, Token parameters, AbstractFrame frame) throws ArrayIndexOutOfBoundsException, IllegalArgumentException, InterpreterException {
    throw new UndefinedResultException("Cannot instantiate a method from its class data.");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.