org.dmg.pmml.ComparisonMeasure 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.XmlElements;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
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 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"/>
* <choice>
* <element ref="{http://www.dmg.org/PMML-4_2}euclidean"/>
* <element ref="{http://www.dmg.org/PMML-4_2}squaredEuclidean"/>
* <element ref="{http://www.dmg.org/PMML-4_2}chebychev"/>
* <element ref="{http://www.dmg.org/PMML-4_2}cityBlock"/>
* <element ref="{http://www.dmg.org/PMML-4_2}minkowski"/>
* <element ref="{http://www.dmg.org/PMML-4_2}simpleMatching"/>
* <element ref="{http://www.dmg.org/PMML-4_2}jaccard"/>
* <element ref="{http://www.dmg.org/PMML-4_2}tanimoto"/>
* <element ref="{http://www.dmg.org/PMML-4_2}binarySimilarity"/>
* </choice>
* </sequence>
* <attribute name="kind" use="required">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="distance"/>
* <enumeration value="similarity"/>
* </restriction>
* </simpleType>
* </attribute>
* <attribute name="compareFunction" type="{http://www.dmg.org/PMML-4_2}COMPARE-FUNCTION" default="absDiff" />
* <attribute name="minimum" type="{http://www.dmg.org/PMML-4_2}NUMBER" />
* <attribute name="maximum" type="{http://www.dmg.org/PMML-4_2}NUMBER" />
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"extensions",
"measure"
})
@XmlRootElement(name = "ComparisonMeasure")
public class ComparisonMeasure
extends PMMLObject
implements Locatable, HasExtensions
{
@XmlElement(name = "Extension")
protected List extensions;
@XmlElements({
@XmlElement(name = "euclidean", type = Euclidean.class),
@XmlElement(name = "squaredEuclidean", type = SquaredEuclidean.class),
@XmlElement(name = "chebychev", type = Chebychev.class),
@XmlElement(name = "cityBlock", type = CityBlock.class),
@XmlElement(name = "minkowski", type = Minkowski.class),
@XmlElement(name = "simpleMatching", type = SimpleMatching.class),
@XmlElement(name = "jaccard", type = Jaccard.class),
@XmlElement(name = "tanimoto", type = Tanimoto.class),
@XmlElement(name = "binarySimilarity", type = BinarySimilarity.class)
})
protected Measure measure;
@XmlAttribute(name = "kind", required = true)
protected ComparisonMeasure.Kind kind;
@XmlAttribute(name = "compareFunction")
protected CompareFunctionType compareFunction;
@XmlAttribute(name = "minimum")
protected Double minimum;
@XmlAttribute(name = "maximum")
protected Double maximum;
@XmlLocation
@XmlTransient
protected Locator locator;
public ComparisonMeasure() {
super();
}
public ComparisonMeasure(final ComparisonMeasure.Kind kind) {
super();
this.kind = kind;
}
/**
* 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 measure property.
*
* @return
* possible object is
* {@link Euclidean }
* {@link SquaredEuclidean }
* {@link Chebychev }
* {@link CityBlock }
* {@link Minkowski }
* {@link SimpleMatching }
* {@link Jaccard }
* {@link Tanimoto }
* {@link BinarySimilarity }
*
*/
public Measure getMeasure() {
return measure;
}
/**
* Sets the value of the measure property.
*
* @param value
* allowed object is
* {@link Euclidean }
* {@link SquaredEuclidean }
* {@link Chebychev }
* {@link CityBlock }
* {@link Minkowski }
* {@link SimpleMatching }
* {@link Jaccard }
* {@link Tanimoto }
* {@link BinarySimilarity }
*
*/
public void setMeasure(Measure value) {
this.measure = value;
}
/**
* Gets the value of the kind property.
*
* @return
* possible object is
* {@link ComparisonMeasure.Kind }
*
*/
public ComparisonMeasure.Kind getKind() {
return kind;
}
/**
* Sets the value of the kind property.
*
* @param value
* allowed object is
* {@link ComparisonMeasure.Kind }
*
*/
public void setKind(ComparisonMeasure.Kind value) {
this.kind = value;
}
/**
* Gets the value of the compareFunction property.
*
* @return
* possible object is
* {@link CompareFunctionType }
*
*/
public CompareFunctionType getCompareFunction() {
if (compareFunction == null) {
return CompareFunctionType.ABS_DIFF;
} else {
return compareFunction;
}
}
/**
* Sets the value of the compareFunction property.
*
* @param value
* allowed object is
* {@link CompareFunctionType }
*
*/
public void setCompareFunction(CompareFunctionType value) {
this.compareFunction = value;
}
/**
* Gets the value of the minimum property.
*
* @return
* possible object is
* {@link Double }
*
*/
public Double getMinimum() {
return minimum;
}
/**
* Sets the value of the minimum property.
*
* @param value
* allowed object is
* {@link Double }
*
*/
public void setMinimum(Double value) {
this.minimum = value;
}
/**
* Gets the value of the maximum property.
*
* @return
* possible object is
* {@link Double }
*
*/
public Double getMaximum() {
return maximum;
}
/**
* Sets the value of the maximum property.
*
* @param value
* allowed object is
* {@link Double }
*
*/
public void setMaximum(Double value) {
this.maximum = value;
}
public ComparisonMeasure withExtensions(Extension... values) {
if (values!= null) {
for (Extension value: values) {
getExtensions().add(value);
}
}
return this;
}
public ComparisonMeasure withExtensions(Collection values) {
if (values!= null) {
getExtensions().addAll(values);
}
return this;
}
public ComparisonMeasure withMeasure(Measure value) {
setMeasure(value);
return this;
}
public ComparisonMeasure withKind(ComparisonMeasure.Kind value) {
setKind(value);
return this;
}
public ComparisonMeasure withCompareFunction(CompareFunctionType value) {
setCompareFunction(value);
return this;
}
public ComparisonMeasure withMinimum(Double value) {
setMinimum(value);
return this;
}
public ComparisonMeasure withMaximum(Double value) {
setMaximum(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);
for (int i = 0; (((status == VisitorAction.CONTINUE)&&(this.extensions!= null))&&(iJava class for null.
*
* The following schema fragment specifies the expected content contained within this class.
*
*
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="distance"/>
* <enumeration value="similarity"/>
* </restriction>
* </simpleType>
*
*
*/
@XmlType(name = "")
@XmlEnum
public enum Kind {
@XmlEnumValue("distance")
DISTANCE("distance"),
@XmlEnumValue("similarity")
SIMILARITY("similarity");
private final String value;
Kind(String v) {
value = v;
}
public String value() {
return value;
}
public static ComparisonMeasure.Kind fromValue(String v) {
for (ComparisonMeasure.Kind c: ComparisonMeasure.Kind.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
}