Class TopmostRankedSkillComparator

  • All Implemented Interfaces:
    java.util.Comparator<java.util.Map<? extends ID,​Skill>>

    public class TopmostRankedSkillComparator
    extends java.lang.Object
    implements java.util.Comparator<java.util.Map<? extends ID,​Skill>>
    A comparator imposing an ordering on collections of Skill objects by comparing the highest ranked skill available in each set with a SkillComparator. In case of equality the second highest ranked skills are compared and so on and so on. In case of total equality (e.g. if there is only one skill oject in both maps and the skilltype and value is the same) the sub-comparator is used for comparison. Note: Skilltype rankings can be defined in the preferences and are available through SkillTypeRankComparator.

    Note: this comparator imposes orderings that are inconsistent with equals.

    In order to overcome the inconsistency with equals this comparator allows the introduction of a sub-comparator which is applied in cases of equality.

    • Constructor Summary

      Constructors 
      Constructor Description
      TopmostRankedSkillComparator​(java.util.Comparator<? super java.util.Map<? extends ID,​Skill>> subComparator, java.util.Properties settings)
      Creates a new TopmostRankedSkillComparator object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.util.Map<? extends ID,​Skill> o1, java.util.Map<? extends ID,​Skill> o2)
      Compares its two arguments for order according to their skills.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • TopmostRankedSkillComparator

        public TopmostRankedSkillComparator​(java.util.Comparator<? super java.util.Map<? extends ID,​Skill>> subComparator,
                                            java.util.Properties settings)
        Creates a new TopmostRankedSkillComparator object.
    • Method Detail

      • compare

        public int compare​(java.util.Map<? extends ID,​Skill> o1,
                           java.util.Map<? extends ID,​Skill> o2)
        Compares its two arguments for order according to their skills. Undefined values are evaluated as > 0.
        Specified by:
        compare in interface java.util.Comparator<java.util.Map<? extends ID,​Skill>>