- All Known Subinterfaces:
- All Known Implementing Classes:
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 or Int, both 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.
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.
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
getCurrentReport()Query the current report.
getLastReport()Query the last report.
getState()Provide an integer form of the last report.
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
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.
- the last report or null
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.
- the current report or null
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.
r- the report