Class SwitchResult

java.lang.Object
privbot.mechanics.SwitchResult

public final class SwitchResult extends Object
What one ctx.loadouts.switchTo(..) call sent. Immutable.

What it proves: only which clicks went out (were accepted by the dispatcher) in that call. Nothing here says a piece is on; verify on later ticks with SwitchCheck.

  • sent(): the setup entries (by name) whose Wield/Wear/Equip click was accepted;
  • notCarried(): missing entries with no carried item by id or, failing that, by name;
  • failed(): entries whose click was refused or threw, or whose item has no wear action;
  • byName(): entries matched by name because no carried item had the setup's id, as "wanted -> carried";
  • unreadable(): equipment, inventory, or a name needed for matching could not be read, so nothing was sent and the lists are empty (never "nothing missing").

Pure data: safe on any thread.

  • Constructor Details

    • SwitchResult

      public SwitchResult(List<String> sent, List<String> notCarried, List<String> failed, List<String> byName, boolean unreadable)
      Parameters:
      sent - entries whose click was accepted
      notCarried - entries not carried
      failed - entries whose click was refused or threw
      byName - name-matched entries, "wanted -> carried"
      unreadable - whether the reads failed (then nothing was sent)
  • Method Details

    • unreadable

      public static SwitchResult unreadable(String reason)
      Parameters:
      reason - why the reads failed
      Returns:
      an unreadable result: nothing sent
    • nothingToSend

      public static SwitchResult nothingToSend()
      Returns:
      a readable result with nothing to send
    • sent

      public List<String> sent()
      Returns:
      entries whose click was accepted, in setup order
    • notCarried

      public List<String> notCarried()
      Returns:
      entries that are not carried
    • failed

      public List<String> failed()
      Returns:
      entries whose click was refused or threw, or that have no wear action
    • byName

      public List<String> byName()
      Returns:
      entries matched by name, as "wanted -> carried"
    • verificationSetup

      public GearSetup verificationSetup()
      The setup to verify: accepted name-matched clicks use the selected item's actual id in its intended slot. Unsent entries keep their original requirement, so a partial switch cannot appear complete. Null for an unreadable result or a result constructed without a setup.
    • unreadable

      public boolean unreadable()
      Returns:
      true when the reads failed and nothing was sent
    • reason

      public String reason()
      Returns:
      why the reads failed; empty for a readable result
    • allSent

      public boolean allSent()
      Returns:
      true when the reads worked and every missing entry's click went out
    • toString

      public String toString()
      Overrides:
      toString in class Object