Class UnitIslandComparator

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

    public class UnitIslandComparator
    extends java.lang.Object
    implements java.util.Comparator<Island>
    A comparator imposing an ordering on Island objects
    • Field Summary

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

      Constructors 
      Constructor Description
      UnitIslandComparator​(java.util.Comparator<? super Island> subComparator)
      Creates a new UnitIslandComparator object.
    • Method Summary

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

      • subCmp

        protected java.util.Comparator<? super Island> subCmp
    • Constructor Detail

      • UnitIslandComparator

        public UnitIslandComparator​(java.util.Comparator<? super Island> subComparator)
        Creates a new UnitIslandComparator object.
        Parameters:
        subComparator - if two units belonging to the same faction are compared, this sub-comparator is applied if it is notnull.
    • Method Detail

      • compare

        public int compare​(Island o1,
                           Island o2)
        Compares two islands
        Specified by:
        compare in interface java.util.Comparator<Island>
        Returns:
        The comparison result of the names or IDs. If both are the same and a sub-comparator was specified, the result that sub-comparator's comparison is returned.