Package jme3utilities

Class SignalTracker

java.lang.Object
jme3utilities.SignalTracker

public class SignalTracker extends Object
Track the active/inactive status of named signals. A signal may originate from multiple sources such as buttons or hotkeys. A signal is active as long as any of its sources is active.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Logger
    message logger for this class
  • Constructor Summary

    Constructors
    Constructor
    Description
    A no-arg constructor to avoid javadoc warnings from JDK 18.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(String name)
    Add a new signal with all of its sources inactive.
    void
    setActive(String signalName, int sourceIndex, boolean newState)
    Update whether a named signal source is active.
    boolean
    test(String signalName)
    Test whether the named signal is active.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • SignalTracker

      public SignalTracker()
      A no-arg constructor to avoid javadoc warnings from JDK 18.
  • Method Details

    • add

      public void add(String name)
      Add a new signal with all of its sources inactive. If the signal name is already in use, this has no effect.
      Parameters:
      name - the name for the signal (not null)
    • setActive

      public void setActive(String signalName, int sourceIndex, boolean newState)
      Update whether a named signal source is active.
      Parameters:
      signalName - the signal's name (not null)
      sourceIndex - the index of the signal source (key or button) which is being updated
      newState - true if the source has gone active; false if the source has gone inactive
    • test

      public boolean test(String signalName)
      Test whether the named signal is active.
      Parameters:
      signalName - the name of the signal (not null)
      Returns:
      true if any of the signal's sources is active, otherwise false