org.dmg.pmml.Apply Maven / Gradle / Ivy
package org.dmg.pmml;
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 org.jpmml.schema.Added;
import org.jpmml.schema.Required;
import org.jpmml.schema.Version;
/**
* Java class for anonymous complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.dmg.org/PMML-4_3}Extension" maxOccurs="unbounded" minOccurs="0"/>
* <group ref="{http://www.dmg.org/PMML-4_3}EXPRESSION" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attribute name="function" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="mapMissingTo" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="defaultValue" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="invalidValueTreatment" type="{http://www.dmg.org/PMML-4_3}INVALID-VALUE-TREATMENT-METHOD" default="returnInvalid" />
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"extensions",
"expressions"
})
@XmlRootElement(name = "Apply", namespace = "http://www.dmg.org/PMML-4_3")
public class Apply
extends org.dmg.pmml.Expression
implements HasExtensions
{
@XmlAttribute(name = "function", required = true)
@Required(Version.PMML_3_1)
private String function;
@XmlAttribute(name = "mapMissingTo")
@Added(Version.PMML_4_1)
private String mapMissingTo;
@XmlAttribute(name = "defaultValue")
@Added(Version.PMML_4_2)
private String defaultValue;
@XmlAttribute(name = "invalidValueTreatment")
@Added(Version.PMML_4_1)
private InvalidValueTreatmentMethod invalidValueTreatment;
@XmlElement(name = "Extension", namespace = "http://www.dmg.org/PMML-4_3")
private List extensions;
@XmlElements({
@XmlElement(name = "Constant", namespace = "http://www.dmg.org/PMML-4_3", type = Constant.class),
@XmlElement(name = "FieldRef", namespace = "http://www.dmg.org/PMML-4_3", type = FieldRef.class),
@XmlElement(name = "NormContinuous", namespace = "http://www.dmg.org/PMML-4_3", type = NormContinuous.class),
@XmlElement(name = "NormDiscrete", namespace = "http://www.dmg.org/PMML-4_3", type = NormDiscrete.class),
@XmlElement(name = "Discretize", namespace = "http://www.dmg.org/PMML-4_3", type = Discretize.class),
@XmlElement(name = "MapValues", namespace = "http://www.dmg.org/PMML-4_3", type = MapValues.class),
@XmlElement(name = "TextIndex", namespace = "http://www.dmg.org/PMML-4_3", type = TextIndex.class),
@XmlElement(name = "Apply", namespace = "http://www.dmg.org/PMML-4_3", type = Apply.class),
@XmlElement(name = "Aggregate", namespace = "http://www.dmg.org/PMML-4_3", type = Aggregate.class),
@XmlElement(name = "Lag", namespace = "http://www.dmg.org/PMML-4_3", type = Lag.class)
})
private List expressions;
public Apply() {
super();
}
public Apply(final String function) {
super();
this.function = function;
}
/**
* Gets the value of the function property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFunction() {
return function;
}
/**
* Sets the value of the function property.
*
* @param function
* allowed object is
* {@link String }
*
*/
public Apply setFunction(String function) {
this.function = function;
return this;
}
/**
* Gets the value of the mapMissingTo property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMapMissingTo() {
return mapMissingTo;
}
/**
* Sets the value of the mapMissingTo property.
*
* @param mapMissingTo
* allowed object is
* {@link String }
*
*/
public Apply setMapMissingTo(String mapMissingTo) {
this.mapMissingTo = mapMissingTo;
return this;
}
/**
* Gets the value of the defaultValue property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDefaultValue() {
return defaultValue;
}
/**
* Sets the value of the defaultValue property.
*
* @param defaultValue
* allowed object is
* {@link String }
*
*/
public Apply setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
return this;
}
/**
* Gets the value of the invalidValueTreatment property.
*
* @return
* possible object is
* {@link InvalidValueTreatmentMethod }
*
*/
public InvalidValueTreatmentMethod getInvalidValueTreatment() {
if (invalidValueTreatment == null) {
return InvalidValueTreatmentMethod.RETURN_INVALID;
} else {
return invalidValueTreatment;
}
}
/**
* Sets the value of the invalidValueTreatment property.
*
* @param invalidValueTreatment
* allowed object is
* {@link InvalidValueTreatmentMethod }
*
*/
public Apply setInvalidValueTreatment(InvalidValueTreatmentMethod invalidValueTreatment) {
this.invalidValueTreatment = invalidValueTreatment;
return this;
}
/**
* Gets the value of the extensions property.
*
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set
method for the extensions property.
*
*
* For example, to add a new item, do as follows:
*
* getExtensions().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link Extension }
*
*
*/
public List getExtensions() {
if (extensions == null) {
extensions = new ArrayList();
}
return this.extensions;
}
/**
* Gets the value of the expressions property.
*
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set
method for the expressions property.
*
*
* For example, to add a new item, do as follows:
*
* getExpressions().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link Constant }
* {@link FieldRef }
* {@link NormContinuous }
* {@link NormDiscrete }
* {@link Discretize }
* {@link MapValues }
* {@link TextIndex }
* {@link Apply }
* {@link Aggregate }
* {@link Lag }
*
*
*/
public List getExpressions() {
if (expressions == null) {
expressions = new ArrayList();
}
return this.expressions;
}
public boolean hasExtensions() {
return ((this.extensions!= null)&&(this.extensions.size()> 0));
}
public Apply addExtensions(Extension... extensions) {
getExtensions().addAll(Arrays.asList(extensions));
return this;
}
public boolean hasExpressions() {
return ((this.expressions!= null)&&(this.expressions.size()> 0));
}
public Apply addExpressions(org.dmg.pmml.Expression... expressions) {
getExpressions().addAll(Arrays.asList(expressions));
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 = PMMLObject.traverse(visitor, getExtensions());
}
if ((status == VisitorAction.CONTINUE)&&hasExpressions()) {
status = PMMLObject.traverse(visitor, getExpressions());
}
visitor.popParent();
}
if (status == VisitorAction.TERMINATE) {
return VisitorAction.TERMINATE;
}
return VisitorAction.CONTINUE;
}
}