
org.dmg.pmml.DefineFunction 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;
/**
* 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_2}Extension" maxOccurs="unbounded" minOccurs="0"/>
* <element ref="{http://www.dmg.org/PMML-4_2}ParameterField" maxOccurs="unbounded"/>
* <group ref="{http://www.dmg.org/PMML-4_2}EXPRESSION"/>
* </sequence>
* <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="optype" use="required" type="{http://www.dmg.org/PMML-4_2}OPTYPE" />
* <attribute name="dataType" type="{http://www.dmg.org/PMML-4_2}DATATYPE" />
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"extensions",
"parameterFields",
"expression"
})
@XmlRootElement(name = "DefineFunction", namespace = "http://www.dmg.org/PMML-4_2")
public class DefineFunction
extends org.dmg.pmml.PMMLObject
implements HasExpression, HasExtensions, Indexable
{
@XmlAttribute(name = "name", required = true)
private String name;
@XmlAttribute(name = "optype", required = true)
private OpType opType;
@XmlAttribute(name = "dataType")
private DataType dataType;
@XmlElement(name = "Extension", namespace = "http://www.dmg.org/PMML-4_2")
private List extensions;
@XmlElement(name = "ParameterField", namespace = "http://www.dmg.org/PMML-4_2", required = true)
private List parameterFields;
@XmlElements({
@XmlElement(name = "Constant", namespace = "http://www.dmg.org/PMML-4_2", type = Constant.class),
@XmlElement(name = "FieldRef", namespace = "http://www.dmg.org/PMML-4_2", type = FieldRef.class),
@XmlElement(name = "NormContinuous", namespace = "http://www.dmg.org/PMML-4_2", type = NormContinuous.class),
@XmlElement(name = "NormDiscrete", namespace = "http://www.dmg.org/PMML-4_2", type = NormDiscrete.class),
@XmlElement(name = "Discretize", namespace = "http://www.dmg.org/PMML-4_2", type = Discretize.class),
@XmlElement(name = "MapValues", namespace = "http://www.dmg.org/PMML-4_2", type = MapValues.class),
@XmlElement(name = "TextIndex", namespace = "http://www.dmg.org/PMML-4_2", type = TextIndex.class),
@XmlElement(name = "Apply", namespace = "http://www.dmg.org/PMML-4_2", type = Apply.class),
@XmlElement(name = "Aggregate", namespace = "http://www.dmg.org/PMML-4_2", type = Aggregate.class)
})
private Expression expression;
public DefineFunction() {
super();
}
public DefineFunction(final String name, final OpType opType, final List parameterFields) {
super();
this.name = name;
this.opType = opType;
this.parameterFields = parameterFields;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param name
* allowed object is
* {@link String }
*
*/
public DefineFunction setName(String name) {
this.name = name;
return this;
}
/**
* Gets the value of the opType property.
*
* @return
* possible object is
* {@link OpType }
*
*/
public OpType getOpType() {
return opType;
}
/**
* Sets the value of the opType property.
*
* @param opType
* allowed object is
* {@link OpType }
*
*/
public DefineFunction setOpType(OpType opType) {
this.opType = opType;
return this;
}
/**
* Gets the value of the dataType property.
*
* @return
* possible object is
* {@link DataType }
*
*/
public DataType getDataType() {
return dataType;
}
/**
* Sets the value of the dataType property.
*
* @param dataType
* allowed object is
* {@link DataType }
*
*/
public DefineFunction setDataType(DataType dataType) {
this.dataType = dataType;
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 parameterFields 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 parameterFields property.
*
*
* For example, to add a new item, do as follows:
*
* getParameterFields().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link ParameterField }
*
*
*/
public List getParameterFields() {
if (parameterFields == null) {
parameterFields = new ArrayList();
}
return this.parameterFields;
}
/**
* Gets the value of the expression property.
*
* @return
* possible object is
* {@link Constant }
* {@link FieldRef }
* {@link NormContinuous }
* {@link NormDiscrete }
* {@link Discretize }
* {@link MapValues }
* {@link TextIndex }
* {@link Apply }
* {@link Aggregate }
*
*/
public Expression getExpression() {
return expression;
}
/**
* Sets the value of the expression property.
*
* @param expression
* allowed object is
* {@link Constant }
* {@link FieldRef }
* {@link NormContinuous }
* {@link NormDiscrete }
* {@link Discretize }
* {@link MapValues }
* {@link TextIndex }
* {@link Apply }
* {@link Aggregate }
*
*/
public DefineFunction setExpression(Expression expression) {
this.expression = expression;
return this;
}
@Override
public String getKey() {
return getName();
}
public boolean hasExtensions() {
return ((this.extensions!= null)&&(this.extensions.size()> 0));
}
public DefineFunction addExtensions(Extension... extensions) {
getExtensions().addAll(Arrays.asList(extensions));
return this;
}
public boolean hasParameterFields() {
return ((this.parameterFields!= null)&&(this.parameterFields.size()> 0));
}
public DefineFunction addParameterFields(ParameterField... parameterFields) {
getParameterFields().addAll(Arrays.asList(parameterFields));
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)&&hasParameterFields()) {
status = org.dmg.pmml.PMMLObject.traverse(visitor, getParameterFields());
}
if (status == VisitorAction.CONTINUE) {
status = org.dmg.pmml.PMMLObject.traverse(visitor, getExpression());
}
visitor.popParent();
}
if (status == VisitorAction.TERMINATE) {
return VisitorAction.TERMINATE;
}
return VisitorAction.CONTINUE;
}
}