org.knime.base.node.mine.decisiontree2
Class PMMLCompoundPredicate

java.lang.Object
  extended by org.knime.base.node.mine.decisiontree2.PMMLPredicate
      extended by org.knime.base.node.mine.decisiontree2.PMMLCompoundPredicate

public class PMMLCompoundPredicate
extends PMMLPredicate

Author:
Dominik Morent, KNIME.com, Zurich, Switzerland

Nested Class Summary
 
Nested classes/interfaces inherited from class org.knime.base.node.mine.decisiontree2.PMMLPredicate
PMMLPredicate.PMMLPredicates
 
Field Summary
static String NAME
          The string representation of the predicate's XML-element.
 
Fields inherited from class org.knime.base.node.mine.decisiontree2.PMMLPredicate
ATTRIBUTE_KEY, CDATA, NUMBERFORMAT, OPERATOR_KEY, TYPE_KEY
 
Constructor Summary
PMMLCompoundPredicate(PMMLBooleanOperator operator)
          Build a new PMMLCompoundPredicate.
PMMLCompoundPredicate(String operator)
          Build a new PMMLCompoundPredicate.
 
Method Summary
 boolean addPredicate(PMMLPredicate pred)
          Adds a PMMLPredicate.
 Boolean evaluate(DataRow row, DataTableSpec spec)
          Evaluates the predicate for the passed parameters and returns the result.
 PMMLPredicate getLastPredicate()
          Returns the PMMLPredicate that was most recently added.
 String getName()
          Returns the name of the predicate.
 LinkedList<PMMLPredicate> getPredicates()
          Returns all contained predicates.
 String getSplitAttribute()
          Returns the name of the field the predicate operates on, an empty String if it works on multiple attributes, or null if not applicable.
 void loadFromPredParams(Config conf)
          Load internal predicate settings from a config object.
 void saveToPredParams(Config conf)
          Save internal predicate settings to a config object.
 void setPredicates(LinkedList<PMMLPredicate> predicates)
          Sets the contained predicates.
 String toString()
          
 void writePMML(TransformerHandler handler)
          Writes the PMML XML object for the predicate.
 
Methods inherited from class org.knime.base.node.mine.decisiontree2.PMMLPredicate
cacheSpec, getOperator, getPredicateForConfig, getPredicateForType, getPreviousIndex, getPreviousSpec, setOperator, setOperator, setPreviousIndex, setPreviousSpec, setSplitAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
The string representation of the predicate's XML-element.

See Also:
Constant Field Values
Constructor Detail

PMMLCompoundPredicate

public PMMLCompoundPredicate(String operator)
Build a new PMMLCompoundPredicate.

Parameters:
operator - the string representation of the operator

PMMLCompoundPredicate

public PMMLCompoundPredicate(PMMLBooleanOperator operator)
Build a new PMMLCompoundPredicate.

Parameters:
operator - the PMML operator to be set
Method Detail

getLastPredicate

public PMMLPredicate getLastPredicate()
Returns the PMMLPredicate that was most recently added.

Returns:
the most recently added predicate
See Also:
LinkedList.getLast()

addPredicate

public boolean addPredicate(PMMLPredicate pred)
Adds a PMMLPredicate.

Parameters:
pred - the predicate to be added
Returns:
true (as per the general contract of Collection.add)
See Also:
LinkedList.add(java.lang.Object)

getPredicates

public LinkedList<PMMLPredicate> getPredicates()
Returns all contained predicates.

Returns:
the predicates

setPredicates

public void setPredicates(LinkedList<PMMLPredicate> predicates)
Sets the contained predicates.

Parameters:
predicates - the predicates to set

evaluate

public Boolean evaluate(DataRow row,
                        DataTableSpec spec)
Evaluates the predicate for the passed parameters and returns the result. If values are missing and an evaluation is not possible null is returned.

Specified by:
evaluate in class PMMLPredicate
Parameters:
row - The data row containing the data cells to be evaluated.
spec - The spec for the row.
Returns:
true if the the predicates evaluates to true, false if it evaluates to false, null on missing values

getSplitAttribute

public String getSplitAttribute()
Returns the name of the field the predicate operates on, an empty String if it works on multiple attributes, or null if not applicable.

Overrides:
getSplitAttribute in class PMMLPredicate
Returns:
the name of the field the predicate operates on, "" if working on multiple attributes or null if not applicable

getName

public String getName()
Returns the name of the predicate.

Specified by:
getName in class PMMLPredicate
Returns:
the name of the predicate

loadFromPredParams

public void loadFromPredParams(Config conf)
                        throws InvalidSettingsException
Load internal predicate settings from a config object.

Specified by:
loadFromPredParams in class PMMLPredicate
Parameters:
conf - the config object to load from
Throws:
InvalidSettingsException - - if invalid settings are provided

saveToPredParams

public void saveToPredParams(Config conf)
Save internal predicate settings to a config object.

Specified by:
saveToPredParams in class PMMLPredicate
Parameters:
conf - the config object to write into

toString

public String toString()

Specified by:
toString in class PMMLPredicate

writePMML

public void writePMML(TransformerHandler handler)
               throws SAXException
Writes the PMML XML object for the predicate.

Specified by:
writePMML in class PMMLPredicate
Parameters:
handler - TransformerHandler for parsing and transforming events
Throws:
SAXException - - any SAX exception, possibly wrapping another exception


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.