Package weka.core.pmml

# Class Constant

java.lang.Object
weka.core.pmml.Expression
weka.core.pmml.Constant

All Implemented Interfaces:
  `Serializable`

public class Constant extends Expression
Class encapsulating a Constant Expression.

Version:
  $Revision 1.0 $
Author:
  Mark Hall (mhall{[at]}pentaho{[dot]}com
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Constant(Element constant, FieldMetaInfo.Optype opType, ArrayList<Attribute> fieldDefs)`
  Construct an new Constant Expression.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double`
  `getResult(double[] incoming)`
  Get the result of evaluating the expression.
  `String`
  `getResultCategorical(double[] incoming)`
  Gets the result of evaluating the expression when the optype is categorical or ordinal as the actual String value.
  `static void`
  `main(String[] args)`
  `String`
  `toString(String pad)`

  ### Methods inherited from class weka.core.pmml.Expression

  `getExpression, getExpression, getFieldDef, getFieldDefIndex, getOptype, getResultContinuous, setFieldDefs, toString`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Constant

    public Constant(Element constant, FieldMetaInfo.Optype opType, ArrayList<Attribute> fieldDefs) throws Exception
    Construct an new Constant Expression.
    Parameters:
      `constant` - the xml Element containing the Constant
      `opType` - the optype for the Constant
      `fieldDefs` - an ArrayList of Attributes for the fields that this Expression might need to access (not needed for a constant!)
    Throws:
      `Exception` - if the optype is specified as continuous and there is a problem parsing the value of the Constant

- ## Method Details

  - ### getResult

    public double getResult(double[] incoming)
    Get the result of evaluating the expression. In the case of a continuous optype, a real number is returned; in the case of a categorical/ordinal optype, the index of the nominal value is returned as a double.
    Specified by:
      `getResult` in class `Expression`
    Parameters:
      `incoming` - the incoming parameter values
    Returns:
      the result of evaluating the expression

  - ### getResultCategorical

    public String getResultCategorical(double[] incoming) throws Exception
    Gets the result of evaluating the expression when the optype is categorical or ordinal as the actual String value.
    Specified by:
      `getResultCategorical` in class `Expression`
    Parameters:
      `incoming` - the incoming parameter values
    Returns:
      the result of evaluating the expression
    Throws:
      `Exception` - if the optype is continuous

  - ### main

    public static void main(String[] args)

  - ### toString

    public String toString(String pad)
    Overrides:
      `toString` in class `Expression`