Package jmri.implementation
Class AbstractSignalMast
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractSignalMast
-
- All Implemented Interfaces:
java.beans.VetoableChangeListener,java.lang.Comparable<NamedBean>,java.util.EventListener,PropertyChangeProvider,NamedBean,Signal,SignalMast
- Direct Known Subclasses:
BiDiBSignalMast,DccSignalMast,MatrixSignalMast,MqttSignalMast,OlcbSignalMast,SignalHeadSignalMast,TurnoutSignalMast,VirtualSignalMast
public abstract class AbstractSignalMast extends AbstractNamedBean implements SignalMast, java.beans.VetoableChangeListener
Abstract class providing the basic logic of the SignalMast interface.
-
-
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.lang.Stringaspectprotected java.util.ArrayList<java.lang.String>disabledAspects(package private) booleandisablePermissiveSignalMastLogicprotected DefaultSignalAppearanceMapmap(package private) java.lang.StringmastTypeprotected java.lang.Stringspeed(package private) SignalSystemsystemDefn-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN
-
Fields inherited from interface jmri.Signal
PROPERTY_HELD, PROPERTY_LIT
-
Fields inherited from interface jmri.SignalMast
PROPERTY_ASPECT, PROPERTY_ASPECT_DISABLED, PROPERTY_ASPECT_ENABLED, PROPERTY_PERMISSIVE_SML_DISABLED
-
-
Constructor Summary
Constructors Constructor Description AbstractSignalMast(java.lang.String systemName)AbstractSignalMast(java.lang.String systemName, java.lang.String userName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowUnLit()protected voidconfigureAspectTable(java.lang.String signalSystemName, java.lang.String aspectMapName)protected voidconfigureSignalSystemDefinition(java.lang.String name)java.util.Vector<java.lang.String>getAllKnownAspects()Get a list of all the known aspects for this mast, including those that have been disabled.SignalAppearanceMapgetAppearanceMap()java.lang.StringgetAspect()Get current aspect name.java.lang.StringgetBeanType()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.List<java.lang.String>getDisabledAspects()booleangetHeld()"Held" property is just tracked and notified.booleangetLit()Default behavior for "lit" property is to track value and return it.java.lang.StringgetMastType()Get the specific mast type for this mast.SignalSystemgetSignalSystem()java.lang.StringgetSpeed()intgetState()The state is the index of the current aspect in the list of possible aspects.java.util.List<NamedBeanUsageReport>getUsageReport(NamedBean bean)Get a list of references for the specified bean.java.util.Vector<java.lang.String>getValidAspects()Get an alphabetically sorted list of valid aspects that have not been disabled.booleanisAspectDisabled(java.lang.String aspect)booleanisAtStop()Determine whether this signal shows an aspect or appearance that forbid travel past it.booleanisCleared()Determine whether this signal shows an aspect or appearance that allows travel past it, e.g. it's "been cleared".booleanisPermissiveSmlDisabled()Determine if the permissive SML logic should be disabled.booleanisShowingRestricting()Determine whether this signal shows an aspect or appearance that allows travel past it only at restricted speed.voidsetAllowUnLit(boolean boo)Sets whether the Signal Mast is allowed or configured to show an unlit aspect, or if it is always lit.voidsetAspect(java.lang.String aspect)Set aspect to a valid name in the current signal system definition.voidsetAspectDisabled(java.lang.String aspect)voidsetAspectEnabled(java.lang.String aspect)voidsetHeld(boolean newHeld)Set the held property of the signal mast.voidsetLit(boolean newLit)Set the lit property.voidsetMastType(java.lang.String type)Set the specific mast type for this mast.voidsetPermissiveSmlDisabled(boolean disabled)voidsetState(int i)Provide generic access to internal state.voidvetoableChange(java.beans.PropertyChangeEvent evt)-
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
-
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, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
aspect
protected java.lang.String aspect
-
speed
protected java.lang.String speed
-
map
protected DefaultSignalAppearanceMap map
-
systemDefn
SignalSystem systemDefn
-
disablePermissiveSignalMastLogic
boolean disablePermissiveSignalMastLogic
-
disabledAspects
protected java.util.ArrayList<java.lang.String> disabledAspects
-
mastType
java.lang.String mastType
-
-
Constructor Detail
-
AbstractSignalMast
public AbstractSignalMast(java.lang.String systemName, java.lang.String userName)
-
AbstractSignalMast
public AbstractSignalMast(java.lang.String systemName)
-
-
Method Detail
-
setAspect
public void setAspect(@Nonnull java.lang.String aspect)
Description copied from interface:SignalMastSet aspect to a valid name in the current signal system definition.- Specified by:
setAspectin interfaceSignalMast- Parameters:
aspect- the new aspect shown
-
getAspect
public java.lang.String getAspect()
Description copied from interface:SignalMastGet current aspect name. Changes to this property can be listened to using the property Aspect.- Specified by:
getAspectin interfaceSignalMast- Returns:
- the current aspect or null if not set
-
getSpeed
public java.lang.String getSpeed()
-
getState
public int getState()
The state is the index of the current aspect in the list of possible aspects.
-
setState
public void setState(int i)
Description copied from interface:NamedBeanProvide 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.
-
getLit
public boolean getLit()
Default behavior for "lit" property is to track value and return it.- Specified by:
getLitin interfaceSignal- Specified by:
getLitin interfaceSignalMast- Returns:
- true if lit; false if dark
-
getHeld
public boolean getHeld()
"Held" property is just tracked and notified.- Specified by:
getHeldin interfaceSignal- Specified by:
getHeldin interfaceSignalMast- Returns:
- true if held; false otherwise
-
setLit
public void setLit(boolean newLit)
Set the lit property.This acts on all the SignalHeads included in this SignalMast
- Specified by:
setLitin interfaceSignal- Specified by:
setLitin interfaceSignalMast- Parameters:
newLit- the new value of lit
-
setHeld
public void setHeld(boolean newHeld)
Set the held property of the signal mast.Note that this does not directly effect the output on the layout; the held property is a local variable which effects the aspect only via higher-level logic.
- Specified by:
setHeldin interfaceSignal- Specified by:
setHeldin interfaceSignalMast- Parameters:
newHeld- the new value of the help property
-
isAtStop
public boolean isAtStop()
Description copied from interface:SignalDetermine whether this signal shows an aspect or appearance that forbid travel past it. This might be a red appearance, or a Stop aspect. Stop-and-Proceed or Restricting would return false here.
-
isShowingRestricting
public boolean isShowingRestricting()
Description copied from interface:SignalDetermine whether this signal shows an aspect or appearance that allows travel past it only at restricted speed. This might be a flashing red appearance, or a Restricting aspect.- Specified by:
isShowingRestrictingin interfaceSignal- Returns:
- true if the signal is showing a restricting indication; false otherwise
-
isCleared
public boolean isCleared()
Description copied from interface:SignalDetermine whether this signal shows an aspect or appearance that allows travel past it, e.g. it's "been cleared". This might be a yellow or green appearance, or an Approach or Clear aspect.
-
setPermissiveSmlDisabled
public void setPermissiveSmlDisabled(boolean disabled)
- Specified by:
setPermissiveSmlDisabledin interfaceSignalMast
-
isPermissiveSmlDisabled
public boolean isPermissiveSmlDisabled()
Determine if the permissive SML logic should be disabled. The default will be false which means that automatic permissive processing is allowed. Prototypical CTC designs frequently require an additional action, such as Call-On, to enable permissive aspects.- Specified by:
isPermissiveSmlDisabledin interfaceSignalMast- Returns:
- true if permissive SML is disabled.
-
configureSignalSystemDefinition
protected void configureSignalSystemDefinition(java.lang.String name)
-
configureAspectTable
protected void configureAspectTable(java.lang.String signalSystemName, java.lang.String aspectMapName)
-
getSignalSystem
public SignalSystem getSignalSystem()
- Specified by:
getSignalSystemin interfaceSignalMast
-
getAppearanceMap
public SignalAppearanceMap getAppearanceMap()
- Specified by:
getAppearanceMapin interfaceSignalMast
-
getValidAspects
@Nonnull public java.util.Vector<java.lang.String> getValidAspects()
Description copied from interface:SignalMastGet an alphabetically sorted list of valid aspects that have not been disabled.- Specified by:
getValidAspectsin interfaceSignalMast- Returns:
- sorted list of valid aspects; may be empty
-
getMastType
public java.lang.String getMastType()
Get the specific mast type for this mast. This is the type that appears in the SystemName and filename, i.e. "SL-3-high" for the AAR-1946/appearance-SL-3-high.xml definition.- Specified by:
getMastTypein interfaceSignalMast- Returns:
- mast type.
-
setMastType
public void setMastType(@Nonnull java.lang.String type)
Description copied from interface:SignalMastSet the specific mast type for this mast. This is the type that appears in the SystemName and filename, i.e. "SL-3-high" for the AAR-1946/appearance-SL-3-high.xml definition.- Specified by:
setMastTypein interfaceSignalMast- Parameters:
type- mast type.
-
getAllKnownAspects
public java.util.Vector<java.lang.String> getAllKnownAspects()
Get a list of all the known aspects for this mast, including those that have been disabled.- Returns:
- list of known aspects; may be empty
-
setAspectDisabled
public void setAspectDisabled(java.lang.String aspect)
-
setAspectEnabled
public void setAspectEnabled(java.lang.String aspect)
-
getDisabledAspects
public java.util.List<java.lang.String> getDisabledAspects()
-
isAspectDisabled
public boolean isAspectDisabled(java.lang.String aspect)
- Specified by:
isAspectDisabledin interfaceSignalMast
-
setAllowUnLit
public void setAllowUnLit(boolean boo)
Description copied from interface:SignalMastSets whether the Signal Mast is allowed or configured to show an unlit aspect, or if it is always lit.- Specified by:
setAllowUnLitin interfaceSignalMast- Parameters:
boo- Set true to allow the UnLit to be used, set false it is not supported or allowed.
-
allowUnLit
public boolean allowUnLit()
- Specified by:
allowUnLitin interfaceSignalMast
-
vetoableChange
public void vetoableChange(java.beans.PropertyChangeEvent evt) throws java.beans.PropertyVetoException
Description copied from class:AbstractNamedBean- Specified by:
vetoableChangein interfaceNamedBean- Specified by:
vetoableChangein interfacejava.beans.VetoableChangeListener- Overrides:
vetoableChangein classAbstractNamedBean- Throws:
java.beans.PropertyVetoException
-
getBeanType
public java.lang.String getBeanType()
Description copied from interface:NamedBeanFor 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:
getBeanTypein interfaceNamedBean- Returns:
- a string of the bean type, eg Turnout, Sensor etc
-
getUsageReport
public java.util.List<NamedBeanUsageReport> getUsageReport(NamedBean bean)
Description copied from interface:NamedBeanGet a list of references for the specified bean.- Specified by:
getUsageReportin interfaceNamedBean- Parameters:
bean- The bean to be checked.- Returns:
- a list of NamedBeanUsageReports or an empty ArrayList.
-
-