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

Method compare

code/src/java/pcgen/core/display/SkillDisplay.java:62–91  ·  view source on GitHub ↗

Comparator will be specific to Skill objects

(final Skill skill1, final Skill skill2)

Source from the content-addressed store, hash-verified

60 * Comparator will be specific to Skill objects
61 */
62 @Override
63 public int compare(final Skill skill1, final Skill skill2)
64 {
65 Integer obj1Index = pc.getSkillOrder(skill1);
66 Integer obj2Index = pc.getSkillOrder(skill2);
67
68 // Force unset items (index of 0) to appear at the end
69 if (obj1Index == null || obj1Index == 0)
70 {
71 obj1Index = Constants.ARBITRARY_END_SKILL_INDEX;
72 }
73
74 if (obj2Index == null || obj2Index == 0)
75 {
76 obj2Index = Constants.ARBITRARY_END_SKILL_INDEX;
77 }
78
79 if (obj1Index > obj2Index)
80 {
81 return 1;
82 }
83 else if (obj1Index < obj2Index)
84 {
85 return -1;
86 }
87 else
88 {
89 return skill1.getOutputName().compareToIgnoreCase(skill2.getOutputName());
90 }
91 }
92 });
93
94 // Remove the hidden skills from the list

Callers

nothing calls this directly

Calls 2

getSkillOrderMethod · 0.80
getOutputNameMethod · 0.45

Tested by

no test coverage detected