Class AbstractBase

    • Method Detail

      • getChild

        public FemaleSocket getChild​(int index)
                              throws java.lang.IllegalArgumentException,
                                     java.lang.UnsupportedOperationException
        Get a child of this item
        Specified by:
        getChild in interface Base
        Parameters:
        index - the index of the child to get
        Returns:
        the child
        Throws:
        java.lang.IllegalArgumentException - if the index is less than 0 or greater or equal with the value returned by getChildCount()
        java.lang.UnsupportedOperationException
      • getChildCount

        public int getChildCount()
        Get the number of children.
        Specified by:
        getChildCount in interface Base
        Returns:
        the number of children
      • deepCopyChildren

        public Base deepCopyChildren​(Base original,
                                     java.util.Map<java.lang.String,​java.lang.String> systemNames,
                                     java.util.Map<java.lang.String,​java.lang.String> userNames)
                              throws JmriException
        Do a deep copy of children from the original to me.
        Specified by:
        deepCopyChildren in interface Base
        Parameters:
        original - the item to copy from
        systemNames - a map of old and new system name
        userNames - a map of old system name and new user name
        Returns:
        myself
        Throws:
        JmriException - in case of an error
      • getLogixNG

        public final LogixNG getLogixNG()
        Get the LogixNG of this item.
        Specified by:
        getLogixNG in interface Base
        Returns:
        the LogixNG that owns this item
      • getRoot

        public final Base getRoot()
        Get the root of the tree that this item belongs to.
        Specified by:
        getRoot in interface Base
        Returns:
        the top most item in the tree
      • setParentForAllChildren

        public final boolean setParentForAllChildren​(java.util.List<java.lang.String> errors)
        Set the parent for all the children.
        Specified by:
        setParentForAllChildren in interface Base
        Parameters:
        errors - a list of potential errors
        Returns:
        true if success, false otherwise
      • registerListenersForThisClass

        protected void registerListenersForThisClass()
        Register listeners if this object needs that.

        Important: This method may be called more than once. Methods overriding this method must ensure that listeners are not registered more than once.

      • unregisterListenersForThisClass

        protected void unregisterListenersForThisClass()
        Unregister listeners if this object needs that.

        Important: This method may be called more than once. Methods overriding this method must ensure that listeners are not unregistered more than once.

      • registerListeners

        public final void registerListeners()
        Register listeners if this object needs that.

        Important: This method may be called more than once. Methods overriding this method must ensure that listeners are not registered more than once.

        Specified by:
        registerListeners in interface Base
      • unregisterListeners

        public final void unregisterListeners()
        Unregister listeners if this object needs that.

        Important: This method may be called more than once. Methods overriding this method must ensure that listeners are not unregistered more than once.

        Specified by:
        unregisterListeners in interface Base
      • isActive

        public final boolean isActive()
        Is this item active? If this item is enabled and all the parents are enabled, this item is active.
        Specified by:
        isActive in interface Base
        Returns:
        true if active, false otherwise.
      • printTree

        public void printTree​(Base.PrintTreeSettings settings,
                              java.io.PrintWriter writer,
                              java.lang.String indent,
                              MutableInt lineNumber)
        Print the tree to a stream.
        Specified by:
        printTree in interface Base
        Parameters:
        settings - settings for what to print
        writer - the stream to print the tree to
        indent - the indentation of each level
        lineNumber - the line number
      • printTree

        public void printTree​(Base.PrintTreeSettings settings,
                              java.util.Locale locale,
                              java.io.PrintWriter writer,
                              java.lang.String indent,
                              MutableInt lineNumber)
        Print the tree to a stream.
        Specified by:
        printTree in interface Base
        Parameters:
        settings - settings for what to print
        locale - The locale to be used
        writer - the stream to print the tree to
        indent - the indentation of each level
        lineNumber - the line number
      • printTree

        public void printTree​(Base.PrintTreeSettings settings,
                              java.util.Locale locale,
                              java.io.PrintWriter writer,
                              java.lang.String indent,
                              java.lang.String currentIndent,
                              MutableInt lineNumber)
        Print the tree to a stream.
        Specified by:
        printTree in interface Base
        Parameters:
        settings - settings for what to print
        locale - The locale to be used
        writer - the stream to print the tree to
        indent - the indentation of each level
        currentIndent - the current indentation
        lineNumber - the line number
      • getUsageTree

        public void getUsageTree​(int level,
                                 NamedBean bean,
                                 java.util.List<NamedBeanUsageReport> report,
                                 NamedBean cdl)
        Navigate the LogixNG tree.
        Specified by:
        getUsageTree in interface Base
        Parameters:
        level - The current recursion level for debugging.
        bean - The named bean that is the object of the search.
        report - A list of NamedBeanUsageReport usage reports.
        cdl - The current ConditionalNG bean. Null for Module searches since there is no conditional
      • getUsageDetail

        public void getUsageDetail​(int level,
                                   NamedBean bean,
                                   java.util.List<NamedBeanUsageReport> report,
                                   NamedBean cdl)
        Add a new NamedBeanUsageReport to the report list if there are any matches in this action or expresssion.

        NamedBeanUsageReport Usage keys:

        • LogixNGAction
        • LogixNGExpression
        Specified by:
        getUsageDetail in interface Base
        Parameters:
        level - The current recursion level for debugging.
        bean - The named bean that is the object of the search.
        report - A list of NamedBeanUsageReport usage reports.
        cdl - The current ConditionalNG bean. Null for Module searches since there is no conditional
      • compareSystemNameSuffix

        @CheckReturnValue
        public int compareSystemNameSuffix​(@Nonnull
                                           java.lang.String suffix1,
                                           @Nonnull
                                           java.lang.String suffix2,
                                           @Nonnull
                                           NamedBean n)
        Compare the suffix of this NamedBean's name with the suffix of the argument NamedBean's name for the NamedBean.compareTo(jmri.NamedBean) operation. This is intended to be a system-specific comparison that understands the various formats, etc. By default, does an alphanumeric-by-chunks comparison. Do a string comparison.
        Specified by:
        compareSystemNameSuffix in interface NamedBean
        Overrides:
        compareSystemNameSuffix in class AbstractNamedBean
        Parameters:
        suffix1 - The suffix for the 1st bean in the comparison
        suffix2 - The suffix for the 2nd bean in the comparison
        n - The other (second) NamedBean in the comparison
        Returns:
        -1,0,+1 for ordering if the names are well-formed; may not provide proper ordering if the names are not well-formed.
      • disposeMe

        protected void disposeMe()
        Dispose this class. Listeners do not need to be unregistered by this method since they are unregistered by dispose().
      • dispose

        public final 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 Base
        Specified by:
        dispose in interface NamedBean
        Overrides:
        dispose in class AbstractNamedBean