Class AbstractQualifier

java.lang.Object
jmri.jmrit.symbolicprog.AbstractQualifier
All Implemented Interfaces:
PropertyChangeListener, EventListener, Qualifier
Direct Known Subclasses:
ArithmeticQualifier

public abstract class AbstractQualifier extends Object implements Qualifier, PropertyChangeListener
Watches a specific Variable to qualify another object, e.g. another Variable or a Pane.

The "qualifier" variable is the one being watched; its properties control whether the "qualified" Object is available or not.

  • Field Details

  • Constructor Details

  • Method Details

    • getWatchedVariable

    • propertyChange

      Process property change from the qualifier Variable (one being watched).

      Follows changes "Value" property, which it assumes is an Integer.

      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      e - The event that triggered the query
    • processValueChangeEvent

      Process Value property change from the qualifier Variable (one being watched).
      Parameters:
      e - The event that triggered the query
    • availableStateFromEvent

      Calculate whether this PropertyChangeEvent means that the qualified Object should be set Available or not.
      Parameters:
      e - The event that triggered the query
      Returns:
      true if should be set available
    • currentAvailableState

      protected abstract boolean currentAvailableState()
      Retrieve the current "available" state from the qualified Object.
      Returns:
      true if available
    • currentDesiredState

      public abstract boolean currentDesiredState()
      Does the current value of qualifier Variable means that the qualified object should be set Available or not?
      Specified by:
      currentDesiredState in interface Qualifier
      Returns:
      true if should be set available
    • availableStateFromValue

      protected abstract boolean availableStateFromValue(Object value)
      Calculate whether a particular value for the qualifier Variable means that the qualified Object should be set Available or not.
      Parameters:
      value - base for the calculation
      Returns:
      true if should be set available
    • setWatchedAvailable

      public abstract void setWatchedAvailable(boolean enable)
      Drive the available or not state of the qualified Object.

      Subclasses implement this to control a specific type of qualified Object, like a Variable or Pane.

      Specified by:
      setWatchedAvailable in interface Qualifier
      Parameters:
      enable - true if should be enabled