/** * Get the result of applying this function. * * @param incoming the arguments to this function (supplied in order to match that * of the parameter definitions * @return the result of applying this function. When the optype is * categorical or ordinal, an index into the values of the output definition * is returned. * @throws Exception if there is a problem computing the result of this function */ public double getResult(double[] incoming) throws Exception { if (m_parameterDefs == null) { throw new Exception("[BuiltInArithmetic] incoming parameter structure has not been set!"); } if (m_parameterDefs.size() != 2 || incoming.length != 2) { throw new Exception("[BuiltInArithmetic] wrong number of parameters!"); } double result = m_operator.eval(incoming[0], incoming[1]); return result; }
/** * Get the result of applying this function. * * @param incoming the arguments to this function (supplied in order to match that * of the parameter definitions * @return the result of applying this function. When the optype is * categorical or ordinal, an index into the values of the output definition * is returned. * @throws Exception if there is a problem computing the result of this function */ public double getResult(double[] incoming) throws Exception { if (m_parameterDefs == null) { throw new Exception("[BuiltInArithmetic] incoming parameter structure has not been set!"); } if (m_parameterDefs.size() != 2 || incoming.length != 2) { throw new Exception("[BuiltInArithmetic] wrong number of parameters!"); } double result = m_operator.eval(incoming[0], incoming[1]); return result; }
/** * Construct a new Arithmetic built-in pmml function. * @param op the operator to use. */ public BuiltInArithmetic(Operator op) { m_operator = op; m_functionName = m_operator.toString(); }
/** * Get the structure of the result produced by this function. * Subclasses must implement. * * @return the structure of the result produced by this function. */ public Attribute getOutputDef() { return new Attribute("BuiltInArithmeticResult:" + m_operator.toString()); }
/** * Get the structure of the result produced by this function. * Subclasses must implement. * * @return the structure of the result produced by this function. */ public Attribute getOutputDef() { return new Attribute("BuiltInArithmeticResult:" + m_operator.toString()); }
/** * Construct a new Arithmetic built-in pmml function. * @param op the operator to use. */ public BuiltInArithmetic(Operator op) { m_operator = op; m_functionName = m_operator.toString(); }