Class SkillRankComparator

  • All Implemented Interfaces:
    java.util.Comparator<Skill>

    public class SkillRankComparator
    extends java.lang.Object
    implements java.util.Comparator<Skill>
    A comparator imposing an ordering on Skill objects by comparing their user modifiable ranking. (In case of skill objects the skill's type is compared).

    Note: this comparator can impose 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. I.e. if the two compared objects have the same rank and they would be regarded as equal by this comparator, instead of 0 the result of the sub-comparator's comparison is returned.

    Author:
    Ulrich Küster
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(Skill o1, Skill o2)  
      • 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

      • SkillRankComparator

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

      • compare

        public int compare​(Skill o1,
                           Skill o2)
        Specified by:
        compare in interface java.util.Comparator<Skill>
        See Also:
        Comparator.compare(java.lang.Object, java.lang.Object)