private static JiffleType ensureScalar(Expression e) throws NodeException { JiffleType type = e.getType(); if (type == JiffleType.D) { return type; } throw new NodeException(Errors.EXPECTED_SCALAR); }
private static JiffleType ensureScalar(Expression e) throws NodeException { JiffleType type = e.getType(); if (type == JiffleType.D) { return type; } throw new NodeException(Errors.EXPECTED_SCALAR); }
public ConFunction(Expression ...args) throws NodeException { super( args[0].getType() ); // first arg (condition) must be scalar if (args[0].getType() != JiffleType.D) { throw new NodeException(Errors.CON_CONDITION_MUST_BE_SCALAR); } if (args.length > 2) { for (int i = 2; i < args.length; i++) { if (args[1].getType() != args[i].getType()) { throw new NodeException(Errors.CON_RESULTS_MUST_BE_SAME_TYPE); } } } this.args = args; }
public ConFunction(Expression ...args) throws NodeException { super( args[0].getType() ); // first arg (condition) must be scalar if (args[0].getType() != JiffleType.D) { throw new NodeException(Errors.CON_CONDITION_MUST_BE_SCALAR); } if (args.length > 2) { for (int i = 2; i < args.length; i++) { if (args[1].getType() != args[i].getType()) { throw new NodeException(Errors.CON_RESULTS_MUST_BE_SAME_TYPE); } } } this.args = args; }
public static FunctionCall of(String jiffleName, Expression ...args) throws NodeException { JiffleType[] argTypes = (args == null) ? new JiffleType[0] : new JiffleType[args.length]; for (int i = 0; i < argTypes.length; i++) { argTypes[i] = args[i].getType(); } try { FunctionInfo info = FunctionLookup.getInfo(jiffleName, argTypes); return new FunctionCall(info, args); } catch (UndefinedFunctionException ex) { throw new NodeException(Errors.UNKNOWN_FUNCTION); } }
public static FunctionCall of(String jiffleName, Expression ...args) throws NodeException { JiffleType[] argTypes = (args == null) ? new JiffleType[0] : new JiffleType[args.length]; for (int i = 0; i < argTypes.length; i++) { argTypes[i] = args[i].getType(); } try { FunctionInfo info = FunctionLookup.getInfo(jiffleName, argTypes); return new FunctionCall(info, args); } catch (UndefinedFunctionException ex) { throw new NodeException(Errors.UNKNOWN_FUNCTION); } }
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; }
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; }