Class DefaultIdTag

  • All Implemented Interfaces:
    java.lang.Comparable<NamedBean>, PropertyChangeProvider, IdTag, NamedBean, Reportable
    Direct Known Subclasses:
    DefaultRailCom, TranspondingTag

    public class DefaultIdTag
    extends AbstractIdTag
    Concrete implementation of the IdTag interface for the Internal system.
    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.

    Since:
    2.11.4
    • Constructor Detail

      • DefaultIdTag

        public DefaultIdTag​(java.lang.String systemName)
      • DefaultIdTag

        public DefaultIdTag​(java.lang.String systemName,
                            java.lang.String userName)
    • Method Detail

      • compareTo

        public int compareTo​(NamedBean n2)
        Description copied from interface: NamedBean
        Provide a comparison between the system names of two beans. This provides a implementation for e.g. Comparator. Returns 0 if the names are the same, -1 if the first argument orders before the second argument's name, +1 if the first argument's name orders after the second argument's name. The comparison is alphanumeric on the system prefix, then alphabetic on the type letter, then system-specific comparison on the two suffix parts via the NamedBean.compareSystemNameSuffix(java.lang.String, java.lang.String, jmri.NamedBean) method.
        Parameters:
        n2 - The second NamedBean in the comparison ("this" is the first one)
        Returns:
        -1,0,+1 for ordering if the names are well-formed; may not provide proper ordering if the names are not well-formed.
      • setState

        public void setState​(int s)
                      throws JmriException
        Description copied from interface: NamedBean
        Provide generic access to internal state.

        This generally shouldn't be used by Java code; use the class-specific form instead (e.g. setCommandedState in Turnout). This is provided to make scripts access easier to read.

        Parameters:
        s - the state
        Throws:
        JmriException - general error when setting the state fails
      • getState

        public int getState()
        Description copied from interface: NamedBean
        Provide generic access to internal state.

        This generally shouldn't be used by Java code; use the class-specific form instead (e.g. getCommandedState in Turnout). This is provided to make scripts easier to read.

        Returns:
        the state
      • store

        public Element store​(boolean storeState)
        Description copied from interface: IdTag
        Store the contents of this IdTag object as an XML element
        Parameters:
        storeState - Determine if the state of this IdTag should be stored
        Returns:
        Element with IdTag contents
      • load

        public void load​(Element e)
        Description copied from interface: IdTag
        Load contents of IdTag object from an XML element
        Parameters:
        e - Element containing IdTag details