Class SkillTypeRankComparator

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

    public class SkillTypeRankComparator
    extends java.lang.Object
    implements java.util.Comparator<SkillType>
    A comparator imposing an ordering on SkillType objects by comparing their user modifiable ranking.

    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
      SkillTypeRankComparator​(java.util.Comparator<? super SkillType> 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​(SkillType s1, SkillType s2)  
      • 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

      • SkillTypeRankComparator

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

      • compare

        public int compare​(SkillType s1,
                           SkillType s2)
        Specified by:
        compare in interface java.util.Comparator<SkillType>
        See Also:
        Comparator.compare(java.lang.Object, java.lang.Object)