org.dmg.pmml.tree.ClassifierNode Maven / Gradle / Ivy
/*
* Copyright (c) 2019 Villu Ruusmann
*/
package org.dmg.pmml.tree;
import java.util.ArrayList;
import java.util.List;
import org.dmg.pmml.Predicate;
import org.dmg.pmml.ScoreDistribution;
import org.jpmml.model.annotations.CopyConstructor;
import org.jpmml.model.annotations.Property;
import org.jpmml.model.annotations.ValueConstructor;
public class ClassifierNode extends SimpleNode {
private Object id = null;
private Number recordCount = null;
private Object defaultChild = null;
private List scoreDistributions = null;
private List nodes = null;
public ClassifierNode(){
}
@ValueConstructor
public ClassifierNode(@Property("score") Object score, @Property("predicate") Predicate predicate){
super(score, predicate);
}
@CopyConstructor
public ClassifierNode(Node node){
super(node);
setId(node.getId());
setRecordCount(node.getRecordCount());
setDefaultChild(node.getDefaultChild());
if(node.hasScoreDistributions()){
(getScoreDistributions()).addAll(node.getScoreDistributions());
} // End if
if(node.hasNodes()){
(getNodes()).addAll(node.getNodes());
}
}
@Override
public Object getId(){
return this.id;
}
@Override
public ClassifierNode setId(@Property("id") Object id){
this.id = id;
return this;
}
@Override
public Number getRecordCount(){
return this.recordCount;
}
@Override
public ClassifierNode setRecordCount(@Property("recordCount") Number recordCount){
this.recordCount = recordCount;
return this;
}
@Override
public Object getDefaultChild(){
return this.defaultChild;
}
@Override
public ClassifierNode setDefaultChild(@Property("defaultChild") Object defaultChild){
this.defaultChild = defaultChild;
return this;
}
@Override
public boolean hasScoreDistributions(){
return (this.scoreDistributions != null) && (this.scoreDistributions.size() > 0);
}
@Override
public List getScoreDistributions(){
if(this.scoreDistributions == null){
this.scoreDistributions = new ArrayList<>();
}
return this.scoreDistributions;
}
@Override
public boolean hasNodes(){
return (this.nodes != null) && (this.nodes.size() > 0);
}
@Override
public List getNodes(){
if(this.nodes == null){
this.nodes = new ArrayList<>();
}
return this.nodes;
}
}