Class DecisionTreeNode
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.core.FoundationObject
com.northconcepts.datapipeline.foundations.decisiontree.DecisionTreeObject
com.northconcepts.datapipeline.foundations.decisiontree.DecisionTreeNode
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,Serializable,Cloneable
A node of a
DecisionTree: the condition for entering it, the outcomes it sets when visited, its child nodes and
the default node entered when no child's condition holds.- See Also:
-
Field Summary
Fields inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
internalId, internalName, log, TIMESTAMP_FORMATFields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
ConstructorsConstructorDescriptionDecisionTreeNode(String condition) DecisionTreeNode(String name, String condition) -
Method Summary
Modifier and TypeMethodDescriptionaddNode(DecisionTreeNode node) Adds a child node, which must have a condition.addNode(Collection<DecisionTreeNode> nodes) Adds child nodes, which must all have conditions.addOutcome(DecisionTreeOutcome outcome) addOutcome(String variable, String expression) Adds an outcome that setsvariableto the value ofexpressionwhen this node is visited.addOutcome(Collection<DecisionTreeOutcome> outcomes) clone()fromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).fromXmlElement(Element element) LogicalExpressionReturns the condition for entering this node from its parent; it is not evaluated for root and default nodes.Returns the node entered when no child node's condition holds, or null to stop here.getName()getNodes()Returns the child nodes, checked in order; evaluation enters the first one whose condition holds.Returns the outcomes set when evaluation visits this node.setCondition(LogicalExpression condition) Sets the condition for entering this node from its parent; it is not evaluated for root and default nodes.setDefaultNode(DecisionTreeNode defaultNode) Sets the node entered when no child node's condition holds, or null to stop here.setDescription(String description) toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.toXmlElement(Document document) Returns an element, created withdocument, describing this object; the default implementation throws aDataException.Methods inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
addExceptionProperties, assertValid, assertValid, exception, exception, exception, getInternalId, getInternalName, resetInternalIdMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionProperties
-
Constructor Details
-
DecisionTreeNode
public DecisionTreeNode() -
DecisionTreeNode
-
DecisionTreeNode
-
-
Method Details
-
getName
-
setName
-
getDescription
-
setDescription
-
getCondition
public LogicalExpression getCondition()Returns the condition for entering this node from its parent; it is not evaluated for root and default nodes. -
getConditionAsSource
-
setCondition
Sets the condition for entering this node from its parent; it is not evaluated for root and default nodes. -
getNodes
Returns the child nodes, checked in order; evaluation enters the first one whose condition holds. -
addNode
Adds a child node, which must have a condition. -
addNode
Adds child nodes, which must all have conditions. -
getDefaultNode
Returns the node entered when no child node's condition holds, or null to stop here. -
setDefaultNode
Sets the node entered when no child node's condition holds, or null to stop here. -
getOutcomes
Returns the outcomes set when evaluation visits this node. -
addOutcome
-
addOutcome
Adds an outcome that setsvariableto the value ofexpressionwhen this node is visited. -
addOutcome
-
clone
- Overrides:
clonein classFoundationObject
-
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable- Overrides:
toRecordin classBean
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceRecordSerializable- Overrides:
fromRecordin classBean- Parameters:
source-- Returns:
- this instance.
-
toXmlElement
Description copied from interface:XmlSerializableReturns an element, created withdocument, describing this object; the default implementation throws aDataException.- Specified by:
toXmlElementin interfaceXmlSerializable
-
fromXmlElement
- Specified by:
fromXmlElementin interfaceXmlSerializable
-