org.dmg.pmml.sequence.SetPredicate Maven / Gradle / Ivy
package org.dmg.pmml.sequence;
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.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
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 org.dmg.pmml.Array;
import org.dmg.pmml.Extension;
import org.dmg.pmml.FieldName;
import org.dmg.pmml.HasExtensions;
import org.dmg.pmml.HasFieldReference;
import org.dmg.pmml.HasId;
import org.dmg.pmml.HasValueSet;
import org.dmg.pmml.StringValue;
import org.dmg.pmml.Visitor;
import org.dmg.pmml.VisitorAction;
import org.dmg.pmml.adapters.FieldNameAdapter;
import org.jpmml.model.annotations.Deprecated;
import org.jpmml.model.annotations.ValueConstructor;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"extensions",
"array"
})
@XmlRootElement(name = "SetPredicate", namespace = "http://www.dmg.org/PMML-4_3")
@Deprecated((org.dmg.pmml.Version.PMML_3_1))
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, isGetterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonPropertyOrder({
"id",
"field",
"operator",
"extensions",
"array"
})
public class SetPredicate
extends org.dmg.pmml.PMMLObject
implements HasExtensions , HasFieldReference , HasId , HasValueSet
{
@XmlAttribute(name = "id", required = true)
@JsonProperty("id")
private String id;
@XmlAttribute(name = "field", required = true)
@XmlJavaTypeAdapter(FieldNameAdapter.class)
@JsonProperty("field")
private FieldName field;
@XmlAttribute(name = "operator")
@JsonProperty("operator")
private SetPredicate.Operator operator;
@XmlElement(name = "Extension", namespace = "http://www.dmg.org/PMML-4_3")
@JsonProperty("Extension")
private List extensions;
@XmlElement(name = "Array", namespace = "http://www.dmg.org/PMML-4_3")
@JsonProperty("Array")
private Array array;
private final static long serialVersionUID = 67305489L;
public SetPredicate() {
}
@ValueConstructor
public SetPredicate(
@org.jpmml.model.annotations.Property("id")
String id,
@org.jpmml.model.annotations.Property("field")
FieldName field,
@org.jpmml.model.annotations.Property("array")
Array array) {
this.id = id;
this.field = field;
this.array = array;
}
@Override
public String getId() {
return id;
}
@Override
public SetPredicate setId(
@org.jpmml.model.annotations.Property("id")
String id) {
this.id = id;
return this;
}
@Override
public FieldName getField() {
return field;
}
@Override
public SetPredicate setField(
@org.jpmml.model.annotations.Property("field")
FieldName field) {
this.field = field;
return this;
}
public SetPredicate.Operator getOperator() {
if (operator == null) {
return SetPredicate.Operator.SUPERSET_OF;
} else {
return operator;
}
}
public SetPredicate setOperator(
@org.jpmml.model.annotations.Property("operator")
SetPredicate.Operator operator) {
this.operator = operator;
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 SetPredicate addExtensions(Extension... extensions) {
getExtensions().addAll(Arrays.asList(extensions));
return this;
}
@Override
public Array getArray() {
return array;
}
@Override
public SetPredicate setArray(
@org.jpmml.model.annotations.Property("array")
Array array) {
this.array = array;
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) {
status = org.dmg.pmml.PMMLObject.traverse(visitor, getArray());
}
visitor.popParent();
}
if (status == VisitorAction.TERMINATE) {
return VisitorAction.TERMINATE;
}
return VisitorAction.CONTINUE;
}
@XmlType(name = "")
@XmlEnum
public enum Operator
implements StringValue
{
@XmlEnumValue("supersetOf")
@JsonProperty("supersetOf")
SUPERSET_OF("supersetOf");
private final String value;
Operator(String v) {
value = v;
}
@Override
public String value() {
return value;
}
public static SetPredicate.Operator fromValue(String v) {
for (SetPredicate.Operator c: SetPredicate.Operator.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
@Override
public String toString() {
return value();
}
}
}