public BinaryExpression(int opCode, Expression left, Expression right, boolean declarationNeeded) throws NodeException { super(getReturnType(left, right)); this.op = Operator.get(opCode); if (op == Operator.UNKNOWN) { throw new NodeException(Errors.INVALID_BINARY_EXPRESSION); } this.left = left.forceDouble(); this.right = right.forceDouble(); this.declarationNeeded = declarationNeeded; }
/** * Writes out a node to a SourceWriter and returns the resulting script * * @param node * @return */ public String writeToString(Expression node) { SourceWriter sw = new SourceWriter(runtimeModel); node.write(sw); return sw.getSource(); }
private static JiffleType ensureScalar(Expression e) throws NodeException { JiffleType type = e.getType(); if (type == JiffleType.D) { return type; } throw new NodeException(Errors.EXPECTED_SCALAR); }
/** * Writes out a node to a SourceWriter and returns the resulting script * * @param node * @return */ public String writeToString(Expression node) { SourceWriter sw = new SourceWriter(runtimeModel); node.write(sw); return sw.getSource(); }
public BinaryExpression(int opCode, Expression left, Expression right, boolean declarationNeeded) throws NodeException { super(getReturnType(left, right)); this.op = Operator.get(opCode); if (op == Operator.UNKNOWN) { throw new NodeException(Errors.INVALID_BINARY_EXPRESSION); } this.left = left.forceDouble(); this.right = right.forceDouble(); this.declarationNeeded = declarationNeeded; }
private static JiffleType ensureScalar(Expression e) throws NodeException { JiffleType type = e.getType(); if (type == JiffleType.D) { return type; } throw new NodeException(Errors.EXPECTED_SCALAR); }