org.dmg.pmml.ExponentialSmoothing Maven / Gradle / Ivy
package org.dmg.pmml;
import java.util.ArrayList;
import java.util.Collection;
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.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.sun.xml.bind.Locatable;
import com.sun.xml.bind.annotation.XmlLocation;
import org.jpmml.schema.Added;
import org.jpmml.schema.Version;
import org.xml.sax.Locator;
/**
* 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}Level"/>
* <element ref="{http://www.dmg.org/PMML-4_2}Trend_ExpoSmooth" minOccurs="0"/>
* <element ref="{http://www.dmg.org/PMML-4_2}Seasonality_ExpoSmooth" minOccurs="0"/>
* <element ref="{http://www.dmg.org/PMML-4_2}TimeValue" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attribute name="RMSE" type="{http://www.dmg.org/PMML-4_2}REAL-NUMBER" />
* <attribute name="transformation" default="none">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}NMTOKEN">
* <enumeration value="none"/>
* <enumeration value="logarithmic"/>
* <enumeration value="squareroot"/>
* </restriction>
* </simpleType>
* </attribute>
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"level",
"trendExpoSmooth",
"seasonalityExpoSmooth",
"timeValues"
})
@XmlRootElement(name = "ExponentialSmoothing")
@Added(Version.PMML_4_0)
public class ExponentialSmoothing
extends PMMLObject
implements Locatable
{
@XmlElement(name = "Level", required = true)
protected Level level;
@XmlElement(name = "Trend_ExpoSmooth")
protected TrendExpoSmooth trendExpoSmooth;
@XmlElement(name = "Seasonality_ExpoSmooth")
protected SeasonalityExpoSmooth seasonalityExpoSmooth;
@XmlElement(name = "TimeValue")
protected List timeValues;
@XmlAttribute(name = "RMSE")
protected Double rmse;
@XmlAttribute(name = "transformation")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String transformation;
@XmlLocation
@XmlTransient
protected Locator locator;
public ExponentialSmoothing() {
super();
}
public ExponentialSmoothing(final Level level) {
super();
this.level = level;
}
/**
* Gets the value of the level property.
*
* @return
* possible object is
* {@link Level }
*
*/
public Level getLevel() {
return level;
}
/**
* Sets the value of the level property.
*
* @param value
* allowed object is
* {@link Level }
*
*/
public void setLevel(Level value) {
this.level = value;
}
/**
* Gets the value of the trendExpoSmooth property.
*
* @return
* possible object is
* {@link TrendExpoSmooth }
*
*/
public TrendExpoSmooth getTrendExpoSmooth() {
return trendExpoSmooth;
}
/**
* Sets the value of the trendExpoSmooth property.
*
* @param value
* allowed object is
* {@link TrendExpoSmooth }
*
*/
public void setTrendExpoSmooth(TrendExpoSmooth value) {
this.trendExpoSmooth = value;
}
/**
* Gets the value of the seasonalityExpoSmooth property.
*
* @return
* possible object is
* {@link SeasonalityExpoSmooth }
*
*/
public SeasonalityExpoSmooth getSeasonalityExpoSmooth() {
return seasonalityExpoSmooth;
}
/**
* Sets the value of the seasonalityExpoSmooth property.
*
* @param value
* allowed object is
* {@link SeasonalityExpoSmooth }
*
*/
public void setSeasonalityExpoSmooth(SeasonalityExpoSmooth value) {
this.seasonalityExpoSmooth = value;
}
/**
* Gets the value of the timeValues 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 timeValues property.
*
*
* For example, to add a new item, do as follows:
*
* getTimeValues().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link TimeValue }
*
*
*/
public List getTimeValues() {
if (timeValues == null) {
timeValues = new ArrayList();
}
return this.timeValues;
}
/**
* Gets the value of the rmse property.
*
* @return
* possible object is
* {@link Double }
*
*/
public Double getRMSE() {
return rmse;
}
/**
* Sets the value of the rmse property.
*
* @param value
* allowed object is
* {@link Double }
*
*/
public void setRMSE(Double value) {
this.rmse = value;
}
/**
* Gets the value of the transformation property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTransformation() {
if (transformation == null) {
return "none";
} else {
return transformation;
}
}
/**
* Sets the value of the transformation property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTransformation(String value) {
this.transformation = value;
}
public ExponentialSmoothing withLevel(Level value) {
setLevel(value);
return this;
}
public ExponentialSmoothing withTrendExpoSmooth(TrendExpoSmooth value) {
setTrendExpoSmooth(value);
return this;
}
public ExponentialSmoothing withSeasonalityExpoSmooth(SeasonalityExpoSmooth value) {
setSeasonalityExpoSmooth(value);
return this;
}
public ExponentialSmoothing withTimeValues(TimeValue... values) {
if (values!= null) {
for (TimeValue value: values) {
getTimeValues().add(value);
}
}
return this;
}
public ExponentialSmoothing withTimeValues(Collection values) {
if (values!= null) {
getTimeValues().addAll(values);
}
return this;
}
public ExponentialSmoothing withRMSE(Double value) {
setRMSE(value);
return this;
}
public ExponentialSmoothing withTransformation(String value) {
setTransformation(value);
return this;
}
public Locator sourceLocation() {
return locator;
}
public void setSourceLocation(Locator newLocator) {
locator = newLocator;
}
@Override
public VisitorAction accept(Visitor visitor) {
VisitorAction status = visitor.visit(this);
if ((status == VisitorAction.CONTINUE)&&(this.level!= null)) {
status = this.level.accept(visitor);
}
if ((status == VisitorAction.CONTINUE)&&(this.trendExpoSmooth!= null)) {
status = this.trendExpoSmooth.accept(visitor);
}
if ((status == VisitorAction.CONTINUE)&&(this.seasonalityExpoSmooth!= null)) {
status = this.seasonalityExpoSmooth.accept(visitor);
}
for (int i = 0; (((status == VisitorAction.CONTINUE)&&(this.timeValues!= null))&&(i