All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dmg.pmml.rule_set.SimpleRule Maven / Gradle / Ivy

There is a newer version: 1.6.11
Show newest version

package org.dmg.pmml.rule_set;

import java.util.ArrayList;
import java.util.Arrays;
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.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.dmg.pmml.CompoundPredicate;
import org.dmg.pmml.Extension;
import org.dmg.pmml.False;
import org.dmg.pmml.HasExtensions;
import org.dmg.pmml.HasPredicate;
import org.dmg.pmml.PMMLObject;
import org.dmg.pmml.Predicate;
import org.dmg.pmml.ScoreDistribution;
import org.dmg.pmml.SimplePredicate;
import org.dmg.pmml.SimpleSetPredicate;
import org.dmg.pmml.True;
import org.dmg.pmml.Visitor;
import org.dmg.pmml.VisitorAction;


/**
 * 

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_3}Extension" maxOccurs="unbounded" minOccurs="0"/>
 *         <group ref="{http://www.dmg.org/PMML-4_3}PREDICATE"/>
 *         <element ref="{http://www.dmg.org/PMML-4_3}ScoreDistribution" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="score" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="recordCount" type="{http://www.dmg.org/PMML-4_3}NUMBER" />
 *       <attribute name="nbCorrect" type="{http://www.dmg.org/PMML-4_3}NUMBER" />
 *       <attribute name="confidence" type="{http://www.dmg.org/PMML-4_3}NUMBER" default="1" />
 *       <attribute name="weight" type="{http://www.dmg.org/PMML-4_3}NUMBER" default="1" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "extensions", "predicate", "scoreDistributions" }) @XmlRootElement(name = "SimpleRule", namespace = "http://www.dmg.org/PMML-4_3") public class SimpleRule extends Rule implements HasExtensions, HasPredicate { @XmlAttribute(name = "id") private String id; @XmlAttribute(name = "score", required = true) private String score; @XmlAttribute(name = "recordCount") private Double recordCount; @XmlAttribute(name = "nbCorrect") private Double nbCorrect; @XmlAttribute(name = "confidence") private Double confidence; @XmlAttribute(name = "weight") private Double weight; @XmlElement(name = "Extension", namespace = "http://www.dmg.org/PMML-4_3") private List extensions; @XmlElements({ @XmlElement(name = "SimplePredicate", namespace = "http://www.dmg.org/PMML-4_3", type = SimplePredicate.class), @XmlElement(name = "CompoundPredicate", namespace = "http://www.dmg.org/PMML-4_3", type = CompoundPredicate.class), @XmlElement(name = "SimpleSetPredicate", namespace = "http://www.dmg.org/PMML-4_3", type = SimpleSetPredicate.class), @XmlElement(name = "True", namespace = "http://www.dmg.org/PMML-4_3", type = True.class), @XmlElement(name = "False", namespace = "http://www.dmg.org/PMML-4_3", type = False.class) }) private Predicate predicate; @XmlElement(name = "ScoreDistribution", namespace = "http://www.dmg.org/PMML-4_3") private List scoreDistributions; private final static Double DEFAULT_CONFIDENCE = 1.0D; private final static Double DEFAULT_WEIGHT = 1.0D; public SimpleRule() { super(); } public SimpleRule(final String score) { super(); this.score = score; } /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getId() { return id; } /** * Sets the value of the id property. * * @param id * allowed object is * {@link String } * */ public SimpleRule setId(String id) { this.id = id; return this; } /** * Gets the value of the score property. * * @return * possible object is * {@link String } * */ public String getScore() { return score; } /** * Sets the value of the score property. * * @param score * allowed object is * {@link String } * */ public SimpleRule setScore(String score) { this.score = score; return this; } /** * Gets the value of the recordCount property. * * @return * possible object is * {@link Double } * */ public Double getRecordCount() { return recordCount; } /** * Sets the value of the recordCount property. * * @param recordCount * allowed object is * {@link Double } * */ public SimpleRule setRecordCount(Double recordCount) { this.recordCount = recordCount; return this; } /** * Gets the value of the nbCorrect property. * * @return * possible object is * {@link Double } * */ public Double getNbCorrect() { return nbCorrect; } /** * Sets the value of the nbCorrect property. * * @param nbCorrect * allowed object is * {@link Double } * */ public SimpleRule setNbCorrect(Double nbCorrect) { this.nbCorrect = nbCorrect; return this; } /** * Gets the value of the confidence property. * * @return * possible object is * {@link Double } * */ public Double getConfidence() { if (confidence == null) { return DEFAULT_CONFIDENCE; } else { return confidence; } } /** * Sets the value of the confidence property. * * @param confidence * allowed object is * {@link Double } * */ public SimpleRule setConfidence(Double confidence) { this.confidence = confidence; return this; } /** * Gets the value of the weight property. * * @return * possible object is * {@link Double } * */ public Double getWeight() { if (weight == null) { return DEFAULT_WEIGHT; } else { return weight; } } /** * Sets the value of the weight property. * * @param weight * allowed object is * {@link Double } * */ public SimpleRule setWeight(Double weight) { this.weight = weight; return this; } /** * 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 predicate property. * * @return * possible object is * {@link SimplePredicate } * {@link CompoundPredicate } * {@link SimpleSetPredicate } * {@link True } * {@link False } * */ public Predicate getPredicate() { return predicate; } /** * Sets the value of the predicate property. * * @param predicate * allowed object is * {@link SimplePredicate } * {@link CompoundPredicate } * {@link SimpleSetPredicate } * {@link True } * {@link False } * */ public SimpleRule setPredicate(Predicate predicate) { this.predicate = predicate; return this; } /** * Gets the value of the scoreDistributions 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 scoreDistributions property. * *

* For example, to add a new item, do as follows: *

     *    getScoreDistributions().add(newItem);
     * 
* * *

* Objects of the following type(s) are allowed in the list * {@link ScoreDistribution } * * */ public List getScoreDistributions() { if (scoreDistributions == null) { scoreDistributions = new ArrayList(); } return this.scoreDistributions; } public boolean hasExtensions() { return ((this.extensions!= null)&&(this.extensions.size()> 0)); } public SimpleRule addExtensions(Extension... extensions) { getExtensions().addAll(Arrays.asList(extensions)); return this; } public boolean hasScoreDistributions() { return ((this.scoreDistributions!= null)&&(this.scoreDistributions.size()> 0)); } public SimpleRule addScoreDistributions(ScoreDistribution... scoreDistributions) { getScoreDistributions().addAll(Arrays.asList(scoreDistributions)); 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) { status = PMMLObject.traverse(visitor, getPredicate()); } if ((status == VisitorAction.CONTINUE)&&hasScoreDistributions()) { status = PMMLObject.traverse(visitor, getScoreDistributions()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy