org.dmg.pmml.Lag Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pmml-model-gwt Show documentation
Show all versions of pmml-model-gwt Show documentation
JPMML GWT compatible class model
package org.dmg.pmml;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.dmg.pmml.adapters.FieldNameAdapter;
import org.dmg.pmml.adapters.PositiveIntegerAdapter;
import org.jpmml.model.MissingAttributeException;
import org.jpmml.model.annotations.AlternateValueConstructor;
import org.jpmml.model.annotations.ValueConstructor;
@XmlRootElement(name = "Lag", namespace = "http://www.dmg.org/PMML-4_4")
@XmlType(name = "", propOrder = {
"extensions",
"blockIndicators"
})
@JsonRootName("Lag")
@JsonPropertyOrder({
"field",
"n",
"aggregate",
"extensions",
"blockIndicators"
})
@org.jpmml.model.annotations.Added((org.dmg.pmml.Version.PMML_4_3))
public class Lag
extends Expression
implements HasExtensions , HasFieldReference
{
@XmlAttribute(name = "field", required = true)
@XmlJavaTypeAdapter(FieldNameAdapter.class)
@JsonProperty("field")
private String field;
@XmlAttribute(name = "n")
@XmlJavaTypeAdapter(PositiveIntegerAdapter.class)
@XmlSchemaType(name = "positiveInteger")
@JsonProperty("n")
private Integer n;
@XmlAttribute(name = "aggregate")
@JsonProperty("aggregate")
@org.jpmml.model.annotations.Added((org.dmg.pmml.Version.PMML_4_4))
private String aggregate;
@XmlElement(name = "Extension", namespace = "http://www.dmg.org/PMML-4_4")
@JsonProperty("Extension")
private List extensions;
@XmlElement(name = "BlockIndicator", namespace = "http://www.dmg.org/PMML-4_4")
@JsonProperty("BlockIndicator")
private List blockIndicators;
private final static Integer DEFAULT_N = new PositiveIntegerAdapter().unmarshal("1");
private final static long serialVersionUID = 67371270L;
public Lag() {
}
@ValueConstructor
public Lag(
@org.jpmml.model.annotations.Property("field")
String field) {
this.field = field;
}
@AlternateValueConstructor
public Lag(Field> field) {
this(((field!= null)?field.requireName():null));
}
@Override
public String requireField() {
if (this.field == null) {
throw new MissingAttributeException(this, PMMLAttributes.LAG_FIELD);
}
return this.field;
}
@Override
public String getField() {
return field;
}
@Override
public Lag setField(
@org.jpmml.model.annotations.Property("field")
String field) {
this.field = field;
return this;
}
public Integer getN() {
if (n == null) {
return DEFAULT_N;
} else {
return n;
}
}
public Lag setN(
@org.jpmml.model.annotations.Property("n")
Integer n) {
this.n = n;
return this;
}
public String getAggregate() {
if (aggregate == null) {
return "none";
} else {
return aggregate;
}
}
public Lag setAggregate(
@org.jpmml.model.annotations.Property("aggregate")
String aggregate) {
this.aggregate = aggregate;
return this;
}
@Override
public boolean hasExtensions() {
return ((this.extensions!= null)&&(!this.extensions.isEmpty()));
}
@Override
public List getExtensions() {
if (extensions == null) {
extensions = new ArrayList();
}
return this.extensions;
}
@Override
public Lag addExtensions(Extension... extensions) {
getExtensions().addAll(Arrays.asList(extensions));
return this;
}
public boolean hasBlockIndicators() {
return ((this.blockIndicators!= null)&&(!this.blockIndicators.isEmpty()));
}
public List getBlockIndicators() {
if (blockIndicators == null) {
blockIndicators = new ArrayList();
}
return this.blockIndicators;
}
public Lag addBlockIndicators(BlockIndicator... blockIndicators) {
getBlockIndicators().addAll(Arrays.asList(blockIndicators));
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)&&hasBlockIndicators()) {
status = PMMLObject.traverse(visitor, getBlockIndicators());
}
visitor.popParent();
}
if (status == VisitorAction.TERMINATE) {
return VisitorAction.TERMINATE;
}
return VisitorAction.CONTINUE;
}
}