| 66 | import pcgen.core.bonus.BonusObj; |
| 67 | |
| 68 | public abstract class CDOMObject extends ConcretePrereqObject |
| 69 | implements Cloneable, BonusContainer, Loadable, Reducible, PCGenScoped, VarHolder, |
| 70 | VarContainer |
| 71 | { |
| 72 | |
| 73 | public static final Comparator<CDOMObject> P_OBJECT_COMP = |
| 74 | (o1, o2) -> o1.getKeyName().compareToIgnoreCase(o2.getKeyName()); |
| 75 | public static final Comparator<CDOMObject> P_OBJECT_NAME_COMP = (o1, o2) -> { |
| 76 | final Collator collator = Collator.getInstance(); |
| 77 | |
| 78 | // Check sort keys first |
| 79 | String key1 = o1.get(StringKey.SORT_KEY); |
| 80 | if (key1 == null) |
| 81 | { |
| 82 | key1 = o1.getDisplayName(); |
| 83 | } |
| 84 | String key2 = o2.get(StringKey.SORT_KEY); |
| 85 | if (key2 == null) |
| 86 | { |
| 87 | key2 = o2.getDisplayName(); |
| 88 | } |
| 89 | if (!key1.equals(key2)) |
| 90 | { |
| 91 | return collator.compare(key1, key2); |
| 92 | } |
| 93 | if (!o1.getDisplayName().equals(o2.getDisplayName())) |
| 94 | { |
| 95 | return collator.compare(o1.getDisplayName(), o2.getDisplayName()); |
| 96 | } |
| 97 | // Fall back to keyname if the displayname is the same |
| 98 | return collator.compare(o1.getKeyName(), o2.getKeyName()); |
| 99 | }; |
| 100 | /** |
| 101 | * The source URI for this CDOMObject. |
| 102 | */ |
| 103 | private URI sourceURI = null; |
| 104 | |
| 105 | /** |
| 106 | * The display name for this CDOMObject. |
| 107 | */ |
| 108 | private String displayName = Constants.EMPTY_STRING; |
| 109 | |
| 110 | /** |
| 111 | * Support object to store the variable information on an object. |
| 112 | */ |
| 113 | private VarHolderSupport varHolder = new VarHolderSupport(); |
| 114 | |
| 115 | /* |
| 116 | * CONSIDER This should be a NumberMap - not Integer, but allow Double as |
| 117 | * well, in one HashMap... this will control the size of CDOMObject. |
| 118 | */ |
| 119 | /** A map to hold items keyed by Integers for the object */ |
| 120 | // TODO make this final once clone() is no longer required... |
| 121 | private Map<IntegerKey, Integer> integerChar = null; |
| 122 | |
| 123 | /** A map to hold items keyed by Strings for the object */ |
| 124 | // TODO make this final once clone() is no longer required... |
| 125 | private Map<StringKey, String> stringChar = null; |
nothing calls this directly
no test coverage detected