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

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "IVL_INT", propOrder = {
	"low",
	"width",
	"high",
	"center",
})
@XmlRootElement(name = "IVL_INT")
public class IVLINT extends net.ihe.gazelle.hl7v3.datatypes.SXCMINT 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.IVXBINT 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.INT width;
	/**
	 * 
	                           The high limit of the interval.
	                        .
	 */
	@XmlElement(name = "high", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.IVXBINT 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.INT center;
	
	/**
	 * An attribute containing marshalled element node
	 */
	@XmlTransient
	private org.w3c.dom.Node _xmlNodePresentation;
	
	
	/**
	 * Return low.
	 * @return low : 
	                        
	                           The low limit of the interval.
	                        
	 */
	public net.ihe.gazelle.hl7v3.datatypes.IVXBINT getLow() {
	    return low;
	}
	
	/**
	 * Set a value to attribute low.
	 * @param low : 
	                        
	                           The low limit of the interval.
	                        .
	 */
	public void setLow(net.ihe.gazelle.hl7v3.datatypes.IVXBINT low) {
	    this.low = low;
	}
	
	
	
	
	/**
	 * Return width.
	 * @return width : 
	                           
	                        
	                           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.
	                        
	 */
	public net.ihe.gazelle.hl7v3.datatypes.INT getWidth() {
	    return width;
	}
	
	/**
	 * Set a value to attribute width.
	 * @param width : 
	                           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.
	 */
	public void setWidth(net.ihe.gazelle.hl7v3.datatypes.INT width) {
	    this.width = width;
	}
	
	
	
	
	/**
	 * Return high.
	 * @return high : 
	                           The high limit of the interval.
	 */
	public net.ihe.gazelle.hl7v3.datatypes.IVXBINT getHigh() {
	    return high;
	}
	
	/**
	 * Set a value to attribute high.
	 * @param high : 
	                           The high limit of the interval.
	 */
	public void setHigh(net.ihe.gazelle.hl7v3.datatypes.IVXBINT high) {
	    this.high = high;
	}
	

	
	/**
	 * Return center.
	 * @return center : 
	                           
	                        
	                           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.
	                        
	 */
	public net.ihe.gazelle.hl7v3.datatypes.INT getCenter() {
	    return center;
	}
	
	/**
	 * Set a value to attribute center.
	 * @param center : 
	                           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.
	                        
	 */
	public void setCenter(net.ihe.gazelle.hl7v3.datatypes.INT center) {
	    this.center = center;
	}

	
	/**
	 * Set a value to attribute width2.
     */
	
	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_INT").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(IVLINT iVLINT, String _location, ConstraintValidatorModule cvm, List<net.ihe.gazelle.validation.Notification> diagnostic){
   		if (iVLINT != null){
   			net.ihe.gazelle.hl7v3.datatypes.SXCMINT.validateByModule(iVLINT, _location, cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.IVXBINT.validateByModule(iVLINT.getLow(), _location + "/low", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.INT.validateByModule(iVLINT.getWidth(), _location + "/width", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.IVXBINT.validateByModule(iVLINT.getHigh(), _location + "/high", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.INT.validateByModule(iVLINT.getCenter(), _location + "/center", cvm, diagnostic);
    	}
    }

}