/**
 * IVLPQ.java
 * <p>
 * File generated from the datatypes::IVLPQ 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.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 IVLPQ.
 *
 */

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "IVL_PQ", propOrder = {
	"low",
	"width",
	"high",
	"center",
})
@XmlRootElement(name = "IVL_PQ")
public class IVLPQ extends net.ihe.gazelle.hl7v3.datatypes.SXCMPQ implements java.io.Serializable {
	
	/**
	 * 
	 */
	@Serial
    private static final long serialVersionUID = 1L;

	
	/**
	 * 
	                           The low limit of the interval.
	                        .
	 */
	@XmlElement(name = "low", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.IVXBPQ low;
	/**
	 * 
	                           The difference between high and low boundary. The
	                           purpose of distinguishing a width property is to
	                           handle all cases of incomplete information
	                           symmetrically. In any interval representation only
	                           two of the three properties high, low, and width need
	                           to be stated and the third can be derived.
	                        .
	 */
	@XmlElement(name = "width", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.PQ width;
	/**
	 * 
	                           The high limit of the interval.
	                        .
	 */
	@XmlElement(name = "high", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.IVXBPQ high;

	/**
	 * 
	                           The arithmetic mean of the interval (low plus high
	                           divided by 2). The purpose of distinguishing the center
	                           as a semantic property is for conversions of intervals
	                           from and to point values.
	                        .
	 */
	@XmlElement(name = "center", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.PQ center;
	
	/**
	 * An attribute containing marshalled element node
	 */
	@XmlTransient
	private org.w3c.dom.Node _xmlNodePresentation;
	
	
	public net.ihe.gazelle.hl7v3.datatypes.IVXBPQ getLow() {
		return low;
	}

	public void setLow(net.ihe.gazelle.hl7v3.datatypes.IVXBPQ low) {
		this.low = low;
	}

	public net.ihe.gazelle.hl7v3.datatypes.PQ getWidth() {
		return width;
	}

	public void setWidth(net.ihe.gazelle.hl7v3.datatypes.PQ width) {
		this.width = width;
	}

	public net.ihe.gazelle.hl7v3.datatypes.IVXBPQ getHigh() {
		return high;
	}

	public void setHigh(net.ihe.gazelle.hl7v3.datatypes.IVXBPQ high) {
		this.high = high;
	}

	public net.ihe.gazelle.hl7v3.datatypes.PQ getCenter() {
		return center;
	}

	public void setCenter(net.ihe.gazelle.hl7v3.datatypes.PQ center) {
		this.center = center;
	}

	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", "IVL_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(IVLPQ iVLPQ, String _location, ConstraintValidatorModule cvm, List<net.ihe.gazelle.validation.Notification> diagnostic){
   		if (iVLPQ != null){
   			net.ihe.gazelle.hl7v3.datatypes.SXCMPQ.validateByModule(iVLPQ, _location, cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.IVXBPQ.validateByModule(iVLPQ.getLow(), _location + "/low", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.PQ.validateByModule(iVLPQ.getWidth(), _location + "/width", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.IVXBPQ.validateByModule(iVLPQ.getHigh(), _location + "/high", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.PQ.validateByModule(iVLPQ.getCenter(), _location + "/center", cvm, diagnostic);
    	}
    }

}