Class DefaultSignalSystem
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.DefaultSignalSystem
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,PropertyChangeProvider
,NamedBean
,SignalSystem
public class DefaultSignalSystem extends AbstractNamedBean implements SignalSystem
Default implementation of a basic signal system definition.The default contents are taken from the NamedBeanBundle properties file. This makes creation a little more heavy-weight, but speeds operation.
-
-
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 protected java.util.HashMap<java.lang.String,java.util.Hashtable<java.lang.String,java.lang.Object>>
aspects
protected java.util.Vector<java.lang.String>
imageTypes
protected java.util.Vector<java.lang.String>
keys
(package private) float
maximumLineSpeed
-
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 DefaultSignalSystem(java.lang.String systemName)
DefaultSignalSystem(java.lang.String systemName, java.lang.String userName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkAspect(java.lang.String aspect)
Is this aspect known?java.lang.String
getAspect(java.lang.Object obj, java.lang.String key)
java.util.Enumeration<java.lang.String>
getAspects()
Get all aspects currently defined.java.lang.String
getBeanType()
For instances in the code where we are dealing with just a bean and a message needs to be passed to the user or in a log.java.util.Enumeration<java.lang.String>
getImageTypeList()
Returns a list of the image/icon sets available for use with this signaling system.java.util.Enumeration<java.lang.String>
getKeys()
Get all keys currently defined on any aspect.float
getMaximumLineSpeed()
java.lang.Object
getProperty(java.lang.String aspect, java.lang.String key)
int
getState()
Provide generic access to internal state.protected java.util.Hashtable<java.lang.String,java.lang.Object>
getTable(java.lang.String aspect)
void
loadDefaults()
void
setImageType(java.lang.String type)
Add an image or icon type available for use with this signaling system.void
setProperty(java.lang.String aspect, java.lang.String key, java.lang.Object value)
void
setState(int s)
Provide generic access to internal state.java.lang.String
summary()
Provide a multi-line summary of the signal system content, typically for printing.-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, dispose, 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, dispose, 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
-
-
-
-
Field Detail
-
maximumLineSpeed
float maximumLineSpeed
-
aspects
protected java.util.HashMap<java.lang.String,java.util.Hashtable<java.lang.String,java.lang.Object>> aspects
-
keys
protected java.util.Vector<java.lang.String> keys
-
imageTypes
protected java.util.Vector<java.lang.String> imageTypes
-
-
Constructor Detail
-
DefaultSignalSystem
public DefaultSignalSystem(java.lang.String systemName, java.lang.String userName)
-
DefaultSignalSystem
public DefaultSignalSystem(java.lang.String systemName)
-
-
Method Detail
-
setProperty
public void setProperty(java.lang.String aspect, java.lang.String key, java.lang.Object value)
- Specified by:
setProperty
in interfaceSignalSystem
-
getProperty
public java.lang.Object getProperty(java.lang.String aspect, java.lang.String key)
- Specified by:
getProperty
in interfaceSignalSystem
-
setImageType
public void setImageType(java.lang.String type)
Description copied from interface:SignalSystem
Add an image or icon type available for use with this signaling system.- Specified by:
setImageType
in interfaceSignalSystem
- Parameters:
type
- the image type
-
getImageTypeList
public java.util.Enumeration<java.lang.String> getImageTypeList()
Description copied from interface:SignalSystem
Returns a list of the image/icon sets available for use with this signaling system.- Specified by:
getImageTypeList
in interfaceSignalSystem
- Returns:
- all image types or an empty list
-
getAspect
public java.lang.String getAspect(java.lang.Object obj, java.lang.String key)
- Specified by:
getAspect
in interfaceSignalSystem
-
getTable
protected java.util.Hashtable<java.lang.String,java.lang.Object> getTable(java.lang.String aspect)
-
getAspects
public java.util.Enumeration<java.lang.String> getAspects()
Description copied from interface:SignalSystem
Get all aspects currently defined.- Specified by:
getAspects
in interfaceSignalSystem
- Returns:
- all aspects or an empty list
-
getKeys
public java.util.Enumeration<java.lang.String> getKeys()
Description copied from interface:SignalSystem
Get all keys currently defined on any aspect.Each key only appears once, even if used on more than one aspect.
Note that a given key may or may not appear on a given aspect.
- Specified by:
getKeys
in interfaceSignalSystem
- Returns:
- all keys or an empty list
-
checkAspect
public boolean checkAspect(java.lang.String aspect)
Description copied from interface:SignalSystem
Is this aspect known?- Specified by:
checkAspect
in interfaceSignalSystem
- Parameters:
aspect
- the aspect to check- Returns:
- true if known; false otherwise
-
loadDefaults
public void loadDefaults()
-
getState
public int getState()
Provide generic access to internal state.This generally shouldn't be used by Java code; use the class-specific form instead (e.g. getCommandedState in Turnout). This is provided to make scripts easier to read. This method returns a constant result on the DefaultSignalSystem.
- Specified by:
getState
in interfaceNamedBean
- Returns:
NamedBean.INCONSISTENT
-
setState
public void setState(int s)
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. This method has no effect on the DefaultSignalSystem.
-
getMaximumLineSpeed
public float getMaximumLineSpeed()
- Specified by:
getMaximumLineSpeed
in interfaceSignalSystem
-
getBeanType
public java.lang.String getBeanType()
Description copied from interface:NamedBean
For instances in the code where we are dealing with just a bean and a message needs to be passed to the user or in a log.- Specified by:
getBeanType
in interfaceNamedBean
- Returns:
- a string of the bean type, eg Turnout, Sensor etc
-
summary
public java.lang.String summary()
Description copied from interface:SignalSystem
Provide a multi-line summary of the signal system content, typically for printing.Not intended for further parsing, i.e. for persistance, as format likely to differ from type to type, and to change often.
- Specified by:
summary
in interfaceSignalSystem
- Returns:
- summary string.
-
-