Class TimeoutReporter
- All Implemented Interfaces:
PropertyChangeListener,Comparable<NamedBean>,EventListener,PropertyChangeProvider,IdTagListener,NamedBean,Reporter
This decorator causes the current report to be reset to nullified after a preset time period. This is to be used for reporter hardware that reports a value, but never reports the value is cleared (e.g. most RFID readers).
This file is part of JMRI.
based on TimeoutRfidReporter originally implemented by Matthew Harris
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. Based
- Since:
- 4.19.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 inherited from class jmri.implementation.decorators.AbstractNamedBeanDecorator
listenerRefs, registerFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWNFields inherited from interface jmri.Reporter
PROPERTY_CURRENT_REPORT, PROPERTY_LAST_REPORT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.Query the current report.Query the last report.intgetState()Provide an integer form of the last report.voidvoidIntercepts property change events from the underlying reporter and forwards them to property change listeners for this reporter.voidSet the report to an arbitrary object.voidsetState(int i) Provide generic access to internal state.Methods inherited from class jmri.implementation.decorators.AbstractNamedBeanDecorator
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, equals, firePropertyChange, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Constructor Details
-
TimeoutReporter
-
-
Method Details
-
getLastReport
Description copied from interface:ReporterQuery 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.- Specified by:
getLastReportin interfaceReporter- Returns:
- the last report or null
-
getCurrentReport
Description copied from interface:ReporterQuery 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.- Specified by:
getCurrentReportin interfaceReporter- Returns:
- the current report or null
-
setReport
Description copied from interface:ReporterSet 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.
-
getState
Description copied from interface:ReporterProvide an integer form of the last report. -
dispose
Description copied from interface:NamedBeanDeactivate 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:
disposein interfaceNamedBean- Overrides:
disposein classAbstractNamedBeanDecorator
-
setState
Description copied from interface:NamedBeanProvide 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:
setStatein interfaceNamedBean- Parameters:
i- the state- Throws:
JmriException- general error when setting the state fails
-
notify
- Specified by:
notifyin interfaceIdTagListener
-
propertyChange
Intercepts property change events from the underlying reporter and forwards them to property change listeners for this reporter.- Specified by:
propertyChangein interfacePropertyChangeListener
-