Interface Reporter
- All Superinterfaces:
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
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringString constant for current Report.static final StringString constant for last Report.Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN -
Method Summary
Modifier and TypeMethodDescriptionQuery the current report.Query the last report.intgetState()Provide an integer form of the last report.voidSet 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, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setState, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
PROPERTY_LAST_REPORT
String constant for last Report.- See Also:
-
PROPERTY_CURRENT_REPORT
String constant for current Report.- See Also:
-
-
Method Details
-
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
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
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
-
getState
int getState()Provide an integer form of the last report.
-