MCPcopy Create free account
hub / github.com/PCGen/pcgen / getSortKey

Method getSortKey

code/src/java/pcgen/gui2/facade/EquipNode.java:165–193  ·  view source on GitHub ↗

@return The key to be used for sorting EquipNodes

()

Source from the content-addressed store, hash-verified

163 * @return The key to be used for sorting EquipNodes
164 */
165 String getSortKey()
166 {
167 StringBuilder sortKey = new StringBuilder(50);
168 if (parent != null)
169 {
170 sortKey.append(parent.getSortKey());
171 }
172 switch (nodeType)
173 {
174 case BODY_SLOT -> sortKey.append(order);
175 case PHANTOM_SLOT -> {
176 sortKey.append("|");
177 sortKey.append(slot.getSlotName());
178 }
179 case EQUIPMENT -> {
180 sortKey.append("|");
181 String objKey = equipment.get(StringKey.SORT_KEY);
182 if (objKey == null)
183 {
184 objKey = equipment.getDisplayName();
185 }
186 sortKey.append(objKey);
187 }
188 default -> {
189 }
190 //Case not caught, should this cause an error?
191 }
192 return sortKey.toString();
193 }
194
195 @Override
196 public String toString()

Callers 2

testInitWithEquipmentMethod · 0.95
compareToMethod · 0.95

Calls 6

getSlotNameMethod · 0.80
getSortKeyMethod · 0.65
getMethod · 0.65
getDisplayNameMethod · 0.65
toStringMethod · 0.65
appendMethod · 0.45

Tested by 1

testInitWithEquipmentMethod · 0.76