org.dmg.pmml.time_series.GARCHPart Maven / Gradle / Ivy
package org.dmg.pmml.time_series;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
import org.dmg.pmml.Extension;
import org.dmg.pmml.HasExtensions;
import org.dmg.pmml.Visitor;
import org.dmg.pmml.VisitorAction;
import org.dmg.pmml.adapters.IntegerAdapter;
import org.dmg.pmml.adapters.RealNumberAdapter;
import org.jpmml.model.annotations.Added;
import org.jpmml.model.annotations.ValueConstructor;
@XmlRootElement(name = "GARCHPart", namespace = "http://www.dmg.org/PMML-4_4")
@XmlType(name = "", propOrder = {
"extensions",
"residualSquareCoefficients",
"varianceCoefficients"
})
@Added((org.dmg.pmml.Version.PMML_4_4))
@JsonRootName("GARCHPart")
@JsonPropertyOrder({
"constant",
"gp",
"gq",
"extensions",
"residualSquareCoefficients",
"varianceCoefficients"
})
public class GARCHPart
extends org.dmg.pmml.PMMLObject
implements HasExtensions
{
@XmlAttribute(name = "constant")
@XmlJavaTypeAdapter(RealNumberAdapter.class)
@JsonProperty("constant")
private Number constant;
@XmlAttribute(name = "gp", required = true)
@XmlJavaTypeAdapter(IntegerAdapter.class)
@JsonProperty("gp")
private Integer gp;
@XmlAttribute(name = "gq", required = true)
@XmlJavaTypeAdapter(IntegerAdapter.class)
@JsonProperty("gq")
private Integer gq;
@XmlElement(name = "Extension", namespace = "http://www.dmg.org/PMML-4_4")
@JsonProperty("Extension")
private List extensions;
@XmlElement(name = "ResidualSquareCoefficients", namespace = "http://www.dmg.org/PMML-4_4", required = true)
@JsonProperty("ResidualSquareCoefficients")
private ResidualSquareCoefficients residualSquareCoefficients;
@XmlElement(name = "VarianceCoefficients", namespace = "http://www.dmg.org/PMML-4_4", required = true)
@JsonProperty("VarianceCoefficients")
private VarianceCoefficients varianceCoefficients;
private final static Number DEFAULT_CONSTANT = new RealNumberAdapter().unmarshal("0");
private final static long serialVersionUID = 67371268L;
public GARCHPart() {
}
@ValueConstructor
public GARCHPart(
@org.jpmml.model.annotations.Property("gp")
Integer gp,
@org.jpmml.model.annotations.Property("gq")
Integer gq,
@org.jpmml.model.annotations.Property("residualSquareCoefficients")
ResidualSquareCoefficients residualSquareCoefficients,
@org.jpmml.model.annotations.Property("varianceCoefficients")
VarianceCoefficients varianceCoefficients) {
this.gp = gp;
this.gq = gq;
this.residualSquareCoefficients = residualSquareCoefficients;
this.varianceCoefficients = varianceCoefficients;
}
public Number getConstant() {
if (constant == null) {
return DEFAULT_CONSTANT;
} else {
return constant;
}
}
public GARCHPart setConstant(
@org.jpmml.model.annotations.Property("constant")
Number constant) {
this.constant = constant;
return this;
}
public Integer getGp() {
return gp;
}
public GARCHPart setGp(
@org.jpmml.model.annotations.Property("gp")
Integer gp) {
this.gp = gp;
return this;
}
public Integer getGq() {
return gq;
}
public GARCHPart setGq(
@org.jpmml.model.annotations.Property("gq")
Integer gq) {
this.gq = gq;
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 GARCHPart addExtensions(Extension... extensions) {
getExtensions().addAll(Arrays.asList(extensions));
return this;
}
public ResidualSquareCoefficients getResidualSquareCoefficients() {
return residualSquareCoefficients;
}
public GARCHPart setResidualSquareCoefficients(
@org.jpmml.model.annotations.Property("residualSquareCoefficients")
ResidualSquareCoefficients residualSquareCoefficients) {
this.residualSquareCoefficients = residualSquareCoefficients;
return this;
}
public VarianceCoefficients getVarianceCoefficients() {
return varianceCoefficients;
}
public GARCHPart setVarianceCoefficients(
@org.jpmml.model.annotations.Property("varianceCoefficients")
VarianceCoefficients varianceCoefficients) {
this.varianceCoefficients = varianceCoefficients;
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, getResidualSquareCoefficients(), getVarianceCoefficients());
}
visitor.popParent();
}
if (status == VisitorAction.TERMINATE) {
return VisitorAction.TERMINATE;
}
return VisitorAction.CONTINUE;
}
}