001
002package ca.uhn.fhir.model.dstu2.valueset;
003
004import ca.uhn.fhir.model.api.*;
005import java.util.HashMap;
006import java.util.Map;
007
008public enum DataElementStringencyEnum {
009
010        /**
011         * Display: <b>Comparable</b><br>
012         * Code Value: <b>comparable</b>
013         *
014         * The data element is sufficiently well-constrained that multiple pieces of data captured according to the constraints of the data element will be comparable (though in some cases, a degree of automated conversion/normalization may be required).
015         */
016        COMPARABLE("comparable", "http://hl7.org/fhir/dataelement-stringency"),
017        
018        /**
019         * Display: <b>Fully Specified</b><br>
020         * Code Value: <b>fully-specified</b>
021         *
022         * The data element is fully specified down to a single value set, single unit of measure, single data type, etc.  Multiple pieces of data associated with this data element are fully comparable.
023         */
024        FULLY_SPECIFIED("fully-specified", "http://hl7.org/fhir/dataelement-stringency"),
025        
026        /**
027         * Display: <b>Equivalent</b><br>
028         * Code Value: <b>equivalent</b>
029         *
030         * The data element allows multiple units of measure having equivalent meaning; e.g. "cc" (cubic centimeter) and "mL" (milliliter).
031         */
032        EQUIVALENT("equivalent", "http://hl7.org/fhir/dataelement-stringency"),
033        
034        /**
035         * Display: <b>Convertable</b><br>
036         * Code Value: <b>convertable</b>
037         *
038         * The data element allows multiple units of measure that are convertable between each other (e.g. inches and centimeters) and/or allows data to be captured in multiple value sets for which a known mapping exists allowing conversion of meaning.
039         */
040        CONVERTABLE("convertable", "http://hl7.org/fhir/dataelement-stringency"),
041        
042        /**
043         * Display: <b>Scaleable</b><br>
044         * Code Value: <b>scaleable</b>
045         *
046         * A convertable data element where unit conversions are different only by a power of 10; e.g. g, mg, kg.
047         */
048        SCALEABLE("scaleable", "http://hl7.org/fhir/dataelement-stringency"),
049        
050        /**
051         * Display: <b>Flexible</b><br>
052         * Code Value: <b>flexible</b>
053         *
054         * The data element is unconstrained in units, choice of data types and/or choice of vocabulary such that automated comparison of data captured using the data element is not possible.
055         */
056        FLEXIBLE("flexible", "http://hl7.org/fhir/dataelement-stringency"),
057        
058        ;
059        
060        /**
061         * Identifier for this Value Set:
062         * 
063         */
064        public static final String VALUESET_IDENTIFIER = "";
065
066        /**
067         * Name for this Value Set:
068         * DataElementStringency
069         */
070        public static final String VALUESET_NAME = "DataElementStringency";
071
072        private static Map<String, DataElementStringencyEnum> CODE_TO_ENUM = new HashMap<String, DataElementStringencyEnum>();
073        private static Map<String, Map<String, DataElementStringencyEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, DataElementStringencyEnum>>();
074        
075        private final String myCode;
076        private final String mySystem;
077        
078        static {
079                for (DataElementStringencyEnum next : DataElementStringencyEnum.values()) {
080                        CODE_TO_ENUM.put(next.getCode(), next);
081                        
082                        if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
083                                SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, DataElementStringencyEnum>());
084                        }
085                        SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);                 
086                }
087        }
088        
089        /**
090         * Returns the code associated with this enumerated value
091         */
092        public String getCode() {
093                return myCode;
094        }
095        
096        /**
097         * Returns the code system associated with this enumerated value
098         */
099        public String getSystem() {
100                return mySystem;
101        }
102        
103        /**
104         * Returns the enumerated value associated with this code
105         */
106        public static DataElementStringencyEnum forCode(String theCode) {
107                DataElementStringencyEnum retVal = CODE_TO_ENUM.get(theCode);
108                return retVal;
109        }
110
111        /**
112         * Converts codes to their respective enumerated values
113         */
114        public static final IValueSetEnumBinder<DataElementStringencyEnum> VALUESET_BINDER = new IValueSetEnumBinder<DataElementStringencyEnum>() {
115                @Override
116                public String toCodeString(DataElementStringencyEnum theEnum) {
117                        return theEnum.getCode();
118                }
119
120                @Override
121                public String toSystemString(DataElementStringencyEnum theEnum) {
122                        return theEnum.getSystem();
123                }
124                
125                @Override
126                public DataElementStringencyEnum fromCodeString(String theCodeString) {
127                        return CODE_TO_ENUM.get(theCodeString);
128                }
129                
130                @Override
131                public DataElementStringencyEnum fromCodeString(String theCodeString, String theSystemString) {
132                        Map<String, DataElementStringencyEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
133                        if (map == null) {
134                                return null;
135                        }
136                        return map.get(theCodeString);
137                }
138                
139        };
140        
141        /** 
142         * Constructor
143         */
144        DataElementStringencyEnum(String theCode, String theSystem) {
145                myCode = theCode;
146                mySystem = theSystem;
147        }
148
149        
150}