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 intPERCENT_NORMALstatic intPERCENT_THROTTLEstatic intSPEED_KMPHstatic intSPEED_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 booleancheckSpeed(java.lang.String name)java.util.Enumeration<java.lang.String>getAppearanceIterator()java.lang.StringgetAppearanceSpeed(java.lang.String name)Get speed for a given signal head appearance.java.lang.StringgetAspectExitSpeed(java.lang.String aspect, SignalSystem system)java.lang.StringgetAspectSpeed(java.lang.String aspect, SignalSystem system)floatgetDefaultThrottleFactor()intgetInterpretation()floatgetLayoutScale()java.lang.StringgetNamedSpeed(float speed)floatgetSpeed(java.lang.String name)java.util.Enumeration<java.lang.String>getSpeedIterator()intgetStepDelay()floatgetStepIncrement()java.util.Vector<java.lang.String>getValidSpeedNames()voidinitialize()Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.(package private) voidloadMap()voidloadRoot(org.jdom2.Element root)voidsetAppearances(java.util.HashMap<java.lang.String,java.lang.String> map)voidsetAppearanceTable(java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iter)voidsetAspects(java.util.HashMap<java.lang.String,java.lang.Float> map, int interpretation)voidsetAspectTable(java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Float>> iter, int interpretation)voidsetDefaultThrottleFactor(float f)voidsetLayoutScale(float s)voidsetRampParams(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:InstanceManagerAutoInitializePerform any initialization that occurs after this object has been constructed and made available by the InstanceManager.- Specified by:
initializein 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()
-
-