Class DefaultIdTag
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractIdTag
-
- jmri.implementation.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 theIdTag
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROPERTY_WHEN_LAST_SEEN
static java.lang.String
PROPERTY_WHERE_LAST_SEEN
-
Fields inherited from class jmri.implementation.AbstractIdTag
prefix, whenLastSeen, whereLastSeen
-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description DefaultIdTag(java.lang.String systemName)
DefaultIdTag(java.lang.String systemName, java.lang.String userName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(NamedBean n2)
Provide a comparison between the system names of two beans.int
getState()
Provide generic access to internal state.void
load(org.jdom2.Element e)
Load an idtag xml element.void
setState(int s)
Provide generic access to internal state.void
setWhereLastSeen(Reporter r)
Set the Reporter that last saw this tag.org.jdom2.Element
store(boolean storeState)
Store the contents of this IdTag object as an XML element-
Methods inherited from class jmri.implementation.AbstractIdTag
getBeanType, getTagID, getWhenLastSeen, getWhereLastSeen, toReportString
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, dispose, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, toStringSuffix, updateListenerRef, vetoableChange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, dispose, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
PROPERTY_WHEN_LAST_SEEN
public static final java.lang.String PROPERTY_WHEN_LAST_SEEN
- See Also:
- Constant Field Values
-
PROPERTY_WHERE_LAST_SEEN
public static final java.lang.String PROPERTY_WHERE_LAST_SEEN
- See Also:
- Constant Field Values
-
-
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 theNamedBean.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.
-
setWhereLastSeen
public final void setWhereLastSeen(@CheckForNull Reporter r)
Description copied from interface:IdTag
Set the Reporter that last saw this tag.Also sets the Date/Time when last seen
- Parameters:
r
- Reporter object where last seen- See Also:
IdTag.getWhereLastSeen()
,IdTag.getWhenLastSeen()
-
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 org.jdom2.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(org.jdom2.Element e)
Load an idtag xml element. whenLastSeen formats accepted JMRI 5.3.6 include yyyy-MM-dd'T'HH:mm:ss.SSSX yyyy-MM-dd'T'HH:mm:ss.SSS EEE, dd MMM yyyy HH:mm:ss zzz- Parameters:
e
- element to load.
-
-