Class RpsReporter
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractReporter
-
- jmri.jmrix.rps.RpsReporter
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,PropertyChangeProvider
,MeasurementListener
,NamedBean
,Reporter
public class RpsReporter extends AbstractReporter implements MeasurementListener
RPS implementation of the Reporter interface.- Since:
- 2.3.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.ArrayList<java.lang.Integer>
contents
(package private) Region
region
-
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 RpsReporter(java.lang.String systemName, java.lang.String prefix)
RpsReporter(java.lang.String systemName, java.lang.String userName, java.lang.String prefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Deactivate this object, so that it releases as many resources as possible and no longer effects others.PhysicalLocationReporter.Direction
getDirection(java.lang.String rep)
Get the direction (ENTER/EXIT) of the report.LocoAddress
getLocoAddress(java.lang.String rep)
Parses out a (possibly old) RpsReporter-generated report string to extract the address from the front.PhysicalLocation
getPhysicalLocation()
Get the PhysicalLocation of the Reporter.PhysicalLocation
getPhysicalLocation(java.lang.String s)
Get the PhysicalLocation of the Transmitter for a given ID.int
getState()
Numerical state is the number of transmitters in the region.void
notify(Measurement r)
(package private) void
notifyArriving(java.lang.Integer id)
Notify parameter listeners that a device has entered the region covered by this reporter.(package private) void
notifyInRegion(java.lang.Integer id)
(package private) void
notifyLeaving(java.lang.Integer id)
Notify parameter listeners that a device has left the region covered by this reporter.(package private) void
notifyOutOfRegion(java.lang.Integer id)
void
setState(int i)
Provide generic access to internal state.-
Methods inherited from class jmri.implementation.AbstractReporter
getBeanType, getCurrentReport, getLastReport, setReport
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, 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, compareSystemNameSuffix, compareTo, describeState, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
RpsReporter
public RpsReporter(java.lang.String systemName, java.lang.String prefix)
-
RpsReporter
public RpsReporter(java.lang.String systemName, java.lang.String userName, java.lang.String prefix)
-
-
Method Detail
-
notify
public void notify(Measurement r)
- Specified by:
notify
in interfaceMeasurementListener
-
notifyInRegion
void notifyInRegion(java.lang.Integer id)
-
notifyOutOfRegion
void notifyOutOfRegion(java.lang.Integer id)
-
notifyLeaving
void notifyLeaving(java.lang.Integer id)
Notify parameter listeners that a device has left the region covered by this reporter.- Parameters:
id
- Number of region being left
-
notifyArriving
void notifyArriving(java.lang.Integer id)
Notify parameter listeners that a device has entered the region covered by this reporter.- Parameters:
id
- Number of region being entered
-
getState
public int getState()
Numerical state is the number of transmitters in the region.
-
setState
public void setState(int i)
Description copied from interface:NamedBean
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.
-
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
-
getLocoAddress
public LocoAddress getLocoAddress(java.lang.String rep)
Parses out a (possibly old) RpsReporter-generated report string to extract the address from the front. Assumes the RpsReporter format is "NNNN".- Parameters:
rep
- loco string.- Returns:
- loco address, may be null.
-
getDirection
public PhysicalLocationReporter.Direction getDirection(java.lang.String rep)
Get the direction (ENTER/EXIT) of the report.Because of the way Ecos Reporters work (or appear to), all reports are ENTER type.
- Parameters:
rep
- reporter ID in string form.- Returns:
- direction is always a location entrance
-
getPhysicalLocation
public PhysicalLocation getPhysicalLocation()
Get the PhysicalLocation of the Reporter.Reports its own location, for now. Not sure if that's the right thing or not. Would be nice if it reported the exact measured location of the transmitter, but right now that doesn't appear to be being stored anywhere retrievable. NOT DONE YET
- Returns:
- PhysicalLocation.getBeanPhysicalLocation
-
getPhysicalLocation
public PhysicalLocation getPhysicalLocation(java.lang.String s)
Get the PhysicalLocation of the Transmitter for a given ID.Given an ID (in String form), looks up the Transmitter and gets its current PhysicalLocation (translated from the RPS Measurement).
- Parameters:
s
- transmitter ID.- Returns:
- physical location.
-
-