org.dmg.pmml.bayesian_network.ContinuousNode Maven / Gradle / Ivy
package org.dmg.pmml.bayesian_network;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.dmg.pmml.DerivedField;
import org.dmg.pmml.Extension;
import org.dmg.pmml.FieldName;
import org.dmg.pmml.HasExtensions;
import org.dmg.pmml.Visitor;
import org.dmg.pmml.VisitorAction;
import org.dmg.pmml.adapters.FieldNameAdapter;
import org.dmg.pmml.adapters.RealNumberAdapter;
import org.jpmml.model.annotations.Added;
import org.jpmml.model.annotations.ValueConstructor;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"extensions",
"derivedFields",
"content"
})
@XmlRootElement(name = "ContinuousNode", namespace = "http://www.dmg.org/PMML-4_3")
@Added((org.dmg.pmml.Version.PMML_4_3))
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, isGetterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonPropertyOrder({
"name",
"count",
"extensions",
"derivedFields",
"content"
})
public class ContinuousNode
extends org.dmg.pmml.PMMLObject
implements HasExtensions
{
@XmlAttribute(name = "name", required = true)
@XmlJavaTypeAdapter(FieldNameAdapter.class)
@JsonProperty("name")
private FieldName name;
@XmlAttribute(name = "count")
@XmlJavaTypeAdapter(RealNumberAdapter.class)
@JsonProperty("count")
private Number count;
@XmlElement(name = "Extension", namespace = "http://www.dmg.org/PMML-4_3")
@JsonProperty("Extension")
private List extensions;
@XmlElement(name = "DerivedField", namespace = "http://www.dmg.org/PMML-4_3")
@JsonProperty("DerivedField")
private List derivedFields;
@XmlElements({
@XmlElement(name = "ContinuousConditionalProbability", namespace = "http://www.dmg.org/PMML-4_3", type = org.dmg.pmml.bayesian_network.ContinuousConditionalProbability.class),
@XmlElement(name = "ContinuousDistribution", namespace = "http://www.dmg.org/PMML-4_3", type = org.dmg.pmml.bayesian_network.ContinuousDistribution.class)
})
@JsonProperty("content")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
@JsonSubTypes({
@JsonSubTypes.Type(name = "ContinuousConditionalProbability", value = org.dmg.pmml.bayesian_network.ContinuousConditionalProbability.class),
@JsonSubTypes.Type(name = "ContinuousDistribution", value = org.dmg.pmml.bayesian_network.ContinuousDistribution.class)
})
private List content;
private final static long serialVersionUID = 67305489L;
public ContinuousNode() {
}
@ValueConstructor
public ContinuousNode(
@org.jpmml.model.annotations.Property("name")
FieldName name,
@org.jpmml.model.annotations.Property("content")
List content) {
this.name = name;
this.content = content;
}
public FieldName getName() {
return name;
}
public ContinuousNode setName(
@org.jpmml.model.annotations.Property("name")
FieldName name) {
this.name = name;
return this;
}
public Number getCount() {
return count;
}
public ContinuousNode setCount(
@org.jpmml.model.annotations.Property("count")
Number count) {
this.count = count;
return this;
}
@Override
public boolean hasExtensions() {
return ((this.extensions!= null)&&(this.extensions.size()> 0));
}
@Override
public List getExtensions() {
if (extensions == null) {
extensions = new ArrayList();
}
return this.extensions;
}
@Override
public ContinuousNode addExtensions(Extension... extensions) {
getExtensions().addAll(Arrays.asList(extensions));
return this;
}
public boolean hasDerivedFields() {
return ((this.derivedFields!= null)&&(this.derivedFields.size()> 0));
}
public List getDerivedFields() {
if (derivedFields == null) {
derivedFields = new ArrayList();
}
return this.derivedFields;
}
public ContinuousNode addDerivedFields(DerivedField... derivedFields) {
getDerivedFields().addAll(Arrays.asList(derivedFields));
return this;
}
public boolean hasContent() {
return ((this.content!= null)&&(this.content.size()> 0));
}
public List getContent() {
if (content == null) {
content = new ArrayList();
}
return this.content;
}
public ContinuousNode addContent(org.dmg.pmml.PMMLObject... content) {
getContent().addAll(Arrays.asList(content));
return this;
}
@Override
public VisitorAction accept(Visitor visitor) {
VisitorAction status = visitor.visit(this);
if (status == VisitorAction.CONTINUE) {
visitor.pushParent(this);
if ((status == VisitorAction.CONTINUE)&&hasExtensions()) {
status = org.dmg.pmml.PMMLObject.traverse(visitor, getExtensions());
}
if ((status == VisitorAction.CONTINUE)&&hasDerivedFields()) {
status = org.dmg.pmml.PMMLObject.traverse(visitor, getDerivedFields());
}
if ((status == VisitorAction.CONTINUE)&&hasContent()) {
status = org.dmg.pmml.PMMLObject.traverse(visitor, getContent());
}
visitor.popParent();
}
if (status == VisitorAction.TERMINATE) {
return VisitorAction.TERMINATE;
}
return VisitorAction.CONTINUE;
}
}