Interface Reporter
-
- All Superinterfaces:
java.lang.Comparable<NamedBean>
,NamedBean
,PropertyChangeProvider
- All Known Subinterfaces:
CollectingReporter
- All Known Implementing Classes:
AbstractIdTagReporter
,AbstractRailComReporter
,AbstractReporter
,BiDiBReporter
,CbusReporter
,Dcc4PcReporter
,EcosReporter
,JMRIClientReporter
,LnReporter
,MqttReporter
,OlcbReporter
,RfidReporter
,RpsReporter
,TimeoutReporter
,TrackReporter
,Z21CanReporter
,Z21Reporter
public interface Reporter extends NamedBean
Represent a device that can report identification information.Reporting devices might include:
- A DCC device that reports a locomotive number when it's in a particular location
- A device that reports something about the layout environment, e.g. the current drawn or light intensity
- A device that reacts to some happening on the layout with a complicated report
In contrast to Sensors, a Reporter provides more detailed information. A Sensor provides a status of ACTIVE or INACTIVE, while a Reporter returns an Object. The real type of that object can be whatever a particular Reporter finds useful to report. Typical values might be a String, Int, or
IdTag
, all of which can be displayed, printed, equated, etc.A Reporter might also not be able to report all the time. The previous value remains available, but it's also possible to distinguish this case by using the getCurrentReport member function.
The various implementations of the Reporter interface:
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.
- See Also:
Sensor
,ReporterManager
,InstanceManager
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
getCurrentReport()
Query the current report.java.lang.Object
getLastReport()
Query the last report.int
getState()
Provide an integer form of the last report.void
setReport(java.lang.Object r)
Set the report to an arbitrary object.-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, dispose, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setState, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Method Detail
-
getLastReport
java.lang.Object getLastReport()
Query the last report. This will return a value even if there's no current report available. If there is a current report, both this and the current report will be equal. If nothing has ever been reported, this will return a null object.- Returns:
- the last report or null
-
getCurrentReport
java.lang.Object getCurrentReport()
Query the current report. If there is no current report available (e.g. the reporting hardware says no information is currently available) this will return a null object.- Returns:
- the current report or null
-
setReport
void setReport(java.lang.Object r)
Set the report to an arbitrary object.A Reporter object will usually just "report"; its contents usually come from the layout, and hence are only set by lower-level implementation classes. But there are occasionally reasons to set it from inside the program, e.g. debugging via entering values in the Reporter Table. Hence provision of this method.
- Parameters:
r
- the report
-
-