Package jmri

Class TurnoutOperationManager

  • All Implemented Interfaces:
    InstanceManagerAutoDefault

    public class TurnoutOperationManager
    extends java.lang.Object
    implements 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 Detail

      • pcs

        java.beans.PropertyChangeSupport pcs
        Property change support.
    • Method Detail

      • 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

        public TurnoutOperation getMatchingOperationAlways​(@Nonnull
                                                           Turnout t,
                                                           int apparentMode)
        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
      • 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 java.lang.String[] concatenateTypeLists​(@Nonnull
                                                              java.lang.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
      • firePropertyChange

        protected void firePropertyChange​(@Nonnull
                                          java.lang.String p,
                                          java.lang.Object old,
                                          java.lang.Object n)
      • getTooltipForOperator

        public java.lang.String getTooltipForOperator​(java.lang.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.