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 (package private) boolean
allowUnLit
protected java.lang.String
aspect
protected java.util.ArrayList<java.lang.String>
disabledAspects
(package private) boolean
disablePermissiveSignalMastLogic
protected DefaultSignalAppearanceMap
map
(package private) java.lang.String
mastType
protected java.lang.String
speed
(package private) SignalSystem
systemDefn
-
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 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 boolean
allowUnLit()
protected void
configureAspectTable(java.lang.String signalSystemName, java.lang.String aspectMapName)
protected void
configureSignalSystemDefinition(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.SignalAppearanceMap
getAppearanceMap()
java.lang.String
getAspect()
Get current aspect name.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.List<java.lang.String>
getDisabledAspects()
boolean
getHeld()
"Held" property is just tracked and notified.boolean
getLit()
Default behavior for "lit" property is to track value and return it.java.lang.String
getMastType()
Get the specific mast type for this mast.SignalSystem
getSignalSystem()
java.lang.String
getSpeed()
int
getState()
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.boolean
isAspectDisabled(java.lang.String aspect)
boolean
isAtStop()
Determine whether this signal shows an aspect or appearance that forbid travel past it.boolean
isCleared()
Determine whether this signal shows an aspect or appearance that allows travel past it, e.g. it's "been cleared".boolean
isPermissiveSmlDisabled()
Determine if the permissive SML logic should be disabled.boolean
isShowingRestricting()
Determine whether this signal shows an aspect or appearance that allows travel past it only at restricted speed.void
setAllowUnLit(boolean boo)
Sets whether the Signal Mast is allowed or configured to show an unlit aspect, or if it is always lit.void
setAspect(java.lang.String aspect)
Set aspect to a valid name in the current signal system definition.void
setAspectDisabled(java.lang.String aspect)
void
setAspectEnabled(java.lang.String aspect)
void
setHeld(boolean newHeld)
Set the held property of the signal mast.void
setLit(boolean newLit)
Set the lit property.void
setMastType(java.lang.String type)
Set the specific mast type for this mast.void
setPermissiveSmlDisabled(boolean disabled)
void
setState(int i)
Provide generic access to internal state.void
vetoableChange(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
-
allowUnLit
boolean allowUnLit
-
-
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:SignalMast
Set aspect to a valid name in the current signal system definition.- Specified by:
setAspect
in interfaceSignalMast
- Parameters:
aspect
- the new aspect shown
-
getAspect
public java.lang.String getAspect()
Description copied from interface:SignalMast
Get current aspect name. Changes to this property can be listened to using the property Aspect.- Specified by:
getAspect
in 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:NamedBean
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.
-
getLit
public boolean getLit()
Default behavior for "lit" property is to track value and return it.- Specified by:
getLit
in interfaceSignal
- Specified by:
getLit
in interfaceSignalMast
- Returns:
- true if lit; false if dark
-
getHeld
public boolean getHeld()
"Held" property is just tracked and notified.- Specified by:
getHeld
in interfaceSignal
- Specified by:
getHeld
in 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:
setLit
in interfaceSignal
- Specified by:
setLit
in 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:
setHeld
in interfaceSignal
- Specified by:
setHeld
in interfaceSignalMast
- Parameters:
newHeld
- the new value of the help property
-
isAtStop
public boolean isAtStop()
Description copied from interface:Signal
Determine 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:Signal
Determine 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:
isShowingRestricting
in interfaceSignal
- Returns:
- true if the signal is showing a restricting indication; false otherwise
-
isCleared
public boolean isCleared()
Description copied from interface:Signal
Determine 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:
setPermissiveSmlDisabled
in 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:
isPermissiveSmlDisabled
in 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:
getSignalSystem
in interfaceSignalMast
-
getAppearanceMap
public SignalAppearanceMap getAppearanceMap()
- Specified by:
getAppearanceMap
in interfaceSignalMast
-
getValidAspects
@Nonnull public java.util.Vector<java.lang.String> getValidAspects()
Description copied from interface:SignalMast
Get an alphabetically sorted list of valid aspects that have not been disabled.- Specified by:
getValidAspects
in 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:
getMastType
in interfaceSignalMast
- Returns:
- mast type.
-
setMastType
public void setMastType(@Nonnull java.lang.String type)
Description copied from interface:SignalMast
Set 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:
setMastType
in 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:
isAspectDisabled
in interfaceSignalMast
-
setAllowUnLit
public void setAllowUnLit(boolean boo)
Description copied from interface:SignalMast
Sets whether the Signal Mast is allowed or configured to show an unlit aspect, or if it is always lit.- Specified by:
setAllowUnLit
in 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:
allowUnLit
in interfaceSignalMast
-
vetoableChange
public void vetoableChange(java.beans.PropertyChangeEvent evt) throws java.beans.PropertyVetoException
Description copied from class:AbstractNamedBean
- Specified by:
vetoableChange
in interfaceNamedBean
- Specified by:
vetoableChange
in interfacejava.beans.VetoableChangeListener
- Overrides:
vetoableChange
in classAbstractNamedBean
- Throws:
java.beans.PropertyVetoException
-
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
-
getUsageReport
public java.util.List<NamedBeanUsageReport> getUsageReport(NamedBean bean)
Description copied from interface:NamedBean
Get a list of references for the specified bean.- Specified by:
getUsageReport
in interfaceNamedBean
- Parameters:
bean
- The bean to be checked.- Returns:
- a list of NamedBeanUsageReports or an empty ArrayList.
-
-