Package jmri.jmrix.openlcb
Class OlcbTurnout
java.lang.Object
jmri.implementation.AbstractNamedBean
jmri.implementation.AbstractTurnout
jmri.jmrix.openlcb.OlcbTurnout
- All Implemented Interfaces:
PropertyChangeListener,Comparable<NamedBean>,EventListener,PropertyChangeProvider,DigitalIO,NamedBean,Turnout,VariableControlSpanBean
-
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 TypeFieldDescription(package private) OlcbAddress(package private) OlcbAddress(package private) EventTable.EventTableEntryHolder(package private) static final boolean(package private) static final boolean(package private) BitProducerConsumer(package private) EventTable.EventTableEntryHolder(package private) VersionedValueListener<Boolean>Fields inherited from class jmri.implementation.AbstractTurnout
_activeFeedbackType, _cabLockout, _decoderName, _enableCabLockout, _enablePushButtonLockout, _inverted, _pushButtonLockout, _reportLocked, _validDecoderNames, _validFeedbackModes, _validFeedbackNames, _validFeedbackTypes, binaryOutput, DELAYED_FEEDBACK_INTERVAL, inhibitOperation, myOperator, myTurnoutOperation, r, thrFields 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
ConstructorsModifierConstructorDescriptionprotectedOlcbTurnout(String prefix, String address, CanSystemConnectionMemo memo) -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine if the turnouts can be inverted.intcompareSystemNameSuffix(String suffix1, String suffix2, NamedBean n) Compare the suffix of this NamedBean's name with the suffix of the argument NamedBean's name for theNamedBean.compareTo(jmri.NamedBean)operation.voiddispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.voidHelper function that will be invoked after construction once the feedback type has been set.protected voidforwardCommandChangeToLayout(int s) Handle a request to change state, typically by sending a message to the layout in some child class.getEventID(boolean isThrown) getEventName(boolean isThrown) Computes the display name of a given event to be entered into the Event Table.Get a recommended text for a tooltip when displaying the NamedBean, e.g. in a list or table.booleanbooleanvoidRequest an update from the layout soft/hardware.voidsetAuthoritative(boolean authoritative) Changes how the turnout reacts to inquire state events.voidsetFeedbackMode(int mode) On change, fires Property Change "feedbackchange".voidsetListeningToStateMessages(boolean listen) Changes how the turnout reacts to state declaration messages.voidsetProperty(String key, Object value) Attach a key/value pair to the NamedBean, which can be retrieved later.voidUpdates event table entries when the user name changes.protected voidturnoutPushbuttonLockout(boolean locked) Methods inherited from class jmri.implementation.AbstractTurnout
canLock, describeState, enableLockOperation, forwardCommandChangeToLayout, getBeanType, getCommandedState, getControlType, getCurrentOperator, getDecoderName, getDivergingLimit, getDivergingSpeed, getFeedbackMode, getFeedbackModeForOperation, getFeedbackModeName, getFirstNamedSensor, getFirstSensor, getInhibitOperation, getInverted, getKnownState, getLeadingTurnout, getLocked, getNumberControlBits, getPossibleLockModes, getReportLocked, getSecondNamedSensor, getSecondSensor, getState, getStraightLimit, getStraightSpeed, getTurnoutOperation, getTurnoutOperator, getUsageReport, getValidDecoderNames, getValidFeedbackModes, getValidFeedbackNames, getValidFeedbackTypes, isCanFollow, isConsistentState, isFollowingCommandedState, leadingTurnoutPropertyChange, newCommandedState, newKnownState, operationPropertyChange, propertyChange, provideFirstFeedbackNamedSensor, provideFirstFeedbackSensor, provideSecondFeedbackNamedSensor, provideSecondFeedbackSensor, sensorPropertyChange, setBinaryOutput, setCommandedState, setCommandedStateAtInterval, setControlType, setDecoderName, setDivergingSpeed, setFeedbackMode, setFollowingCommandedState, setInhibitOperation, setInitialKnownStateFromFeedback, setInverted, setLeadingTurnout, setLeadingTurnout, setLocked, setNumberControlBits, setReportLocked, setState, setStraightSpeed, setTurnoutOperation, stateChangeCheck, statesOk, turnoutPushbuttonLockout, vetoableChangeMethods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, toString, toStringSuffix, updateListenerRefMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareTo, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, removeProperty, setComment, toString, updateListenerRefMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from interface jmri.Turnout
provideFeedbackSensor
-
Field Details
-
addrThrown
-
addrClosed
-
turnoutListener
-
pc
-
thrownEventTableEntryHolder
-
closedEventTableEntryHolder
-
DEFAULT_IS_AUTHORITATIVE
- See Also:
-
DEFAULT_LISTEN
- See Also:
-
-
Constructor Details
-
OlcbTurnout
-
-
Method Details
-
finishLoad
Helper function that will be invoked after construction once the feedback type has been set. Used specifically for preventing double initialization when loading turnouts from XML. -
getEventName
Computes the display name of a given event to be entered into the Event Table.- Parameters:
isThrown- true for thrown event, false for closed event- Returns:
- user-visible string to represent this event.
-
getEventID
-
getRecommendedToolTip
Description copied from interface:NamedBeanGet a recommended text for a tooltip when displaying the NamedBean, e.g. in a list or table. By default, this is the comment from the NamedBean, on the theory that the system name and/or user name are being displayed directly. Specific system implementations may override that.- Returns:
- empty String if no recommendation.
-
setUserName
@OverridingMethodsMustInvokeSuper public void setUserName(String s) throws NamedBean.BadUserNameException Updates event table entries when the user name changes.- Specified by:
setUserNamein interfaceNamedBean- Overrides:
setUserNamein classAbstractNamedBean- Parameters:
s- new user name- Throws:
NamedBean.BadUserNameException- seeNamedBean
-
setFeedbackMode
Description copied from class:AbstractTurnoutOn 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- Overrides:
setFeedbackModein classAbstractTurnout- Parameters:
mode- the feedback type to set- Throws:
IllegalArgumentException- if mode is not valid
-
setProperty
Description copied from class:AbstractNamedBeanAttach a key/value pair to the NamedBean, which can be retrieved later. These are not bound properties as yet, and don't throw events on modification. Key must not be null.The key is constrained to String to make these behave like normal Java Beans.
- Specified by:
setPropertyin interfaceNamedBean- Overrides:
setPropertyin classAbstractNamedBean- Parameters:
key- the property to setvalue- the value of the property
-
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. Sends an OpenLCB command- Specified by:
forwardCommandChangeToLayoutin classAbstractTurnout- Parameters:
s- new state value
-
requestUpdateFromLayout
Description copied from class:AbstractTurnoutRequest 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- Overrides:
requestUpdateFromLayoutin classAbstractTurnout
-
turnoutPushbuttonLockout
- Specified by:
turnoutPushbuttonLockoutin classAbstractTurnout
-
canInvert
Description copied from class:AbstractTurnoutDetermine if the turnouts can be inverted. If true, inverted turnouts are supported.- Specified by:
canInvertin interfaceTurnout- Overrides:
canInvertin classAbstractTurnout- Returns:
- invert supported
-
dispose
Description copied from class:AbstractTurnoutDeactivate 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 classAbstractTurnout
-
setAuthoritative
Changes how the turnout reacts to inquire state events. With authoritative == false the state will always be reported as UNKNOWN to the layout when queried.- Parameters:
authoritative- whether we should respond true state or unknown to the layout event state inquiries.
-
isAuthoritative
- Returns:
- whether this producer/consumer is enabled to return state to the layout upon queries.
-
isListeningToStateMessages
- Returns:
- whether this producer/consumer is always listening to state declaration messages.
-
setListeningToStateMessages
Changes how the turnout reacts to state declaration messages. With listen == true state declarations will update local state at all times. With listen == false state declarations will update local state only if local state is unknown.- Parameters:
listen- whether we should always listen to state declaration messages.
-
compareSystemNameSuffix
@CheckReturnValue public int compareSystemNameSuffix(@Nonnull String suffix1, @Nonnull String suffix2, @Nonnull NamedBean n) Compare the suffix of this NamedBean's name with the suffix of the argument NamedBean's name for theNamedBean.compareTo(jmri.NamedBean)operation. This is intended to be a system-specific comparison that understands the various formats, etc. By default, does an alphanumeric-by-chunks comparison. Sorts by decoded EventID(s)- Specified by:
compareSystemNameSuffixin interfaceNamedBean- Overrides:
compareSystemNameSuffixin classAbstractNamedBean- Parameters:
suffix1- The suffix for the 1st bean in the comparisonsuffix2- The suffix for the 2nd bean in the comparisonn- The other (second) NamedBean in the comparison- Returns:
- -1,0,+1 for ordering if the names are well-formed; may not provide proper ordering if the names are not well-formed.
-
