Package megamek.common.comparators
Record Class WeaponComparatorNum
java.lang.Object
java.lang.Record
megamek.common.comparators.WeaponComparatorNum
- All Implemented Interfaces:
- Comparator<WeaponMounted>
public record WeaponComparatorNum(Entity entity)
extends Record
implements Comparator<WeaponMounted>
Comparator for sorting Weapons (Mounted that have WeaponTypes) by weapon number.
- 
Constructor SummaryConstructorsConstructorDescriptionWeaponComparatorNum(Entity entity) Creates an instance of aWeaponComparatorNumrecord class.
- 
Method SummaryModifier and TypeMethodDescriptionintcompare(WeaponMounted lhs, WeaponMounted rhs) entity()Returns the value of theentityrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparatorreversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
- 
Constructor Details- 
WeaponComparatorNumCreates an instance of aWeaponComparatorNumrecord class.- Parameters:
- entity- the value for the- entityrecord component
 
 
- 
- 
Method Details- 
compare- Specified by:
- comparein interface- Comparator<WeaponMounted>
 
- 
toStringReturns 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.
- 
hashCodepublic 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.
- 
equalsIndicates 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 interface- Comparator<WeaponMounted>
- Specified by:
- equalsin class- Record
- Parameters:
- o- the object with which to compare
- Returns:
- trueif this object is the same as the- oargument;- falseotherwise.
 
- 
entityReturns the value of theentityrecord component.- Returns:
- the value of the entityrecord component
 
 
-