001package org.hl7.fhir.r4.model.codesystems;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0
033
034
035import org.hl7.fhir.r4.model.EnumFactory;
036
037public class EventTimingEnumFactory implements EnumFactory<EventTiming> {
038
039  public EventTiming fromCode(String codeString) throws IllegalArgumentException {
040    if (codeString == null || "".equals(codeString))
041      return null;
042    if ("MORN".equals(codeString))
043      return EventTiming.MORN;
044    if ("MORN.early".equals(codeString))
045      return EventTiming.MORN_EARLY;
046    if ("MORN.late".equals(codeString))
047      return EventTiming.MORN_LATE;
048    if ("NOON".equals(codeString))
049      return EventTiming.NOON;
050    if ("AFT".equals(codeString))
051      return EventTiming.AFT;
052    if ("AFT.early".equals(codeString))
053      return EventTiming.AFT_EARLY;
054    if ("AFT.late".equals(codeString))
055      return EventTiming.AFT_LATE;
056    if ("EVE".equals(codeString))
057      return EventTiming.EVE;
058    if ("EVE.early".equals(codeString))
059      return EventTiming.EVE_EARLY;
060    if ("EVE.late".equals(codeString))
061      return EventTiming.EVE_LATE;
062    if ("NIGHT".equals(codeString))
063      return EventTiming.NIGHT;
064    if ("PHS".equals(codeString))
065      return EventTiming.PHS;
066    throw new IllegalArgumentException("Unknown EventTiming code '"+codeString+"'");
067  }
068
069  public String toCode(EventTiming code) {
070    if (code == EventTiming.MORN)
071      return "MORN";
072    if (code == EventTiming.MORN_EARLY)
073      return "MORN.early";
074    if (code == EventTiming.MORN_LATE)
075      return "MORN.late";
076    if (code == EventTiming.NOON)
077      return "NOON";
078    if (code == EventTiming.AFT)
079      return "AFT";
080    if (code == EventTiming.AFT_EARLY)
081      return "AFT.early";
082    if (code == EventTiming.AFT_LATE)
083      return "AFT.late";
084    if (code == EventTiming.EVE)
085      return "EVE";
086    if (code == EventTiming.EVE_EARLY)
087      return "EVE.early";
088    if (code == EventTiming.EVE_LATE)
089      return "EVE.late";
090    if (code == EventTiming.NIGHT)
091      return "NIGHT";
092    if (code == EventTiming.PHS)
093      return "PHS";
094    return "?";
095  }
096
097    public String toSystem(EventTiming code) {
098      return code.getSystem();
099      }
100
101}
102