Class DefaultLogix

    • Method Detail

      • getBeanType

        @Nonnull
        public java.lang.String getBeanType()
        Description copied from interface: NamedBean
        For instances in the code where we are dealing with just a bean and a message needs to be passed to the user or in a log.
        Specified by:
        getBeanType in interface NamedBean
        Returns:
        a string of the bean type, eg Turnout, Sensor etc
      • swapConditional

        public void swapConditional​(int nextInOrder,
                                    int row)
        Move 'row' to 'nextInOrder' and shift all between 'row' and 'nextInOrder' up one position ( row > nextInOrder )
        Specified by:
        swapConditional in interface Logix
        Parameters:
        nextInOrder - target order for Conditional at row
        row - position of Conditional to move
      • getConditionalByNumberOrder

        public java.lang.String getConditionalByNumberOrder​(int order)
        Returns the system name of the conditional that will calculate in the specified order. This is also the order the Conditional is listed in the Add/Edit Logix dialog. If 'order' is greater than the number of Conditionals for this Logix, and empty String is returned.
        Specified by:
        getConditionalByNumberOrder in interface Logix
        Parameters:
        order - order in which the Conditional calculates.
        Returns:
        system name of conditional or an empty String
      • addConditional

        public void addConditional​(java.lang.String systemName,
                                   int order)
        Add a Conditional to this Logix R
        Specified by:
        addConditional in interface Logix
        Parameters:
        systemName - The Conditional system name
        order - the order this conditional should calculate in if order is negative, the conditional is added at the end of current group of conditionals
      • addConditional

        public boolean addConditional​(java.lang.String systemName,
                                      Conditional conditional)
        Add a child Conditional to the parent Logix.
        Specified by:
        addConditional in interface Logix
        Parameters:
        systemName - The system name for the Conditional object.
        conditional - The Conditional object.
        Returns:
        true if the Conditional was added, false otherwise.
        Since:
        4.7.4
      • getConditional

        public Conditional getConditional​(java.lang.String systemName)
        Get a Conditional belonging to this Logix.
        Specified by:
        getConditional in interface Logix
        Parameters:
        systemName - The name of the Conditional object.
        Returns:
        the Conditional object or null if not found.
        Since:
        4.7.4
      • setEnabled

        public void setEnabled​(boolean state)
        Set enabled status. Enabled is a bound property All conditionals are set to UNKNOWN state and recalculated when the Logix is enabled, provided the Logix has been previously activated.
        Specified by:
        setEnabled in interface Logix
        Parameters:
        state - true if Logix should be enabled; false otherwise
      • getEnabled

        public boolean getEnabled()
        Get enabled status
        Specified by:
        getEnabled in interface Logix
        Returns:
        true if enabled; false otherwise
      • deleteConditional

        public java.lang.String[] deleteConditional​(java.lang.String systemName)
        Delete a Conditional and remove it from this Logix

        Note: Since each Logix must have at least one Conditional to do anything, the user is warned in Logix Table Action when the last Conditional is deleted.

        Specified by:
        deleteConditional in interface Logix
        Parameters:
        systemName - The Conditional system name
        Returns:
        null if Conditional was successfully deleted or not present, otherwise returns a string array list of current usage that prevent deletion, used to present a warning dialog to the user
      • activateLogix

        public void activateLogix()
        Activate the Logix, starts Logix processing by connecting all inputs that are included the Conditionals in this Logix.

        A Logix must be activated before it will calculate any of its Conditionals.

        Specified by:
        activateLogix in interface Logix
      • setGuiNames

        public void setGuiNames()
        ConditionalVariables only have a single name field. For user interface purposes a gui name is used for the referenced conditional user name. This is not used for other object types.

        In addition to setting the GUI name, any state variable references are changed to conditional system names. This converts the XML system/user name field to the system name for conditional references. It does not affect other objects such as sensors, turnouts, etc.

        For Entry/Exit references, replace NX user names and old style NX UUID references with the new style "IN:" + UUID reference. If the referenced NX does not exist, it will be removed from the Variable or Action list. (4.11.4)

        Called by DefaultLogixManager.activateAllLogixs()

        Specified by:
        setGuiNames in interface Logix
        Since:
        4.7.4
      • deActivateLogix

        public void deActivateLogix()
        Deactivate the Logix. This method disconnects the Logix from all input objects and stops it from being triggered to calculate.

        A Logix must be deactivated before its Conditionals are changed.

        Specified by:
        deActivateLogix in interface Logix
      • getState

        public int getState()
        Not needed for Logixs - included to complete implementation of the NamedBean interface.
        Specified by:
        getState in interface NamedBean
        Returns:
        the state
      • setState

        public void setState​(int state)
        Not needed for Logixs - included to complete implementation of the NamedBean interface.
        Specified by:
        setState in interface NamedBean
        Parameters:
        state - the state
      • dispose

        @OverridingMethodsMustInvokeSuper
        public void dispose()
        Deactivate this object, so that it releases as many resources as possible and no longer effects others.

        For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.

        It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.

        Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained.

        Specified by:
        dispose in interface NamedBean
        Overrides:
        dispose in class AbstractNamedBean