Class AllianceFactionComparator

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

    public class AllianceFactionComparator
    extends java.lang.Object
    implements java.util.Comparator<Alliance>
    A comparator imposing an ordering on Alliance objects by comparing the factions they contain.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Comparator<? super Faction> factionSubCmp  
    • Constructor Summary

      Constructors 
      Constructor Description
      AllianceFactionComparator​(java.util.Comparator<? super Faction> factionSubComparator)
      Creates a new AllianceFactionComparator object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(Alliance a1, Alliance a2)
      Compares its two arguments for order with regard to their trust levels.
      • 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
    • Field Detail

      • factionSubCmp

        protected java.util.Comparator<? super Faction> factionSubCmp
    • Constructor Detail

      • AllianceFactionComparator

        public AllianceFactionComparator​(java.util.Comparator<? super Faction> factionSubComparator)
        Creates a new AllianceFactionComparator object.
        Parameters:
        factionSubComparator - is used to compare the factions of two alliance objects.
    • Method Detail

      • compare

        public int compare​(Alliance a1,
                           Alliance a2)
        Compares its two arguments for order with regard to their trust levels.
        Specified by:
        compare in interface java.util.Comparator<Alliance>
        Returns:
        the result of the faction comparator applied to the factions of the alliances o1 and o2. Undefined values are evaluated as > 0.