org.dmg.pmml.RealSparseArray 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.XmlList;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import com.sun.xml.bind.Locatable;
import com.sun.xml.bind.annotation.XmlLocation;
import org.xml.sax.Locator;
/**
* Java class for REAL-SparseArray element declaration.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <element name="REAL-SparseArray">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.dmg.org/PMML-4_2}Indices" minOccurs="0"/>
* <element ref="{http://www.dmg.org/PMML-4_2}REAL-Entries" minOccurs="0"/>
* </sequence>
* <attribute name="n" type="{http://www.dmg.org/PMML-4_2}INT-NUMBER" />
* <attribute name="defaultValue" type="{http://www.dmg.org/PMML-4_2}REAL-NUMBER" default="0" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"indices",
"entries"
})
@XmlRootElement(name = "REAL-SparseArray")
public class RealSparseArray
extends SparseArray
implements Locatable
{
@XmlList
@XmlElement(name = "Indices", type = Integer.class)
protected List indices;
@XmlList
@XmlElement(name = "REAL-Entries", type = Double.class)
protected List entries;
@XmlAttribute(name = "n")
protected Integer n;
@XmlAttribute(name = "defaultValue")
protected Double defaultValue;
@XmlLocation
@XmlTransient
protected Locator locator;
/**
* Gets the value of the indices 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 indices property.
*
*
* For example, to add a new item, do as follows:
*
* getIndices().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link Integer }
*
*
*/
public List getIndices() {
if (indices == null) {
indices = new ArrayList();
}
return this.indices;
}
/**
* Gets the value of the entries 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 entries property.
*
*
* For example, to add a new item, do as follows:
*
* getEntries().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link Double }
*
*
*/
public List getEntries() {
if (entries == null) {
entries = new ArrayList();
}
return this.entries;
}
/**
* Gets the value of the n property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getN() {
return n;
}
/**
* Sets the value of the n property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setN(Integer value) {
this.n = value;
}
/**
* Gets the value of the defaultValue property.
*
* @return
* possible object is
* {@link Double }
*
*/
public double getDefaultValue() {
if (defaultValue == null) {
return 0.0D;
} else {
return defaultValue;
}
}
/**
* Sets the value of the defaultValue property.
*
* @param value
* allowed object is
* {@link Double }
*
*/
public void setDefaultValue(Double value) {
this.defaultValue = value;
}
public RealSparseArray withIndices(Integer... values) {
if (values!= null) {
for (Integer value: values) {
getIndices().add(value);
}
}
return this;
}
public RealSparseArray withIndices(Collection values) {
if (values!= null) {
getIndices().addAll(values);
}
return this;
}
public RealSparseArray withEntries(Double... values) {
if (values!= null) {
for (Double value: values) {
getEntries().add(value);
}
}
return this;
}
public RealSparseArray withEntries(Collection values) {
if (values!= null) {
getEntries().addAll(values);
}
return this;
}
public RealSparseArray withN(Integer value) {
setN(value);
return this;
}
public RealSparseArray withDefaultValue(Double value) {
setDefaultValue(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.TERMINATE) {
return VisitorAction.TERMINATE;
}
return VisitorAction.CONTINUE;
}
}