Class OlcbReporter
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractReporter
-
- jmri.implementation.AbstractIdTagReporter
-
- jmri.jmrix.openlcb.OlcbReporter
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,PropertyChangeProvider
,IdTagListener
,NamedBean
,PhysicalLocationReporter
,Reporter
public class OlcbReporter extends AbstractIdTagReporter
Implement jmri.AbstractReporter for OpenLCB protocol.- Since:
- 5.3.5
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
Nested classes/interfaces inherited from interface jmri.PhysicalLocationReporter
PhysicalLocationReporter.Direction
-
-
Field Summary
Fields Modifier and Type Field Description (package private) EventTable.EventTableEntryHolder
baseEventTableEntryHolder
(package private) int
lastLoco
-
Fields inherited from class jmri.implementation.AbstractReporter
_currentReport, _lastReport
-
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 OlcbReporter(java.lang.String prefix, java.lang.String address, OlcbInterface iface)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareSystemNameSuffix(java.lang.String suffix1, java.lang.String suffix2, NamedBean n)
Compare the suffix of this NamedBean's name with the suffix of the argument NamedBean's name for theNamedBean.compareTo(jmri.NamedBean)
operation.void
dispose()
Deactivate this object, so that it releases as many resources as possible and no longer effects others.(package private) void
finishLoad()
Helper function that will be invoked after construction once the properties have been loaded.int
getState()
State is always an integer, which is the numeric value from the last loco address that we reported, or -1 if the last update was an exit.void
setState(int s)
Provide generic access to internal state.void
setUserName(java.lang.String s)
Updates event table entries when the user name changes.-
Methods inherited from class jmri.implementation.AbstractIdTagReporter
describeState, getDirection, getLocoAddress, getPhysicalLocation, getPhysicalLocation, notify
-
Methods inherited from class jmri.implementation.AbstractReporter
getBeanType, getCurrentReport, getLastReport, setReport
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, 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, compareTo, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
baseEventTableEntryHolder
EventTable.EventTableEntryHolder baseEventTableEntryHolder
-
lastLoco
int lastLoco
-
-
Constructor Detail
-
OlcbReporter
public OlcbReporter(java.lang.String prefix, java.lang.String address, OlcbInterface iface)
-
-
Method Detail
-
finishLoad
void finishLoad()
Helper function that will be invoked after construction once the properties have been loaded. Used specifically for preventing double initialization when loading sensors from XML.
-
setUserName
@OverridingMethodsMustInvokeSuper public void setUserName(java.lang.String s) throws NamedBean.BadUserNameException
Updates event table entries when the user name changes.- Specified by:
setUserName
in interfaceNamedBean
- Overrides:
setUserName
in classAbstractNamedBean
- Parameters:
s
- new user name- Throws:
NamedBean.BadUserNameException
- seeNamedBean
-
dispose
public void dispose()
Description copied from class:AbstractNamedBean
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 interfaceNamedBean
- Overrides:
dispose
in classAbstractNamedBean
-
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 theNamedBean.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. Sorts by decoded EventID(s)- Specified by:
compareSystemNameSuffix
in interfaceNamedBean
- Overrides:
compareSystemNameSuffix
in classAbstractNamedBean
- Parameters:
suffix1
- The suffix for the 1st bean in the comparisonsuffix2
- The suffix for the 2nd bean in the comparisonn
- 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.
-
getState
public int getState()
State is always an integer, which is the numeric value from the last loco address that we reported, or -1 if the last update was an exit.
-
setState
public void setState(int s)
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.
- Specified by:
setState
in interfaceNamedBean
- Overrides:
setState
in classAbstractIdTagReporter
- Parameters:
s
- the state
-
-