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 XPathUsageTypeEnum {
009
010        /**
011         * Display: <b>Normal</b><br>
012         * Code Value: <b>normal</b>
013         *
014         * The search parameter is derived directly from the selected nodes based on the type definitions.
015         */
016        NORMAL("normal", "http://hl7.org/fhir/search-xpath-usage"),
017        
018        /**
019         * Display: <b>Phonetic</b><br>
020         * Code Value: <b>phonetic</b>
021         *
022         * The search parameter is derived by a phonetic transform from the selected nodes.
023         */
024        PHONETIC("phonetic", "http://hl7.org/fhir/search-xpath-usage"),
025        
026        /**
027         * Display: <b>Nearby</b><br>
028         * Code Value: <b>nearby</b>
029         *
030         * The search parameter is based on a spatial transform of the selected nodes.
031         */
032        NEARBY("nearby", "http://hl7.org/fhir/search-xpath-usage"),
033        
034        /**
035         * Display: <b>Distance</b><br>
036         * Code Value: <b>distance</b>
037         *
038         * The search parameter is based on a spatial transform of the selected nodes, using physical distance from the middle.
039         */
040        DISTANCE("distance", "http://hl7.org/fhir/search-xpath-usage"),
041        
042        /**
043         * Display: <b>Other</b><br>
044         * Code Value: <b>other</b>
045         *
046         * The interpretation of the xpath statement is unknown (and can't be automated).
047         */
048        OTHER("other", "http://hl7.org/fhir/search-xpath-usage"),
049        
050        ;
051        
052        /**
053         * Identifier for this Value Set:
054         * 
055         */
056        public static final String VALUESET_IDENTIFIER = "";
057
058        /**
059         * Name for this Value Set:
060         * XPathUsageType
061         */
062        public static final String VALUESET_NAME = "XPathUsageType";
063
064        private static Map<String, XPathUsageTypeEnum> CODE_TO_ENUM = new HashMap<String, XPathUsageTypeEnum>();
065        private static Map<String, Map<String, XPathUsageTypeEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, XPathUsageTypeEnum>>();
066        
067        private final String myCode;
068        private final String mySystem;
069        
070        static {
071                for (XPathUsageTypeEnum next : XPathUsageTypeEnum.values()) {
072                        CODE_TO_ENUM.put(next.getCode(), next);
073                        
074                        if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
075                                SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, XPathUsageTypeEnum>());
076                        }
077                        SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);                 
078                }
079        }
080        
081        /**
082         * Returns the code associated with this enumerated value
083         */
084        public String getCode() {
085                return myCode;
086        }
087        
088        /**
089         * Returns the code system associated with this enumerated value
090         */
091        public String getSystem() {
092                return mySystem;
093        }
094        
095        /**
096         * Returns the enumerated value associated with this code
097         */
098        public static XPathUsageTypeEnum forCode(String theCode) {
099                XPathUsageTypeEnum retVal = CODE_TO_ENUM.get(theCode);
100                return retVal;
101        }
102
103        /**
104         * Converts codes to their respective enumerated values
105         */
106        public static final IValueSetEnumBinder<XPathUsageTypeEnum> VALUESET_BINDER = new IValueSetEnumBinder<XPathUsageTypeEnum>() {
107                @Override
108                public String toCodeString(XPathUsageTypeEnum theEnum) {
109                        return theEnum.getCode();
110                }
111
112                @Override
113                public String toSystemString(XPathUsageTypeEnum theEnum) {
114                        return theEnum.getSystem();
115                }
116                
117                @Override
118                public XPathUsageTypeEnum fromCodeString(String theCodeString) {
119                        return CODE_TO_ENUM.get(theCodeString);
120                }
121                
122                @Override
123                public XPathUsageTypeEnum fromCodeString(String theCodeString, String theSystemString) {
124                        Map<String, XPathUsageTypeEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
125                        if (map == null) {
126                                return null;
127                        }
128                        return map.get(theCodeString);
129                }
130                
131        };
132        
133        /** 
134         * Constructor
135         */
136        XPathUsageTypeEnum(String theCode, String theSystem) {
137                myCode = theCode;
138                mySystem = theSystem;
139        }
140
141        
142}