001
002package ca.uhn.fhir.model.dstu.valueset;
003
004/*
005 * #%L
006 * HAPI FHIR - Core Library
007 * %%
008 * Copyright (C) 2014 - 2017 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.rest.param.ParamPrefixEnum;
029import ca.uhn.fhir.util.CoverageIgnore;
030
031/**
032 * @deprecated This class has been replaced by {@link ParamPrefixEnum} in HAPI FHIR 1.5
033 */
034@Deprecated
035@CoverageIgnore
036public enum QuantityCompararatorEnum {
037
038        /**
039         * Code Value: <b>&lt;</b>
040         *
041         * The actual value is less than the given value.
042         */
043        LESSTHAN("<", "http://hl7.org/fhir/quantity-comparator"),
044        
045        /**
046         * Code Value: <b>&lt;=</b>
047         *
048         * The actual value is less than or equal to the given value.
049         */
050        LESSTHAN_OR_EQUALS("<=", "http://hl7.org/fhir/quantity-comparator"),
051        
052        /**
053         * Code Value: <b>&gt;=</b>
054         *
055         * The actual value is greater than or equal to the given value.
056         */
057        GREATERTHAN_OR_EQUALS(">=", "http://hl7.org/fhir/quantity-comparator"),
058        
059        /**
060         * Code Value: <b>&gt;</b>
061         *
062         * The actual value is greater than the given value.
063         */
064        GREATERTHAN(">", "http://hl7.org/fhir/quantity-comparator"),
065        
066        ;
067        
068        /**
069         * Identifier for this Value Set:
070         * http://hl7.org/fhir/vs/quantity-comparator
071         */
072        public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/quantity-comparator";
073
074        /**
075         * Name for this Value Set:
076         * QuantityCompararator
077         */
078        public static final String VALUESET_NAME = "QuantityCompararator";
079
080        private static Map<String, QuantityCompararatorEnum> CODE_TO_ENUM = new HashMap<String, QuantityCompararatorEnum>();
081        private static Map<String, Map<String, QuantityCompararatorEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, QuantityCompararatorEnum>>();
082        
083        private final String myCode;
084        private final String mySystem;
085        
086        static {
087                for (QuantityCompararatorEnum next : QuantityCompararatorEnum.values()) {
088                        CODE_TO_ENUM.put(next.getCode(), next);
089                        
090                        if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
091                                SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, QuantityCompararatorEnum>());
092                        }
093                        SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);                 
094                }
095        }
096        
097        /**
098         * Returns the code associated with this enumerated value
099         */
100        public String getCode() {
101                return myCode;
102        }
103        
104        /**
105         * Returns the code system associated with this enumerated value
106         */
107        public String getSystem() {
108                return mySystem;
109        }
110        
111        /**
112         * Returns the enumerated value associated with this code
113         */
114        public static QuantityCompararatorEnum forCode(String theCode) {
115                QuantityCompararatorEnum retVal = CODE_TO_ENUM.get(theCode);
116                return retVal;
117        }
118
119        /**
120         * Converts codes to their respective enumerated values
121         */
122        @SuppressWarnings("serial")
123        public static final IValueSetEnumBinder<QuantityCompararatorEnum> VALUESET_BINDER = new IValueSetEnumBinder<QuantityCompararatorEnum>() {
124                @Override
125                public String toCodeString(QuantityCompararatorEnum theEnum) {
126                        return theEnum.getCode();
127                }
128
129                @Override
130                public String toSystemString(QuantityCompararatorEnum theEnum) {
131                        return theEnum.getSystem();
132                }
133                
134                @Override
135                public QuantityCompararatorEnum fromCodeString(String theCodeString) {
136                        return CODE_TO_ENUM.get(theCodeString);
137                }
138                
139                @Override
140                public QuantityCompararatorEnum fromCodeString(String theCodeString, String theSystemString) {
141                        Map<String, QuantityCompararatorEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
142                        if (map == null) {
143                                return null;
144                        }
145                        return map.get(theCodeString);
146                }
147                
148        };
149        
150        /** 
151         * Constructor
152         */
153        QuantityCompararatorEnum(String theCode, String theSystem) {
154                myCode = theCode;
155                mySystem = theSystem;
156        }
157
158        
159}