Class AbstractTurnout
- All Implemented Interfaces:
PropertyChangeListener,Comparable<NamedBean>,EventListener,PropertyChangeProvider,DigitalIO,NamedBean,Turnout,VariableControlSpanBean
- Direct Known Subclasses:
AcelaTurnout,BiDiBTurnout,CbusTurnout,DCCppTurnout,EasyDccTurnout,EcosTurnout,IpocsTurnout,JMRIClientTurnout,LnTurnout,MarklinTurnout,MqttTurnout,MrcTurnout,Mx1Turnout,NceTurnout,OlcbTurnout,RaspberryPiTurnout,SerialTurnout,SerialTurnout,SerialTurnout,SerialTurnout,SerialTurnout,SerialTurnout,SerialTurnout,SprogCSTurnout,SprogTurnout,SRCPTurnout,TamsTurnout,XBeeTurnout,XNetTurnout,XpaTurnout
Implements basic feedback modes:
- NONE feedback, where the KnownState and CommandedState track each other.
- ONESENSOR feedback where the state of a single sensor specifies THROWN vs CLOSED
- TWOSENSOR feedback, where one sensor specifies THROWN and another CLOSED.
Implements the parameter binding support.
Note that we consider it an error for there to be more than one object that corresponds to a particular physical turnout on the layout.
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected booleanprotected Stringprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected String[]Valid stationary decoder names.protected int[]protected String[]protected intprotected booleanstatic intDuration in Milliseconds of delay for DELAYED feedback mode.protected booleanprotected TurnoutOperatorprotected TurnoutOperationprotected Runnableprotected ThreadFields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, registerFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWNFields inherited from interface jmri.Turnout
CABLOCKOUT, CLOSED, DELAYED, DIRECT, EXACT, INDIRECT, LNALTERNATE, LOCKED, MONITORING, ONESENSOR, PROPERTY_COMMANDED_STATE, PROPERTY_DECODER_NAME, PROPERTY_FEEDBACK_MODE, PROPERTY_INVERTED, PROPERTY_LEADING_TURNOUT, PROPERTY_LOCKED, PROPERTY_REPORT_LOCKED, PROPERTY_TURNOUT_DIVERGING_SPEED, PROPERTY_TURNOUT_FEEDBACK_FIRST_SENSOR, PROPERTY_TURNOUT_FEEDBACK_SECOND_SENSOR, PROPERTY_TURNOUT_OPERATION_STATE, PROPERTY_TURNOUT_STRAIGHT_SPEED, PUSHBUTTONLOCKOUT, SIGNAL, THROWN, TWOSENSOR, UNLOCKED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractTurnout(String systemName) protectedAbstractTurnout(String systemName, String userName) -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine if the turnouts can be inverted.booleancanLock(int turnoutLockout) This implementation by itself doesn't provide locking support.describeState(int state) Provide human-readable, localized version of state value.voiddispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.voidenableLockOperation(int turnoutLockout, boolean enabled) Enable turnout lock operators.protected voidprotected abstract voidforwardCommandChangeToLayout(int s) Handle a request to change state, typically by sending a message to the layout in some child class.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.intQuery the commanded state.intGet control type.Get a human readable representation of the locking decoder type for this turnout.floatintGet the feedback mode in machine readable form.protected intAllow an actual turnout class to transform private feedback types into ones that the generic turnout operations know about.Get the feedback mode in human readable form.Get the handle for the first feedback sensor.Get the first feedback sensor.booleanGet if automatically retrying an operation is blocked for this turnout.final booleanGet the turnout inverted state.intQuery the known state.Get the Turnout this Turnout is following.booleangetLocked(int turnoutLockout) Determine if turnout is locked.intType of turnout control - defaults to 0 for /'steady state/'intThis implementation by itself doesn't provide locking support.booleanWhen true, report to console anytime a cab attempts to change the state of a turnout on the layout.Get the second feedback sensor handle.Get the second feedback sensor.intgetState()Implement a shorter name for getKnownState.floatprotected TurnoutOperatorFind the TurnoutOperation class for this turnout, and get an instance of the corresponding operator.getUsageReport(NamedBean bean) Get a list of references for the specified bean.String[]Get a human readable representation of the decoder types.Get a list of valid feedback types.String[]Get a human readable representation of the feedback type.intGet a representation of the feedback type.booleanCheck if this Turnout can follow the state of another Turnout.booleanShow whether state is one you can safely run trains over.booleanCheck if this Turnout is following all states or only the non-commanded states of the leading Turnout.protected voidprotected voidnewCommandedState(int s) Set a new Commanded state, if need be notifying the listeners, but do NOT send the command downstream.voidnewKnownState(int s) Add a newKnownState() for use by implementations.protected voidvoidReact to sensor changes by changing the KnownState if using an appropriate sensor mode.voidOn change, fires Property Change "TurnoutFeedbackFirstSensorChange".voidprovideFirstFeedbackSensor(String pName) voidOn change, fires Property Change "TurnoutFeedbackSecondSensorChange".voidvoidRequest an update from the layout soft/hardware.protected voidvoidsetBinaryOutput(boolean state) Use a binary output for sending commands.voidsetCommandedState(int s) Public access to changing turnout state.voidsetCommandedStateAtInterval(int s) Before setting commanded state, if required by manager, apply wait interval until outputIntervalEnds() to put less pressure on the connection.voidsetControlType(int num) Set control type.voidsetDecoderName(String decoderName) Set a human readable representation of the locking decoder type for this turnout.voidOn change, fires Property Change "TurnoutDivergingSpeedChange".voidsetFeedbackMode(int mode) On change, fires Property Change "feedbackchange".voidsetFeedbackMode(String mode) Set the feedback mode from a human readable name.voidsetFollowingCommandedState(boolean following) Set if this Turnout follows all states or only the non-commanded states of the leading Turnout.voidsetInhibitOperation(boolean io) Set if automatically retrying an operation is blocked for this turnout.voidSets the initial known state (CLOSED,THROWN,UNKNOWN) from feedback information, if appropriate.voidsetInverted(boolean inverted) On change, fires Property Change "inverted".(package private) voidThe name pretty much says it.voidsetLeadingTurnout(Turnout turnout) Set the Turnout this Turnout will follow.voidsetLeadingTurnout(Turnout turnout, boolean followingCommandedState) Set both the leading Turnout and if the commanded state of the leading Turnout is followed.voidsetLocked(int turnoutLockout, boolean locked) Turnouts that are locked should only respond to JMRI commands to change state.voidsetNumberControlBits(int num) Set number of input/output bits this bean controls.voidsetReportLocked(boolean reportLocked) When true, report to console anytime a cab attempts to change the state of a turnout on the layout.voidsetState(int s) Implement a shorter name for setCommandedState.voidOn change, fires Property Change "TurnoutStraightSpeedChange".voidset current automation classbooleanstateChangeCheck(int newState) Preprocess a Turnout state change request forforwardCommandChangeToLayout(int)Public access to allow use in tests.protected booleanstatesOk(int state) Look for the case in which the state is neither Closed nor Thrown, which we can't handle.protected voidprotected abstract voidturnoutPushbuttonLockout(boolean locked) voidMethods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, toStringSuffix, updateListenerRefMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRefMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from interface jmri.Turnout
provideFeedbackSensor
-
Field Details
-
DELAYED_FEEDBACK_INTERVAL
Duration in Milliseconds of delay for DELAYED feedback mode.Defined as "public non-final" so it can be changed in e.g. the jython/SetDefaultDelayedTurnoutDelay script.
-
thr
-
r
-
_validFeedbackNames
-
_validFeedbackModes
-
_validFeedbackTypes
-
_activeFeedbackType
-
_inverted
-
_cabLockout
-
_pushButtonLockout
-
_enableCabLockout
-
_enablePushButtonLockout
-
_reportLocked
-
_validDecoderNames
Valid stationary decoder names. -
_decoderName
-
myOperator
-
myTurnoutOperation
-
inhibitOperation
-
binaryOutput
-
-
Constructor Details
-
AbstractTurnout
-
AbstractTurnout
-
-
Method Details
-
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.- Specified by:
getBeanTypein interfaceNamedBean- Returns:
- a string of the bean type, eg Turnout, Sensor etc
-
forwardCommandChangeToLayout
Handle a request to change state, typically by sending a message to the layout in some child class. Public version (used by TurnoutOperator) sends the current commanded state without changing it. Implementing classes will typically check the value of s and send a system specific sendMessage command.- Parameters:
s- new state value
-
forwardCommandChangeToLayout
-
stateChangeCheck
Preprocess a Turnout state change request forforwardCommandChangeToLayout(int)Public access to allow use in tests.- Parameters:
newState- the Turnout state command value passed- Returns:
- true if a Turnout.CLOSED was requested and Turnout is not set to _inverted
- Throws:
IllegalArgumentException- when needed
-
statesOk
Look for the case in which the state is neither Closed nor Thrown, which we can't handle. Separate method to allow it to be used instateChangeCheck(int)and Xpa/MqttTurnout.- Parameters:
state- the Turnout state passed- Returns:
- false if s = Turnout.THROWN, which is what we want
-
newCommandedState
Set a new Commanded state, if need be notifying the listeners, but do NOT send the command downstream.This is used when a new commanded state is noticed from another command.
- Parameters:
s- new state
-
getKnownState
Query the known state. This is a bound parameter, so you can also register a listener to be informed of changes. A result is always returned; if no other feedback method is available, the commanded state will be used.- Specified by:
getKnownStatein interfaceDigitalIO- Returns:
- the known state
-
setCommandedState
Public access to changing turnout state. Sets the commanded state and, if appropriate, starts a TurnoutOperator to do its thing. If there is no TurnoutOperator (not required or nothing suitable) then just tell the layout and hope for the best.- Specified by:
setCommandedStatein interfaceDigitalIO- Parameters:
s- commanded state to set
-
setCommandedStateAtInterval
Before setting commanded state, if required by manager, apply wait interval until outputIntervalEnds() to put less pressure on the connection.Used to insert a delay before calling
DigitalIO.setCommandedState(int)to spread out a series of output commands, as inMatrixSignalMast.updateOutputs(char[])andDefaultRouteclass SetRouteThread#run(). Interval value is kept in the Memo per hardware connection. Used inDefaultRoute.setRoute()andMatrixSignalMast.updateOutputs(char[]).- Specified by:
setCommandedStateAtIntervalin interfaceTurnout- Parameters:
s- turnout state to forward
-
getCommandedState
Query the commanded state. This is a bound parameter, so you can also register a listener to be informed of changes.- Specified by:
getCommandedStatein interfaceDigitalIO- Returns:
- the commanded state
-
newKnownState
Add a newKnownState() for use by implementations.Use this to update internal information when a state change is detected outside the Turnout object, e.g. via feedback from sensors on the layout.
If the layout status of the Turnout is observed to change to THROWN or CLOSED, this also sets the commanded state, because it's assumed that somebody somewhere commanded that move. If it's observed to change to UNKNOWN or INCONSISTENT, that's perhaps either an error or a move in progress, and no change is made to the commanded state.
This implementation sends a command to the layout for the new state if going to THROWN or CLOSED, because there may be others listening to network state.
This method is not intended for general use, e.g. for users to set the KnownState, so it doesn't appear in the Turnout interface.
On change, fires Property Change "KnownState".
- Parameters:
s- New state value
-
isConsistentState
Show whether state is one you can safely run trains over.- Specified by:
isConsistentStatein interfaceDigitalIO- Returns:
- true if state is a valid one and the known state is the same as commanded.
-
setKnownStateToCommanded
void setKnownStateToCommanded()The name pretty much says it.Triggers all listeners, etc. For use by the TurnoutOperator classes.
-
setState
Implement a shorter name for setCommandedState.This generally shouldn't be used by Java code; use setCommandedState instead. The is provided to make Jython script access easier to read.
Note that getState() and setState(int) are not symmetric: getState is the known state, and set state modifies the commanded state.
-
getState
Implement a shorter name for getKnownState.This generally shouldn't be used by Java code; use getKnownState instead. The is provided to make Jython script access easier to read.
Note that getState() and setState(int) are not symmetric: getState is the known state, and set state modifies the commanded state.
-
describeState
Provide human-readable, localized version of state value.This method is intended for use when presenting to a human operator.
- Specified by:
describeStatein interfaceNamedBean- Overrides:
describeStatein classAbstractNamedBean- Parameters:
state- the state to describe- Returns:
- the state in localized form
-
getNumberControlBits
Type of turnout control - defaults to 0 for /'steady state/'- Specified by:
getNumberControlBitsin interfaceVariableControlSpanBean- Returns:
- the number of bits
-
setNumberControlBits
Set number of input/output bits this bean controls.- Specified by:
setNumberControlBitsin interfaceVariableControlSpanBean- Parameters:
num- the size of the input/output, currently 1 or 2
-
getControlType
Get control type.- Specified by:
getControlTypein interfaceTurnout- Returns:
- 0 for steady state or the number of time units the control pulses
-
setControlType
Set control type.- Specified by:
setControlTypein interfaceTurnout- Parameters:
num- 0 for steady state or the number of time units the control pulses
-
getValidFeedbackModes
Get a list of valid feedback types. The valid types depend on the implemented system.- Specified by:
getValidFeedbackModesin interfaceTurnout- Returns:
- array of feedback types
-
getValidFeedbackTypes
Get a representation of the feedback type. This is the OR of possible values: DIRECT, EXACT, etc. The valid combinations depend on the implemented system.- Specified by:
getValidFeedbackTypesin interfaceTurnout- Returns:
- the ORed combination of feedback types
-
getValidFeedbackNames
Get a human readable representation of the feedback type. The values depend on the implemented system.- Specified by:
getValidFeedbackNamesin interfaceTurnout- Returns:
- the names of the feedback types or an empty list if no feedback is available
-
setFeedbackMode
Set the feedback mode from a human readable name. This must be one of the names defined in a previousTurnout.getValidFeedbackNames()call.- Specified by:
setFeedbackModein interfaceTurnout- Parameters:
mode- the feedback type name- Throws:
IllegalArgumentException- if mode is not valid
-
setFeedbackMode
On change, fires Property Change "feedbackchange". Set the feedback mode from a integer. This must be one of the bit values defined in a previousTurnout.getValidFeedbackTypes()call. Having more than one bit set is an error.- Specified by:
setFeedbackModein interfaceTurnout- Parameters:
mode- the feedback type to set- Throws:
IllegalArgumentException- if mode is not valid
-
getFeedbackMode
Get the feedback mode in machine readable form. This will be one of the bits defined in aTurnout.getValidFeedbackTypes()call.- Specified by:
getFeedbackModein interfaceTurnout- Returns:
- the feedback type
-
getFeedbackModeName
Get the feedback mode in human readable form. This will be one of the names defined in aTurnout.getValidFeedbackNames()call.- Specified by:
getFeedbackModeNamein interfaceTurnout- Returns:
- the feedback type
-
requestUpdateFromLayout
Request an update from the layout soft/hardware. May not even happen, and if it does it will happen later; listen for the result.- Specified by:
requestUpdateFromLayoutin interfaceDigitalIO
-
setInverted
On change, fires Property Change "inverted". Get turnout inverted. When a turnout is inverted theTurnout.CLOSEDandTurnout.THROWNstates are reversed on the layout.- Specified by:
setInvertedin interfaceTurnout- Parameters:
inverted- true if inverted; false otherwise
-
getInverted
Get the turnout inverted state. If true, commands sent to the layout are reversed. Thrown becomes Closed, and Closed becomes Thrown.Used in polling loops in system-specific code, so made final to allow optimization.
- Specified by:
getInvertedin interfaceTurnout- Returns:
- inverted status
-
canInvert
Determine if the turnouts can be inverted. If true, inverted turnouts are supported. -
setLocked
Turnouts that are locked should only respond to JMRI commands to change state. We simulate a locked turnout by monitoring the known state (turnout feedback is required) and if we detect that the known state has changed, negate it by forcing the turnout to return to the commanded state. Turnouts that have local buttons can also be locked if their decoder supports it. On change, fires Property Change "locked".- Specified by:
setLockedin interfaceTurnout- Parameters:
turnoutLockout- lockout state to monitor. Possible valuesTurnout.CABLOCKOUT,Turnout.PUSHBUTTONLOCKOUT. Can be combined to monitor both states.locked- true if turnout to be locked
-
getLocked
Determine if turnout is locked. There are two types of locks: cab lockout, and pushbutton lockout. -
getPossibleLockModes
This implementation by itself doesn't provide locking support. Override this in subclasses that do.- Specified by:
getPossibleLockModesin interfaceTurnout- Returns:
- One of 0 for none
-
canLock
This implementation by itself doesn't provide locking support. Override this in subclasses that do. -
enableLockOperation
Enable turnout lock operators. A turnout can be locked to prevent it being thrown from a cab or push button on the layout if supported by the protocol. Not implemented in AbstractTurnout.- Specified by:
enableLockOperationin interfaceTurnout- Parameters:
turnoutLockout- the type of lockenabled- true if locking is enabled for the given type; false otherwise
-
setReportLocked
When true, report to console anytime a cab attempts to change the state of a turnout on the layout. When a turnout is cab locked, only JMRI is allowed to change the state of a turnout. On setting changed, fires Property Change "reportlocked".- Specified by:
setReportLockedin interfaceTurnout- Parameters:
reportLocked- report locked state
-
getReportLocked
When true, report to console anytime a cab attempts to change the state of a turnout on the layout. When a turnout is cab locked, only JMRI is allowed to change the state of a turnout.- Specified by:
getReportLockedin interfaceTurnout- Returns:
- report locked state
-
getValidDecoderNames
Get a human readable representation of the decoder types.- Specified by:
getValidDecoderNamesin interfaceTurnout- Returns:
- a list of known stationary decoders that can be specified for locking
-
getDecoderName
Get a human readable representation of the locking decoder type for this turnout. In AbstractTurnout this String defaults to PushbuttonPacket.unknown , ie "None"- Specified by:
getDecoderNamein interfaceTurnout- Returns:
- the name of the decoder type; null indicates none defined
-
setDecoderName
Set a human readable representation of the locking decoder type for this turnout. On change, fires Property Change "decoderNameChange".- Specified by:
setDecoderNamein interfaceTurnout- Parameters:
decoderName- the name of the decoder type
-
turnoutPushbuttonLockout
-
turnoutPushbuttonLockout
-
getCurrentOperator
-
getTurnoutOperation
- Specified by:
getTurnoutOperationin interfaceTurnout- Returns:
- current operation automation class
-
setTurnoutOperation
set current automation class Fires Property Change "TurnoutOperationState".- Specified by:
setTurnoutOperationin interfaceTurnout- Parameters:
toper- TurnoutOperation subclass instance
-
operationPropertyChange
-
getInhibitOperation
Get if automatically retrying an operation is blocked for this turnout.- Specified by:
getInhibitOperationin interfaceTurnout- Returns:
- true if retrying is disabled; false otherwise
-
setInhibitOperation
Set if automatically retrying an operation is blocked for this turnout.- Specified by:
setInhibitOperationin interfaceTurnout- Parameters:
io- true if retrying is to be disabled; false otherwise
-
getTurnoutOperator
Find the TurnoutOperation class for this turnout, and get an instance of the corresponding operator. Override this function if you want another way to choose the operation.- Returns:
- newly-instantiated TurnoutOperator, or null if nothing suitable
-
getFeedbackModeForOperation
Allow an actual turnout class to transform private feedback types into ones that the generic turnout operations know about.- Returns:
- apparent feedback mode for operation lookup
-
provideFirstFeedbackSensor
- Specified by:
provideFirstFeedbackSensorin interfaceTurnout- Throws:
JmriExceptionIllegalArgumentException
-
provideFirstFeedbackNamedSensor
On change, fires Property Change "TurnoutFeedbackFirstSensorChange".- Parameters:
s- the Handle for First Feedback Sensor
-
getFirstSensor
Get the first feedback sensor.- Specified by:
getFirstSensorin interfaceTurnout- Returns:
- the sensor or null if no Sensor set
-
getFirstNamedSensor
Get the handle for the first feedback sensor.- Specified by:
getFirstNamedSensorin interfaceTurnout- Returns:
- the sensor handle or null if no Sensor set
-
provideSecondFeedbackSensor
public void provideSecondFeedbackSensor(String pName) throws JmriException, IllegalArgumentException - Specified by:
provideSecondFeedbackSensorin interfaceTurnout- Throws:
JmriExceptionIllegalArgumentException
-
provideSecondFeedbackNamedSensor
On change, fires Property Change "TurnoutFeedbackSecondSensorChange".- Parameters:
s- the Handle for Second Feedback Sensor
-
getSecondSensor
Get the second feedback sensor.- Specified by:
getSecondSensorin interfaceTurnout- Returns:
- the sensor or null if no Sensor set
-
getSecondNamedSensor
Get the second feedback sensor handle.- Specified by:
getSecondNamedSensorin interfaceTurnout- Returns:
- the sensor handle or null if no Sensor set
-
setInitialKnownStateFromFeedback
Sets the initial known state (CLOSED,THROWN,UNKNOWN) from feedback information, if appropriate.This method is designed to be called only when Turnouts are loaded and when a new Turnout is defined in the Turnout table.
No change to known state is made if feedback information is not available. If feedback information is inconsistent, or if sensor definition is missing in ONESENSOR and TWOSENSOR feedback, turnout state is set to UNKNOWN.
- Specified by:
setInitialKnownStateFromFeedbackin interfaceTurnout
-
propertyChange
React to sensor changes by changing the KnownState if using an appropriate sensor mode.- Specified by:
propertyChangein interfacePropertyChangeListener
-
sensorPropertyChange
-
leadingTurnoutPropertyChange
-
setBinaryOutput
Use a binary output for sending commands. This appears to expose a LocoNet-specific feature.- Specified by:
setBinaryOutputin interfaceTurnout- Parameters:
state- true if the outputs are binary; false otherwise
-
dispose
Deactivate this object, so that it releases as many resources as possible and no longer effects others.For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.
It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.
Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained.
- Specified by:
disposein interfaceNamedBean- Overrides:
disposein classAbstractNamedBean
-
getDivergingLimit
- Specified by:
getDivergingLimitin interfaceTurnout
-
getDivergingSpeed
- Specified by:
getDivergingSpeedin interfaceTurnout
-
setDivergingSpeed
On change, fires Property Change "TurnoutDivergingSpeedChange".- Specified by:
setDivergingSpeedin interfaceTurnout- Throws:
JmriException
-
getStraightLimit
- Specified by:
getStraightLimitin interfaceTurnout
-
getStraightSpeed
- Specified by:
getStraightSpeedin interfaceTurnout
-
setStraightSpeed
On change, fires Property Change "TurnoutStraightSpeedChange".- Specified by:
setStraightSpeedin interfaceTurnout- Throws:
JmriException
-
vetoableChange
- Specified by:
vetoableChangein interfaceNamedBean- Overrides:
vetoableChangein classAbstractNamedBean- Throws:
PropertyVetoException
-
getUsageReport
Get 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.
-
isCanFollow
Check if this Turnout can follow the state of another Turnout.- Specified by:
isCanFollowin interfaceTurnout- Returns:
- true if this Turnout is capable of following; false otherwise
-
getLeadingTurnout
Get the Turnout this Turnout is following.- Specified by:
getLeadingTurnoutin interfaceTurnout- Returns:
- the leading Turnout or null if none; null if
Turnout.isCanFollow()is false
-
setLeadingTurnout
Set the Turnout this Turnout will follow.It is valid for two or more turnouts to follow each other in a circular pattern.
It is recommended that a following turnout's feedback mode be
Turnout.DIRECT.It is recommended to explicitly call
Turnout.setFollowingCommandedState(boolean)after calling this method or to useTurnout.setLeadingTurnout(jmri.Turnout, boolean)to ensure this Turnout follows the leading Turnout in the expected manner.- Specified by:
setLeadingTurnoutin interfaceTurnout- Parameters:
turnout- the leading Turnout or null if this Turnout should not follow another Turnout; silently ignored ifTurnout.isCanFollow()is false
-
setLeadingTurnout
Set both the leading Turnout and if the commanded state of the leading Turnout is followed. This is a convenience method for calling bothTurnout.setLeadingTurnout(jmri.Turnout)andTurnout.setFollowingCommandedState(boolean).- Specified by:
setLeadingTurnoutin interfaceTurnout- Parameters:
turnout- the leading Turnout or null if this Turnout should not follow another Turnout; silently ignored ifTurnout.isCanFollow()is falsefollowingCommandedState- true to have all states match leading turnout; false to only have non-commanded states match
-
isFollowingCommandedState
Check if this Turnout is following all states or only the non-commanded states of the leading Turnout.- Specified by:
isFollowingCommandedStatein interfaceTurnout- Returns:
- true if following all states; false otherwise
-
setFollowingCommandedState
Set if this Turnout follows all states or only the non-commanded states of the leading Turnout.A Turnout can be commanded to be
Turnout.THROWNorTurnout.CLOSED, but can also have additional statesNamedBean.INCONSISTENTandNamedBean.UNKNOWN. There are some use cases where a following Turnout should match all states of the leading Turnout, in which case this should be true, but there are also use cases where the following Turnout should only match the INCONSISTENT and UNKNOWN states of the leading Turnout, but should otherwise be independently commanded, in which case this should be false.- Specified by:
setFollowingCommandedStatein interfaceTurnout- Parameters:
following- true to have all states match leading turnout; false to only have non-commanded states match
-