Package jmri

Class TurnoutOperationManager

java.lang.Object
jmri.TurnoutOperationManager
All Implemented Interfaces:
InstanceManagerAutoDefault

class to look after the collection of TurnoutOperation subclasses Unlike the other xxxManager, this does not inherit from AbstractManager since the resources it deals with are not DCC system resources but rather purely internal state.
  • Field Details

  • Constructor Details

  • Method Details

    • dispose

      public void dispose()
    • getTurnoutOperations

    • addOperation

      protected void addOperation(@Nonnull TurnoutOperation op)
      add a new operation Silently replaces any existing operation with the same name
      Parameters:
      op - TurnoutOperation to add/replace
    • removeOperation

    • getOperation

      Find a TurnoutOperation by its name.
      Parameters:
      name - name of TurnoutOperation to retrieve.
      Returns:
      the operation
    • loadOperationTypes

      public void loadOperationTypes()
      Load the operation types given by the current TurnoutManager instance, in the order given.

      The order is important because the acceptable feedback modes may overlap. All we do is instantiate the classes. The constructors take care of putting everything in the right places. We allow multiple occurrences of the same name without complaining so the Proxy stuff works. There's a threading problem here, because this invokes gets the current turnout manager, often the proxy manager, which in turn invokes loadOperationTypes again. This is bad. It's not clear why it even works.

    • getMatchingOperationAlways

      Find a suitable operation for this turnout, based on its feedback type. The mode is passed separately so the caller can transform it
      Parameters:
      t - turnout
      apparentMode - Turnout Feedback mode(s) to be used when finding a matching operation
      Returns:
      the turnout operation
    • getMatchingOperation

      public TurnoutOperation getMatchingOperation(@Nonnull Turnout t, int apparentMode)
      Find the correct operation for this turnout. If operations are globally disabled, return null.
      Parameters:
      t - turnout
      apparentMode - mode(s) to be used when finding a matching operation
      Returns:
      operation
    • getMatchingOperationAlways

    • getDoOperations

      public boolean getDoOperations()
      Get ( potentially update ) status of whether operations are in use.
      Returns:
      true if in use, else false.
    • setDoOperations

      public void setDoOperations(boolean b)
      Set that Turnout Operations are in use.
      Parameters:
      b - true to use, else false to disable.
    • concatenateTypeLists

      public static String[] concatenateTypeLists(@Nonnull String[] types)
      Proxy support. Take a concatenation of operation type lists from multiple systems and turn it into a single list, by eliminating duplicates and ensuring that NoFeedback - which matches anything - comes at the end if it is present at all.
      Parameters:
      types - list of types possibly containing duplicates
      Returns:
      list reduced as described above
    • addPropertyChangeListener

    • removePropertyChangeListener

    • firePropertyChange

      protected void firePropertyChange(@Nonnull String p, Object old, Object n)
    • getTooltipForOperator

      public String getTooltipForOperator(String operatorName, Turnout t)
      Get a ToolTip or descriptive comment for the Operator.
      Parameters:
      operatorName - name of the Turnout Operator
      t - The Turnout that the Operator would operate
      Returns:
      Descriptive String, or null.