001package org.hl7.fhir.r4.model.codesystems;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r4
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, 
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this 
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, 
034     this list of conditions and the following disclaimer in the documentation 
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
049  POSSIBILITY OF SUCH DAMAGE.
050  
051*/
052
053// Generated on Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0
054
055
056import org.hl7.fhir.exceptions.FHIRException;
057
058public enum V3CalendarCycle {
059
060        /**
061         * CalendarCycleOneLetter
062         */
063        _CALENDARCYCLEONELETTER, 
064        /**
065         * week (continuous)
066         */
067        CW, 
068        /**
069         * year
070         */
071        CY, 
072        /**
073         * day of the month
074         */
075        D, 
076        /**
077         * day of the week (begins with Monday)
078         */
079        DW, 
080        /**
081         * hour of the day
082         */
083        H, 
084        /**
085         * month of the year
086         */
087        M, 
088        /**
089         * minute of the hour
090         */
091        N, 
092        /**
093         * second of the minute
094         */
095        S, 
096        /**
097         * CalendarCycleTwoLetter
098         */
099        _CALENDARCYCLETWOLETTER, 
100        /**
101         * day (continuous)
102         */
103        CD, 
104        /**
105         * hour (continuous)
106         */
107        CH, 
108        /**
109         * month (continuous)
110         */
111        CM, 
112        /**
113         * minute (continuous)
114         */
115        CN, 
116        /**
117         * second (continuous)
118         */
119        CS, 
120        /**
121         * day of the year
122         */
123        DY, 
124        /**
125         * week of the year
126         */
127        WY, 
128        /**
129         * The week with the month's first Thursday in it (analagous to the ISO 8601 definition for week of the year).
130         */
131        WM, 
132        /**
133         * added to help the parsers
134         */
135        NULL;
136        public static V3CalendarCycle fromCode(String codeString) throws FHIRException {
137            if (codeString == null || "".equals(codeString))
138                return null;
139        if ("_CalendarCycleOneLetter".equals(codeString))
140          return _CALENDARCYCLEONELETTER;
141        if ("CW".equals(codeString))
142          return CW;
143        if ("CY".equals(codeString))
144          return CY;
145        if ("D".equals(codeString))
146          return D;
147        if ("DW".equals(codeString))
148          return DW;
149        if ("H".equals(codeString))
150          return H;
151        if ("M".equals(codeString))
152          return M;
153        if ("N".equals(codeString))
154          return N;
155        if ("S".equals(codeString))
156          return S;
157        if ("_CalendarCycleTwoLetter".equals(codeString))
158          return _CALENDARCYCLETWOLETTER;
159        if ("CD".equals(codeString))
160          return CD;
161        if ("CH".equals(codeString))
162          return CH;
163        if ("CM".equals(codeString))
164          return CM;
165        if ("CN".equals(codeString))
166          return CN;
167        if ("CS".equals(codeString))
168          return CS;
169        if ("DY".equals(codeString))
170          return DY;
171        if ("WY".equals(codeString))
172          return WY;
173        if ("WM".equals(codeString))
174          return WM;
175        throw new FHIRException("Unknown V3CalendarCycle code '"+codeString+"'");
176        }
177        public String toCode() {
178          switch (this) {
179            case _CALENDARCYCLEONELETTER: return "_CalendarCycleOneLetter";
180            case CW: return "CW";
181            case CY: return "CY";
182            case D: return "D";
183            case DW: return "DW";
184            case H: return "H";
185            case M: return "M";
186            case N: return "N";
187            case S: return "S";
188            case _CALENDARCYCLETWOLETTER: return "_CalendarCycleTwoLetter";
189            case CD: return "CD";
190            case CH: return "CH";
191            case CM: return "CM";
192            case CN: return "CN";
193            case CS: return "CS";
194            case DY: return "DY";
195            case WY: return "WY";
196            case WM: return "WM";
197            default: return "?";
198          }
199        }
200        public String getSystem() {
201          return "http://terminology.hl7.org/CodeSystem/v3-CalendarCycle";
202        }
203        public String getDefinition() {
204          switch (this) {
205            case _CALENDARCYCLEONELETTER: return "CalendarCycleOneLetter";
206            case CW: return "week (continuous)";
207            case CY: return "year";
208            case D: return "day of the month";
209            case DW: return "day of the week (begins with Monday)";
210            case H: return "hour of the day";
211            case M: return "month of the year";
212            case N: return "minute of the hour";
213            case S: return "second of the minute";
214            case _CALENDARCYCLETWOLETTER: return "CalendarCycleTwoLetter";
215            case CD: return "day (continuous)";
216            case CH: return "hour (continuous)";
217            case CM: return "month (continuous)";
218            case CN: return "minute (continuous)";
219            case CS: return "second (continuous)";
220            case DY: return "day of the year";
221            case WY: return "week of the year";
222            case WM: return "The week with the month's first Thursday in it (analagous to the ISO 8601 definition for week of the year).";
223            default: return "?";
224          }
225        }
226        public String getDisplay() {
227          switch (this) {
228            case _CALENDARCYCLEONELETTER: return "CalendarCycleOneLetter";
229            case CW: return "week (continuous)";
230            case CY: return "year";
231            case D: return "day of the month";
232            case DW: return "day of the week (begins with Monday)";
233            case H: return "hour of the day";
234            case M: return "month of the year";
235            case N: return "minute of the hour";
236            case S: return "second of the minute";
237            case _CALENDARCYCLETWOLETTER: return "CalendarCycleTwoLetter";
238            case CD: return "day (continuous)";
239            case CH: return "hour (continuous)";
240            case CM: return "month (continuous)";
241            case CN: return "minute (continuous)";
242            case CS: return "second (continuous)";
243            case DY: return "day of the year";
244            case WY: return "week of the year";
245            case WM: return "week of the month";
246            default: return "?";
247          }
248    }
249
250
251}
252