org.dmg.pmml.clustering.CenterFields Maven / Gradle / Ivy
package org.dmg.pmml.clustering;
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.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
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 org.dmg.pmml.DerivedField;
import org.dmg.pmml.Visitor;
import org.dmg.pmml.VisitorAction;
import org.jpmml.model.annotations.Property;
import org.jpmml.model.annotations.Removed;
import org.jpmml.model.annotations.ValueConstructor;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"derivedFields"
})
@XmlRootElement(name = "CenterFields", namespace = "http://www.dmg.org/PMML-4_3")
@Removed((org.dmg.pmml.Version.PMML_3_2))
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, isGetterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonPropertyOrder({
"derivedFields"
})
public class CenterFields
extends org.dmg.pmml.PMMLObject
{
@XmlElement(name = "DerivedField", namespace = "http://www.dmg.org/PMML-4_3", required = true)
@JsonProperty("DerivedField")
private List derivedFields;
private final static long serialVersionUID = 67305489L;
public CenterFields() {
}
@ValueConstructor
public CenterFields(
@Property("derivedFields")
List derivedFields) {
this.derivedFields = derivedFields;
}
public boolean hasDerivedFields() {
return ((this.derivedFields!= null)&&(this.derivedFields.size()> 0));
}
public List getDerivedFields() {
if (derivedFields == null) {
derivedFields = new ArrayList();
}
return this.derivedFields;
}
public CenterFields addDerivedFields(DerivedField... derivedFields) {
getDerivedFields().addAll(Arrays.asList(derivedFields));
return this;
}
@Override
public VisitorAction accept(Visitor visitor) {
VisitorAction status = visitor.visit(this);
if (status == VisitorAction.CONTINUE) {
visitor.pushParent(this);
if ((status == VisitorAction.CONTINUE)&&hasDerivedFields()) {
status = org.dmg.pmml.PMMLObject.traverse(visitor, getDerivedFields());
}
visitor.popParent();
}
if (status == VisitorAction.TERMINATE) {
return VisitorAction.TERMINATE;
}
return VisitorAction.CONTINUE;
}
}