Package jmri.implementation
Class SignalSpeedMap
- java.lang.Object
-
- jmri.beans.UnboundBean
-
- jmri.beans.Bean
-
- jmri.implementation.SignalSpeedMap
-
- All Implemented Interfaces:
BeanInterface
,PropertyChangeFirer
,PropertyChangeProvider
,InstanceManagerAutoDefault
,InstanceManagerAutoInitialize
public class SignalSpeedMap extends Bean implements InstanceManagerAutoDefault, InstanceManagerAutoInitialize
Default implementation to map Signal aspects or appearances to speed requirements.The singleton instance is referenced from the InstanceManager by SignalHeads and SignalMasts
-
-
Field Summary
Fields Modifier and Type Field Description static int
PERCENT_NORMAL
static int
PERCENT_THROTTLE
static int
SPEED_KMPH
static int
SPEED_MPH
-
Fields inherited from class jmri.beans.Bean
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description SignalSpeedMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkSpeed(java.lang.String name)
java.util.Enumeration<java.lang.String>
getAppearanceIterator()
java.lang.String
getAppearanceSpeed(java.lang.String name)
Get speed for a given signal head appearance.java.lang.String
getAspectExitSpeed(java.lang.String aspect, SignalSystem system)
java.lang.String
getAspectSpeed(java.lang.String aspect, SignalSystem system)
float
getDefaultThrottleFactor()
int
getInterpretation()
float
getLayoutScale()
java.lang.String
getNamedSpeed(float speed)
float
getSpeed(java.lang.String name)
java.util.Enumeration<java.lang.String>
getSpeedIterator()
int
getStepDelay()
float
getStepIncrement()
java.util.Vector<java.lang.String>
getValidSpeedNames()
void
initialize()
Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.(package private) void
loadMap()
void
loadRoot(org.jdom2.Element root)
void
setAppearances(java.util.HashMap<java.lang.String,java.lang.String> map)
void
setAppearanceTable(java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iter)
void
setAspects(java.util.HashMap<java.lang.String,java.lang.Float> map, int interpretation)
void
setAspectTable(java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Float>> iter, int interpretation)
void
setDefaultThrottleFactor(float f)
void
setLayoutScale(float s)
void
setRampParams(float throttleIncr, int msIncrTime)
-
Methods inherited from class jmri.beans.Bean
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, isNotifyOnEDT, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class jmri.beans.UnboundBean
getIndexedProperty, getProperty, getPropertyNames, hasIndexedProperty, hasProperty, setIndexedProperty, setProperty
-
-
-
-
Field Detail
-
PERCENT_NORMAL
public static final int PERCENT_NORMAL
- See Also:
- Constant Field Values
-
PERCENT_THROTTLE
public static final int PERCENT_THROTTLE
- See Also:
- Constant Field Values
-
SPEED_MPH
public static final int SPEED_MPH
- See Also:
- Constant Field Values
-
SPEED_KMPH
public static final int SPEED_KMPH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SignalSpeedMap
public SignalSpeedMap()
-
-
Method Detail
-
initialize
public void initialize()
Description copied from interface:InstanceManagerAutoInitialize
Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.- Specified by:
initialize
in interfaceInstanceManagerAutoInitialize
-
loadMap
void loadMap()
-
checkSpeed
public boolean checkSpeed(java.lang.String name)
-
getAspectSpeed
public java.lang.String getAspectSpeed(@Nonnull java.lang.String aspect, @Nonnull SignalSystem system)
- Parameters:
aspect
- appearance (not called head in US) to checksystem
- system name of head- Returns:
- speed from SignalMast Aspect name
-
getAspectExitSpeed
public java.lang.String getAspectExitSpeed(@Nonnull java.lang.String aspect, @Nonnull SignalSystem system)
- Parameters:
aspect
- appearance (not called head in US) to checksystem
- system name of head- Returns:
- speed2 from SignalMast Aspect name
-
getAppearanceSpeed
public java.lang.String getAppearanceSpeed(@Nonnull java.lang.String name)
Get speed for a given signal head appearance.- Parameters:
name
- appearance default name- Returns:
- speed from SignalHead Appearance name
-
getAppearanceIterator
public java.util.Enumeration<java.lang.String> getAppearanceIterator()
-
getSpeedIterator
public java.util.Enumeration<java.lang.String> getSpeedIterator()
-
getValidSpeedNames
public java.util.Vector<java.lang.String> getValidSpeedNames()
-
getSpeed
public float getSpeed(@Nonnull java.lang.String name) throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
-
getNamedSpeed
public java.lang.String getNamedSpeed(float speed)
-
getInterpretation
public int getInterpretation()
-
getStepDelay
public int getStepDelay()
-
getStepIncrement
public float getStepIncrement()
-
setAspects
public void setAspects(@Nonnull java.util.HashMap<java.lang.String,java.lang.Float> map, int interpretation)
-
setAspectTable
public void setAspectTable(@Nonnull java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Float>> iter, int interpretation)
-
setAppearances
public void setAppearances(@Nonnull java.util.HashMap<java.lang.String,java.lang.String> map)
-
setAppearanceTable
public void setAppearanceTable(@Nonnull java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iter)
-
setRampParams
public void setRampParams(float throttleIncr, int msIncrTime)
-
setDefaultThrottleFactor
public void setDefaultThrottleFactor(float f)
-
getDefaultThrottleFactor
public float getDefaultThrottleFactor()
-
setLayoutScale
public void setLayoutScale(float s)
-
getLayoutScale
public float getLayoutScale()
-
-