Package jmri.jmrix.rps
Class RpsBlock
- java.lang.Object
-
- jmri.jmrix.rps.RpsBlock
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.util.EventListener
,ThrottleListener
public class RpsBlock extends java.lang.Object implements java.beans.PropertyChangeListener, ThrottleListener
Create a Block that can control a locomotive within a specific Block based on an RpsSensor. It sets speed based on aspect of a specific signal.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.ThrottleListener
ThrottleListener.DecisionType
-
-
Field Summary
Fields Modifier and Type Field Description (package private) float
fast
(package private) RpsSensor
sensor
(package private) SignalHead
signal
(package private) float
slow
(package private) static java.util.Hashtable<java.lang.Integer,DccThrottle>
throttleTable
-
Constructor Summary
Constructors Constructor Description RpsBlock(java.lang.String sensorname, java.lang.String signalname, float slow, float fast)
RpsBlock(RpsSensor sensor, SignalHead signal, float slow, float fast)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
acquireThrottle(java.lang.Integer num)
(package private) void
appearance()
(package private) void
arriving(java.lang.Integer number)
void
dispose()
(package private) void
handleParameterChange(java.lang.String property, java.lang.Object oldState, java.lang.Object newState, java.lang.Object source)
(package private) void
leaving(java.lang.Integer number)
void
notifyDecisionRequired(LocoAddress address, ThrottleListener.DecisionType question)
No steal or share decisions made locallyvoid
notifyFailedThrottleRequest(LocoAddress address, java.lang.String reason)
Get notification that an attempt to request a throttle has failed.void
notifyThrottleFound(DccThrottle t)
Get notification that a throttle has been found as requested.void
propertyChange(java.beans.PropertyChangeEvent e)
(package private) void
updateCurrentThrottles()
(package private) void
updateOneThrottle(DccThrottle t)
-
-
-
Field Detail
-
slow
float slow
-
fast
float fast
-
signal
SignalHead signal
-
throttleTable
static java.util.Hashtable<java.lang.Integer,DccThrottle> throttleTable
-
-
Constructor Detail
-
RpsBlock
public RpsBlock(RpsSensor sensor, SignalHead signal, float slow, float fast)
-
RpsBlock
public RpsBlock(java.lang.String sensorname, java.lang.String signalname, float slow, float fast)
-
-
Method Detail
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
handleParameterChange
void handleParameterChange(java.lang.String property, java.lang.Object oldState, java.lang.Object newState, java.lang.Object source)
-
arriving
void arriving(java.lang.Integer number)
-
leaving
void leaving(java.lang.Integer number)
-
appearance
void appearance()
-
acquireThrottle
void acquireThrottle(java.lang.Integer num)
-
notifyThrottleFound
public void notifyThrottleFound(DccThrottle t)
Description copied from interface:ThrottleListener
Get notification that a throttle has been found as requested.- Specified by:
notifyThrottleFound
in interfaceThrottleListener
- Parameters:
t
- the throttle with the requested address
-
notifyFailedThrottleRequest
public void notifyFailedThrottleRequest(LocoAddress address, java.lang.String reason)
Description copied from interface:ThrottleListener
Get notification that an attempt to request a throttle has failed.- Specified by:
notifyFailedThrottleRequest
in interfaceThrottleListener
- Parameters:
address
- address of the failed requestreason
- failure cause
-
notifyDecisionRequired
public void notifyDecisionRequired(LocoAddress address, ThrottleListener.DecisionType question)
No steal or share decisions made locallyGet notification that a throttle request is in use by another device, and a "steal", "share", or "steal/share" decision may be required.
- Specified by:
notifyDecisionRequired
in interfaceThrottleListener
- Parameters:
address
- The LocoAddress that needs the decision.question
- The question being asked, steal / cancel, share / cancel, steal / share / cancel
-
updateCurrentThrottles
void updateCurrentThrottles()
-
updateOneThrottle
void updateOneThrottle(DccThrottle t)
-
dispose
public void dispose()
-
-