Class RpsReporter

All Implemented Interfaces:
Comparable<NamedBean>, PropertyChangeProvider, MeasurementListener, NamedBean, Reporter

public class RpsReporter
extends AbstractReporter
implements MeasurementListener
RPS implementation of the Reporter interface.
Since:
2.3.1
  • Field Details

  • Constructor Details

  • Method Details

    • notify

      public void notify​(Measurement r)
      Specified by:
      notify in interface MeasurementListener
    • notifyInRegion

      void notifyInRegion​(Integer id)
    • notifyOutOfRegion

    • notifyLeaving

      void notifyLeaving​(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​(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.
      Specified by:
      getState in interface NamedBean
      Specified by:
      getState in interface Reporter
      Returns:
      the state
    • 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.

      Specified by:
      setState in interface NamedBean
      Parameters:
      i - the state
    • dispose

      public void dispose()
      Description copied from interface: NamedBean
      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 interface NamedBean
      Overrides:
      dispose in class AbstractNamedBean
    • getLocoAddress

      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

      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

      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

      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.