예제 #1
0
  public final double[] getCoords() {
    // check if both ExpressionNodes represent NumberValues
    ExpressionValue evx = x.evaluate();
    if (!evx.isNumberValue()) {
      String[] str = {"NumberExpected", evx.toString()};
      throw new MyParseError(kernel.getApplication(), str);
    }
    ExpressionValue evy = y.evaluate();
    if (!evy.isNumberValue()) {
      String[] str = {"NumberExpected", evy.toString()};
      throw new MyParseError(kernel.getApplication(), str);
    }
    ExpressionValue evz = z.evaluate();
    if (!evz.isNumberValue()) {
      String[] str = {"NumberExpected", evz.toString()};
      throw new MyParseError(kernel.getApplication(), str);
    }

    double[] ret = {
      ((NumberValue) evx).getDouble(),
      ((NumberValue) evy).getDouble(),
      ((NumberValue) evz).getDouble()
    };
    return ret;
  }
예제 #2
0
  public final String toString() {
    StringBuilder sb = new StringBuilder();

    sb.append('(');
    sb.append(x.toString());
    sb.append(", ");
    sb.append(y.toString());
    sb.append(", ");
    sb.append(z.toString());
    sb.append(')');
    return sb.toString();
  }