Package megameklab.util
Record Class MekUtil.MekMountedSorter
java.lang.Object
java.lang.Record
megameklab.util.MekUtil.MekMountedSorter
- All Implemented Interfaces:
Comparator<megamek.common.equipment.Mounted<?>>
- Enclosing class:
- MekUtil
public static record MekUtil.MekMountedSorter(megamek.common.units.Mek mek)
extends Record
implements Comparator<megamek.common.equipment.Mounted<?>>
A Mounted sorter using the official sort order (mostly)
-
Constructor Summary
ConstructorsConstructorDescriptionMekMountedSorter(megamek.common.units.Mek mek) Creates an instance of aMekMountedSorterrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcompare(megamek.common.equipment.Mounted<?> mountedA, megamek.common.equipment.Mounted<?> mountedB) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.megamek.common.units.Mekmek()Returns the value of themekrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
MekMountedSorter
public MekMountedSorter(megamek.common.units.Mek mek) Creates an instance of aMekMountedSorterrecord class.- Parameters:
mek- the value for themekrecord component
-
-
Method Details
-
compare
public int compare(megamek.common.equipment.Mounted<?> mountedA, megamek.common.equipment.Mounted<?> mountedB) - Specified by:
comparein interfaceComparator<megamek.common.equipment.Mounted<?>>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).- Specified by:
equalsin interfaceComparator<megamek.common.equipment.Mounted<?>>- Specified by:
equalsin classRecord- Parameters:
o- the object with which to compare- Returns:
trueif this object is the same as theoargument;falseotherwise.
-
mek
public megamek.common.units.Mek mek()Returns the value of themekrecord component.- Returns:
- the value of the
mekrecord component
-