|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
   package org.kuali.rice.krms.api.repository.proposition;  | 
  |  17 |     | 
     | 
  |  18 |     | 
   import org.kuali.rice.core.api.mo.common.Coded;  | 
  |  19 |     | 
     | 
  |  20 |     | 
   import java.util.HashSet;  | 
  |  21 |     | 
   import java.util.Set;  | 
  |  22 |     | 
     | 
  |  23 |     | 
     | 
  |  24 |     | 
     | 
  |  25 |     | 
     | 
  |  26 |     | 
     | 
  |  27 |     | 
     | 
  |  28 |     | 
     | 
  |  29 |    2 |    public enum PropositionParameterType implements Coded { | 
  |  30 |     | 
     | 
  |  31 |    1 |            CONSTANT("C"), | 
  |  32 |    1 |            TERM("T"), | 
  |  33 |    1 |            FUNCTION("F"), | 
  |  34 |    1 |            OPERATOR("O"); | 
  |  35 |     | 
             | 
  |  36 |     | 
           private final String code;  | 
  |  37 |     | 
             | 
  |  38 |    4 |            private PropositionParameterType(String code) { | 
  |  39 |    4 |                    this.code = code;  | 
  |  40 |    4 |            }  | 
  |  41 |     | 
             | 
  |  42 |     | 
           public String getCode() { | 
  |  43 |    4 |                    return code;  | 
  |  44 |     | 
           }  | 
  |  45 |     | 
             | 
  |  46 |    1 |            public static final Set<String> VALID_TYPE_CODES = new HashSet<String>();  | 
  |  47 |     | 
           static { | 
  |  48 |    5 |                    for (PropositionParameterType propositionParameterType : values()) { | 
  |  49 |    4 |                            VALID_TYPE_CODES.add(propositionParameterType.getCode());  | 
  |  50 |     | 
                   }  | 
  |  51 |    1 |            }  | 
  |  52 |     | 
             | 
  |  53 |     | 
           public static PropositionParameterType fromCode(String code) { | 
  |  54 |    0 |                    if (code == null) { | 
  |  55 |    0 |                            return null;  | 
  |  56 |     | 
                   }  | 
  |  57 |    0 |                    for (PropositionParameterType propositionParameterType : values()) { | 
  |  58 |    0 |                            if (propositionParameterType.code.equals(code)) { | 
  |  59 |    0 |                                    return propositionParameterType;  | 
  |  60 |     | 
                           }  | 
  |  61 |     | 
                   }  | 
  |  62 |    0 |                    throw new IllegalArgumentException("Failed to locate the PropositionParameterType with the given code: " + code); | 
  |  63 |     | 
           }  | 
  |  64 |     | 
             | 
  |  65 |     | 
   }  |