/**
 * PPDPQ.java
 * <p>
 * File generated from the datatypes::PPDPQ uml Class
 * Generated by IHE - europe, gazelle team
 */
package net.ihe.gazelle.hl7v3.datatypes;

// End of user code
import java.io.Serial;
import java.util.List;

import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlTransient;
import jakarta.xml.bind.annotation.XmlType;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import net.ihe.gazelle.gen.common.ConstraintValidatorModule;

import org.w3c.dom.Document;
import org.w3c.dom.Node;


/**
 * Description of the class PPDPQ.
 *
 */

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PPD_PQ", propOrder = {
	"standardDeviation",
	"distributionType"
})
@XmlRootElement(name = "PPD_PQ")
public class PPDPQ extends net.ihe.gazelle.hl7v3.datatypes.PQ implements java.io.Serializable {
	
	/**
	 * 
	 */
	@Serial
    private static final long serialVersionUID = 1L;

	
	/**
	 * 
	                        The primary measure of variance/uncertainty of the
	                        value (the square root of the sum of the squares of
	                        the differences between all data points and the mean).
	                        The standard deviation is used to normalize the data
	                        for computing the distribution function. Applications
	                        that cannot deal with probability distributions can
	                        still get an idea about the confidence level by looking
	                        at the standard deviation.
	                     .
	 */
	@XmlElement(name = "standardDeviation", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.PQ standardDeviation;
	/**
	 * 
	                     A code specifying the type of probability distribution.
	                     Possible values are as shown in the attached table.
	                     The NULL value (unknown) for the type code indicates
	                     that the probability distribution type is unknown. In
	                     that case, the standard deviation has the meaning of an
	                     informal guess.
	                  .
	 */
	@XmlAttribute(name = "distributionType")
	public net.ihe.gazelle.hl7v3.voc.ProbabilityDistributionType distributionType;
	
	/**
	 * An attribute containing marshalled element node
	 */
	@XmlTransient
	private org.w3c.dom.Node _xmlNodePresentation;
	
	
	/**
	 * Return standardDeviation.
	 * @return standardDeviation : 
	                        The primary measure of variance/uncertainty of the
	                        value (the square root of the sum of the squares of
	                        the differences between all data points and the mean).
	                        The standard deviation is used to normalize the data
	                        for computing the distribution function. Applications
	                        that cannot deal with probability distributions can
	                        still get an idea about the confidence level by looking
	                        at the standard deviation.
	 */
	public net.ihe.gazelle.hl7v3.datatypes.PQ getStandardDeviation() {
	    return standardDeviation;
	}
	
	/**
	 * Set a value to attribute standardDeviation.
	 * @param standardDeviation : 
	                        The primary measure of variance/uncertainty of the
	                        value (the square root of the sum of the squares of
	                        the differences between all data points and the mean).
	                        The standard deviation is used to normalize the data
	                        for computing the distribution function. Applications
	                        that cannot deal with probability distributions can
	                        still get an idea about the confidence level by looking
	                        at the standard deviation.
	 */
	public void setStandardDeviation(net.ihe.gazelle.hl7v3.datatypes.PQ standardDeviation) {
	    this.standardDeviation = standardDeviation;
	}
	
	
	
	
	/**
	 * Return distributionType.
	 * @return distributionType : 
	                     A code specifying the type of probability distribution.
	                     Possible values are as shown in the attached table.
	                     The NULL value (unknown) for the type code indicates
	                     that the probability distribution type is unknown. In
	                     that case, the standard deviation has the meaning of an
	                     informal guess.
	 */
	public net.ihe.gazelle.hl7v3.voc.ProbabilityDistributionType getDistributionType() {
	    return distributionType;
	}
	
	/**
	 * Set a value to attribute distributionType.
	 * @param distributionType : 
	                     A code specifying the type of probability distribution.
	                     Possible values are as shown in the attached table.
	                     The NULL value (unknown) for the type code indicates
	                     that the probability distribution type is unknown. In
	                     that case, the standard deviation has the meaning of an
	                     informal guess.
	 */
	public void setDistributionType(net.ihe.gazelle.hl7v3.voc.ProbabilityDistributionType distributionType) {
	    this.distributionType = distributionType;
	}
	
	
	
	
	
	public Node get_xmlNodePresentation() {
		if (_xmlNodePresentation == null){
				JAXBContext jc;
				DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
				dbf.setNamespaceAware(true);
				DocumentBuilder db = null;
				Document doc = null;
				try {
					db = dbf.newDocumentBuilder();
					doc = db.newDocument();
				} catch (ParserConfigurationException ignored) {}
				try {
					jc = JAXBContext.newInstance("net.ihe.gazelle.hl7v3.datatypes");
					Marshaller m = jc.createMarshaller();
					m.marshal(this, doc);
					_xmlNodePresentation = doc.getElementsByTagNameNS("urn:hl7-org:v3", "PPD_PQ").item(0);
				} catch (JAXBException e) {
					try{
						db = dbf.newDocumentBuilder();
						_xmlNodePresentation = db.newDocument();
					}
					catch(Exception ignored){}
				}
			}
			return _xmlNodePresentation;
	}
	
	public void set_xmlNodePresentation(Node _xmlNodePresentation) {
		this._xmlNodePresentation = _xmlNodePresentation;
	}
	
	
	

	
	/**
     * validate by a module of validation
     * 
     */
   public static void validateByModule(PPDPQ pPDPQ, String _location, ConstraintValidatorModule cvm, List<net.ihe.gazelle.validation.Notification> diagnostic){
   		if (pPDPQ != null){
   			net.ihe.gazelle.hl7v3.datatypes.PQ.validateByModule(pPDPQ, _location, cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.PQ.validateByModule(pPDPQ.getStandardDeviation(), _location + "/standardDeviation", cvm, diagnostic);
    	}
    }

}