001package org.hl7.fhir.r5.openehr;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.openehr.Enumerations.*;
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.r5.model.*;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047
048/**
049 * This is an abstract class of which all timing specifications are specialisations. Specifies points in time, possibly linked to the calendar, or a real world repeating event, such as breakfast.
050 */
051@DatatypeDef(name="DV_TIME_SPECIFICATION")
052public abstract class DV_TIME_SPECIFICATION extends DATA_VALUE implements ICompositeType {
053
054    /**
055     * The specification, in the HL7v3 syntax for PIVL or EIVL types.
056     */
057    @Child(name = "DV_PARSABLE", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=false)
058    @Description(shortDefinition="The specification, in the HL7v3 syntax for PIVL or EIVL types", formalDefinition="The specification, in the HL7v3 syntax for PIVL or EIVL types." )
059    protected StringType DV_PARSABLE;
060
061    private static final long serialVersionUID = 6714082L;
062
063  /**
064   * Constructor
065   */
066    public DV_TIME_SPECIFICATION() {
067      super();
068    }
069
070  /**
071   * Constructor
072   */
073    public DV_TIME_SPECIFICATION(String DV_PARSABLE) {
074      super();
075      this.setDV_PARSABLE(DV_PARSABLE);
076    }
077
078    /**
079     * @return {@link #DV_PARSABLE} (The specification, in the HL7v3 syntax for PIVL or EIVL types.). This is the underlying object with id, value and extensions. The accessor "getDV_PARSABLE" gives direct access to the value
080     */
081    public StringType getDV_PARSABLEElement() { 
082      if (this.DV_PARSABLE == null)
083        if (Configuration.errorOnAutoCreate())
084          throw new Error("Attempt to auto-create DV_TIME_SPECIFICATION.DV_PARSABLE");
085        else if (Configuration.doAutoCreate())
086          this.DV_PARSABLE = new StringType(); // bb
087      return this.DV_PARSABLE;
088    }
089
090    public boolean hasDV_PARSABLEElement() { 
091      return this.DV_PARSABLE != null && !this.DV_PARSABLE.isEmpty();
092    }
093
094    public boolean hasDV_PARSABLE() { 
095      return this.DV_PARSABLE != null && !this.DV_PARSABLE.isEmpty();
096    }
097
098    /**
099     * @param value {@link #DV_PARSABLE} (The specification, in the HL7v3 syntax for PIVL or EIVL types.). This is the underlying object with id, value and extensions. The accessor "getDV_PARSABLE" gives direct access to the value
100     */
101    public DV_TIME_SPECIFICATION setDV_PARSABLEElement(StringType value) { 
102      this.DV_PARSABLE = value;
103      return this;
104    }
105
106    /**
107     * @return The specification, in the HL7v3 syntax for PIVL or EIVL types.
108     */
109    public String getDV_PARSABLE() { 
110      return this.DV_PARSABLE == null ? null : this.DV_PARSABLE.getValue();
111    }
112
113    /**
114     * @param value The specification, in the HL7v3 syntax for PIVL or EIVL types.
115     */
116    public DV_TIME_SPECIFICATION setDV_PARSABLE(String value) { 
117        if (this.DV_PARSABLE == null)
118          this.DV_PARSABLE = new StringType();
119        this.DV_PARSABLE.setValue(value);
120      return this;
121    }
122
123      protected void listChildren(List<Property> children) {
124        super.listChildren(children);
125        children.add(new Property("DV_PARSABLE", "string", "The specification, in the HL7v3 syntax for PIVL or EIVL types.", 0, 1, DV_PARSABLE));
126      }
127
128      @Override
129      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
130        switch (_hash) {
131        case 406932825: /*DV_PARSABLE*/  return new Property("DV_PARSABLE", "string", "The specification, in the HL7v3 syntax for PIVL or EIVL types.", 0, 1, DV_PARSABLE);
132        default: return super.getNamedProperty(_hash, _name, _checkValid);
133        }
134
135      }
136
137      @Override
138      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
139        switch (hash) {
140        case 406932825: /*DV_PARSABLE*/ return this.DV_PARSABLE == null ? new Base[0] : new Base[] {this.DV_PARSABLE}; // StringType
141        default: return super.getProperty(hash, name, checkValid);
142        }
143
144      }
145
146      @Override
147      public Base setProperty(int hash, String name, Base value) throws FHIRException {
148        switch (hash) {
149        case 406932825: // DV_PARSABLE
150          this.DV_PARSABLE = TypeConvertor.castToString(value); // StringType
151          return value;
152        default: return super.setProperty(hash, name, value);
153        }
154
155      }
156
157      @Override
158      public Base setProperty(String name, Base value) throws FHIRException {
159        if (name.equals("DV_PARSABLE")) {
160          this.DV_PARSABLE = TypeConvertor.castToString(value); // StringType
161        } else
162          return super.setProperty(name, value);
163        return value;
164      }
165
166      @Override
167      public Base makeProperty(int hash, String name) throws FHIRException {
168        switch (hash) {
169        case 406932825:  return getDV_PARSABLEElement();
170        default: return super.makeProperty(hash, name);
171        }
172
173      }
174
175      @Override
176      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
177        switch (hash) {
178        case 406932825: /*DV_PARSABLE*/ return new String[] {"string"};
179        default: return super.getTypesForProperty(hash, name);
180        }
181
182      }
183
184      @Override
185      public Base addChild(String name) throws FHIRException {
186        if (name.equals("DV_PARSABLE")) {
187          throw new FHIRException("Cannot call addChild on a singleton property DV_TIME_SPECIFICATION.DV_PARSABLE");
188        }
189        else
190          return super.addChild(name);
191      }
192
193  public String fhirType() {
194    return "DV_TIME_SPECIFICATION";
195
196  }
197
198      public abstract DV_TIME_SPECIFICATION copy();
199
200      public void copyValues(DV_TIME_SPECIFICATION dst) {
201        super.copyValues(dst);
202        dst.DV_PARSABLE = DV_PARSABLE == null ? null : DV_PARSABLE.copy();
203      }
204
205      @Override
206      public boolean equalsDeep(Base other_) {
207        if (!super.equalsDeep(other_))
208          return false;
209        if (!(other_ instanceof DV_TIME_SPECIFICATION))
210          return false;
211        DV_TIME_SPECIFICATION o = (DV_TIME_SPECIFICATION) other_;
212        return compareDeep(DV_PARSABLE, o.DV_PARSABLE, true);
213      }
214
215      @Override
216      public boolean equalsShallow(Base other_) {
217        if (!super.equalsShallow(other_))
218          return false;
219        if (!(other_ instanceof DV_TIME_SPECIFICATION))
220          return false;
221        DV_TIME_SPECIFICATION o = (DV_TIME_SPECIFICATION) other_;
222        return compareValues(DV_PARSABLE, o.DV_PARSABLE, true);
223      }
224
225      public boolean isEmpty() {
226        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(DV_PARSABLE);
227      }
228
229
230}
231