Class Inventory.CounterNode.Numerical

java.lang.Object
VASSAL.build.module.Inventory.CounterNode.CompareCounterNodes
VASSAL.build.module.Inventory.CounterNode.Numerical
All Implemented Interfaces:
Comparator<Inventory.CounterNode>
Enclosing class:
Inventory.CounterNode

protected class Inventory.CounterNode.Numerical extends Inventory.CounterNode.CompareCounterNodes implements Comparator<Inventory.CounterNode>
Compare two CounterNodes based on the first integer value found in their SortKeys. If a CounterNodes SortKey does not contain an integer at all it is assigned the lowest available integer.
Author:
spindler
  • Field Details

  • Constructor Details

    • Numerical

      protected Numerical()
  • Method Details

    • getInt

      protected int getInt(String key)
      Get first integer in key, if any. Otherwise return lowest possible integer.
      Parameters:
      key - is a string that may or may not contain an integer value
      Returns:
      the value of the integer found, min(Integer) otherwise
    • compare

      public int compare(Inventory.CounterNode left, Inventory.CounterNode right)
      Compare two CounterNodes based on the first integer found in their SortKeys.
      Specified by:
      compare in interface Comparator<Inventory.CounterNode>