001
002package ca.uhn.fhir.model.dstu.valueset;
003
004/*
005 * #%L
006 * HAPI FHIR - Core Library
007 * %%
008 * Copyright (C) 2014 - 2016 University Health Network
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the "License");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an "AS IS" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024import java.util.HashMap;
025import java.util.Map;
026
027import ca.uhn.fhir.model.api.IValueSetEnumBinder;
028import ca.uhn.fhir.util.CoverageIgnore;
029
030@CoverageIgnore
031public enum QuantityCompararatorEnum {
032
033        /**
034         * Code Value: <b>&lt;</b>
035         *
036         * The actual value is less than the given value.
037         */
038        LESSTHAN("<", "http://hl7.org/fhir/quantity-comparator"),
039        
040        /**
041         * Code Value: <b>&lt;=</b>
042         *
043         * The actual value is less than or equal to the given value.
044         */
045        LESSTHAN_OR_EQUALS("<=", "http://hl7.org/fhir/quantity-comparator"),
046        
047        /**
048         * Code Value: <b>&gt;=</b>
049         *
050         * The actual value is greater than or equal to the given value.
051         */
052        GREATERTHAN_OR_EQUALS(">=", "http://hl7.org/fhir/quantity-comparator"),
053        
054        /**
055         * Code Value: <b>&gt;</b>
056         *
057         * The actual value is greater than the given value.
058         */
059        GREATERTHAN(">", "http://hl7.org/fhir/quantity-comparator"),
060        
061        ;
062        
063        /**
064         * Identifier for this Value Set:
065         * http://hl7.org/fhir/vs/quantity-comparator
066         */
067        public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/quantity-comparator";
068
069        /**
070         * Name for this Value Set:
071         * QuantityCompararator
072         */
073        public static final String VALUESET_NAME = "QuantityCompararator";
074
075        private static Map<String, QuantityCompararatorEnum> CODE_TO_ENUM = new HashMap<String, QuantityCompararatorEnum>();
076        private static Map<String, Map<String, QuantityCompararatorEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, QuantityCompararatorEnum>>();
077        
078        private final String myCode;
079        private final String mySystem;
080        
081        static {
082                for (QuantityCompararatorEnum next : QuantityCompararatorEnum.values()) {
083                        CODE_TO_ENUM.put(next.getCode(), next);
084                        
085                        if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
086                                SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, QuantityCompararatorEnum>());
087                        }
088                        SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);                 
089                }
090        }
091        
092        /**
093         * Returns the code associated with this enumerated value
094         */
095        public String getCode() {
096                return myCode;
097        }
098        
099        /**
100         * Returns the code system associated with this enumerated value
101         */
102        public String getSystem() {
103                return mySystem;
104        }
105        
106        /**
107         * Returns the enumerated value associated with this code
108         */
109        public QuantityCompararatorEnum forCode(String theCode) {
110                QuantityCompararatorEnum retVal = CODE_TO_ENUM.get(theCode);
111                return retVal;
112        }
113
114        /**
115         * Converts codes to their respective enumerated values
116         */
117        public static final IValueSetEnumBinder<QuantityCompararatorEnum> VALUESET_BINDER = new IValueSetEnumBinder<QuantityCompararatorEnum>() {
118                @Override
119                public String toCodeString(QuantityCompararatorEnum theEnum) {
120                        return theEnum.getCode();
121                }
122
123                @Override
124                public String toSystemString(QuantityCompararatorEnum theEnum) {
125                        return theEnum.getSystem();
126                }
127                
128                @Override
129                public QuantityCompararatorEnum fromCodeString(String theCodeString) {
130                        return CODE_TO_ENUM.get(theCodeString);
131                }
132                
133                @Override
134                public QuantityCompararatorEnum fromCodeString(String theCodeString, String theSystemString) {
135                        Map<String, QuantityCompararatorEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
136                        if (map == null) {
137                                return null;
138                        }
139                        return map.get(theCodeString);
140                }
141                
142        };
143        
144        /** 
145         * Constructor
146         */
147        QuantityCompararatorEnum(String theCode, String theSystem) {
148                myCode = theCode;
149                mySystem = theSystem;
150        }
151
152        
153}