Package jmri

Interface ConditionalManager

  • All Superinterfaces:
    Manager<Conditional>, PropertyChangeProvider, SilenceablePropertyChangeProvider, VetoableChangeProvider
    All Known Implementing Classes:
    DefaultConditionalManager

    public interface ConditionalManager
    extends Manager<Conditional>
    Interface for obtaining Conditionals

    This doesn't have a "new" method, since Conditionals are separately implemented, instead of being system-specific.


    This file is part of JMRI.

    JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

    JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    • Method Detail

      • dispose

        void dispose()
        Description copied from interface: Manager
        Free resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected.
        Specified by:
        dispose in interface Manager<Conditional>
      • createNewConditional

        Conditional createNewConditional​(java.lang.String systemName,
                                         java.lang.String userName)
        Method to create a new Conditional if the Conditional does not exist Returns null if a Conditional with the same systemName or userName already exists, or if there is trouble creating a new Conditional If the parent Logix cannot be found, the userName cannot be checked, but the Conditional is still created. The scenario can happen when a Logix is loaded from a file after its Conditionals.
        Parameters:
        systemName - the system name
        userName - the user name
        Returns:
        the new conditional or null if a Conditional already exists with either name
      • getParentLogix

        Logix getParentLogix​(java.lang.String name)
        Parses the Conditional system name to get the parent Logix system name, then gets the parent Logix, and returns it.
        Parameters:
        name - system name of Conditional
        Returns:
        the logix for the conditional
      • getConditional

        Conditional getConditional​(Logix x,
                                   java.lang.String name)
        Method to get an existing Conditional. First looks up assuming that name is a User Name. Note: the parent Logix must be passed in x for user name lookup. If this fails, or if x == null, looks up assuming that name is a System Name. If both fail, returns null.
        Parameters:
        x - parent Logix (may be null)
        name - name to look up
        Returns:
        null if no match found
      • getByUserName

        Conditional getByUserName​(java.lang.String s)
        Description copied from interface: Manager
        Locate an existing instance based on a user name.
        Specified by:
        getByUserName in interface Manager<Conditional>
        Parameters:
        s - System Name of the required NamedBean
        Returns:
        requested NamedBean object or null if none exists
      • getBySystemName

        Conditional getBySystemName​(java.lang.String s)
        Description copied from interface: Manager
        Locate an existing instance based on a system name.
        Specified by:
        getBySystemName in interface Manager<Conditional>
        Parameters:
        s - System Name of the required NamedBean
        Returns:
        requested NamedBean object or null if none exists
      • getSystemNameListForLogix

        java.util.List<java.lang.String> getSystemNameListForLogix​(Logix x)
        Get a list of all Conditional system names with the specified Logix parent.
        Parameters:
        x - the logix
        Returns:
        a list of Conditional system names
      • deleteConditional

        void deleteConditional​(Conditional c)
        Delete Conditional by removing it from the manager. The parent Logix must first be deactivated so it stops processing.
        Parameters:
        c - the conditional to remove
      • addWhereUsed

        void addWhereUsed​(java.lang.String target,
                          java.lang.String reference)
        Add a conditional reference to the array indicated by the target system name.
        Parameters:
        target - The system name for the target conditional
        reference - The system name of the conditional that contains the conditional reference
        Since:
        4.7.4
      • getWhereUsed

        java.util.ArrayList<java.lang.String> getWhereUsed​(java.lang.String target)
        Get a list of conditional references for the indicated conditional
        Parameters:
        target - The target conditional for a conditional reference
        Returns:
        an ArrayList or null if none
        Since:
        4.7.4
      • removeWhereUsed

        void removeWhereUsed​(java.lang.String target,
                             java.lang.String reference)
        Remove a conditional reference from the array indicated by the target system name.
        Parameters:
        target - The system name for the target conditional
        reference - The system name of the conditional that contains the conditional reference
        Since:
        4.7.4
      • displayWhereUsed

        void displayWhereUsed()
        Display the complete structure, used for debugging purposes.
        Since:
        4.7.4
      • getTargetList

        java.util.ArrayList<java.lang.String> getTargetList​(java.lang.String reference)
        Get the target system names used by this conditional
        Parameters:
        reference - The system name of the conditional the refers to other conditionals.
        Returns:
        a list of the target conditionals
        Since:
        4.7.4