|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.implementation.AbstractNamedBean
jmri.implementation.AbstractTurnout
public abstract class AbstractTurnout
Abstract base for the Turnout interface.
Implements basic feedback modes:
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.
Turnout system names are always upper case.
| Field Summary |
|---|
| Fields inherited from interface jmri.Turnout |
|---|
CABLOCKOUT, CLOSED, DIRECT, EXACT, INDIRECT, LOCKED, MONITORING, ONESENSOR, PUSHBUTTONLOCKOUT, SIGNAL, THROWN, TWOSENSOR, UNLOCKED |
| Fields inherited from interface jmri.NamedBean |
|---|
INCONSISTENT, UNKNOWN |
| Method Summary | |
|---|---|
boolean |
canInvert()
Determine if the turnouts can be inverted. |
boolean |
canLock(int turnoutLockout)
Determine if turnout can be locked. |
void |
dispose()
Deactivate this object, so that it releases as many resources as possible and no longer effects others. |
void |
enableLockOperation(int turnoutLockout,
boolean enabled)
Enable turnout lock operators. |
int |
getCommandedState()
Query the commanded state. |
int |
getControlType()
Get control type. |
TurnoutOperator |
getCurrentOperator()
|
String |
getDecoderName()
Get a human readable representation of the decoder type for this turnout. |
int |
getFeedbackMode()
Get the feedback mode in machine readable form. |
String |
getFeedbackModeName()
Get the feedback mode in human readable form. |
Sensor |
getFirstSensor()
Get the first sensor, if defined. |
boolean |
getInhibitOperation()
Get the indicator for whether automatic operation (retry) has been inhibited for this turnout |
boolean |
getInverted()
Get the turnout inverted state. |
int |
getKnownState()
Query the known state. |
boolean |
getLocked(int turnoutLockout)
Determine if turnout is locked. |
int |
getNumberOutputBits()
Get number of output bits. |
boolean |
getReportLocked()
When true, report to console anytime a cab attempts to change the state of a turnout on the layout. |
Sensor |
getSecondSensor()
Get the Second sensor, if defined. |
int |
getState()
Implement a shorter name for getKnownState. |
TurnoutOperation |
getTurnoutOperation()
|
String[] |
getValidDecoderNames()
Get a human readable representation of the decoder types. |
String[] |
getValidFeedbackNames()
Get a human readable representation of the feedback type. |
int |
getValidFeedbackTypes()
Get a representation of the feedback type. |
boolean |
isConsistentState()
Show whether state is one you can safely run trains over |
void |
propertyChange(PropertyChangeEvent evt)
React to sensor changes by changing the KnownState if using an appropriate sensor mode |
void |
provideFirstFeedbackSensor(Sensor s)
Provide Sensor objects needed for some feedback types. |
void |
provideSecondFeedbackSensor(Sensor s)
|
void |
setBinaryOutput(boolean state)
Turn this object into just a binary output. |
void |
setCommandedState(int s)
Public access to changing turnout state. |
void |
setControlType(int num)
Set control type. |
void |
setDecoderName(String decoderName)
Set a human readable representation of the decoder type for this turnout. |
void |
setFeedbackMode(int mode)
Set the feedback mode from a integer. |
void |
setFeedbackMode(String mode)
Set the feedback mode from a human readable name. |
void |
setInhibitOperation(boolean io)
Change the value of the inhibit operation indicator |
void |
setInitialKnownStateFromFeedback()
Sets the initial known state (CLOSED,THROWN,UNKNOWN) from feedback information, if appropriate. |
void |
setInverted(boolean inverted)
Set turnout inverted If true commands are reversed to layout |
void |
setLocked(int turnoutLockout,
boolean locked)
Turnouts that are locked should only respond to JMRI commands to change state. |
void |
setNumberOutputBits(int num)
Set number of output bits. |
void |
setReportLocked(boolean reportLocked)
When true, report to console anytime a cab attempts to change the state of a turnout on the layout. |
void |
setState(int s)
Implement a shorter name for setCommandedState. |
void |
setTurnoutOperation(TurnoutOperation toper)
set current automation class |
| Methods inherited from class jmri.implementation.AbstractNamedBean |
|---|
addPropertyChangeListener, getComment, getDisplayName, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface jmri.NamedBean |
|---|
addPropertyChangeListener, getComment, getDisplayName, getNumPropertyChangeListeners, getProperty, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName |
| Method Detail |
|---|
public int getKnownState()
Turnout
getKnownState in interface Turnoutpublic void setCommandedState(int s)
setCommandedState in interface Turnoutpublic int getCommandedState()
Turnout
getCommandedState in interface Turnoutpublic boolean isConsistentState()
isConsistentState in interface Turnoutpublic void setState(int s)
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.
setState in interface NamedBeanpublic int getState()
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.
getState in interface NamedBeanpublic int getNumberOutputBits()
TurnoutCurrently must be one or two.
getNumberOutputBits in interface Turnoutpublic void setNumberOutputBits(int num)
TurnoutCurrently must be one or two.
setNumberOutputBits in interface Turnoutpublic int getControlType()
TurnoutCurrently must be either 0 for steady state, or n for pulse for n time units.
getControlType in interface Turnoutpublic void setControlType(int num)
TurnoutCurrently must be either 0 for steady state, or n for pulse for n time units.
setControlType in interface Turnoutpublic int getValidFeedbackTypes()
Turnout
getValidFeedbackTypes in interface Turnoutpublic String[] getValidFeedbackNames()
Turnout
getValidFeedbackNames in interface Turnout
public void setFeedbackMode(String mode)
throws IllegalArgumentException
TurnoutTurnout.getValidFeedbackNames() call.
setFeedbackMode in interface TurnoutIllegalArgumentException
public void setFeedbackMode(int mode)
throws IllegalArgumentException
TurnoutTurnout.getValidFeedbackTypes() call.
Having more than one bit set is an error.
setFeedbackMode in interface TurnoutIllegalArgumentExceptionpublic int getFeedbackMode()
TurnoutTurnout.getValidFeedbackTypes() call.
getFeedbackMode in interface Turnoutpublic String getFeedbackModeName()
TurnoutTurnout.getValidFeedbackNames() call.
getFeedbackModeName in interface Turnoutpublic void setInverted(boolean inverted)
TurnoutIf true commands are reversed to layout
setInverted in interface Turnoutpublic final boolean getInverted()
Used in polling loops in system-specific code, so made final to allow optimization.
getInverted in interface Turnoutpublic boolean canInvert()
canInvert in interface Turnout
public void setLocked(int turnoutLockout,
boolean locked)
setLocked in interface Turnoutlocked - public boolean getLocked(int turnoutLockout)
getLocked in interface Turnoutpublic boolean canLock(int turnoutLockout)
TurnoutIf true turnouts can be locked.
canLock in interface Turnout
public void enableLockOperation(int turnoutLockout,
boolean enabled)
TurnoutIf true the type of lock specified is enabled.
enableLockOperation in interface Turnoutpublic void setReportLocked(boolean reportLocked)
setReportLocked in interface Turnoutpublic boolean getReportLocked()
getReportLocked in interface Turnoutpublic String[] getValidDecoderNames()
Turnout
getValidDecoderNames in interface Turnoutpublic String getDecoderName()
Turnout
getDecoderName in interface Turnoutpublic void setDecoderName(String decoderName)
Turnout
setDecoderName in interface Turnoutpublic TurnoutOperator getCurrentOperator()
public TurnoutOperation getTurnoutOperation()
getTurnoutOperation in interface Turnoutpublic void setTurnoutOperation(TurnoutOperation toper)
Turnout
setTurnoutOperation in interface Turnouttoper - TurnoutOperation subclass instancepublic boolean getInhibitOperation()
Turnout
getInhibitOperation in interface Turnoutpublic void setInhibitOperation(boolean io)
Turnout
setInhibitOperation in interface Turnoutpublic void provideFirstFeedbackSensor(Sensor s)
TurnoutThe second sensor can be null if needed.
Sensor-based feedback will not function until these sensors have been provided.
provideFirstFeedbackSensor in interface Turnoutpublic void provideSecondFeedbackSensor(Sensor s)
provideSecondFeedbackSensor in interface Turnoutpublic Sensor getFirstSensor()
TurnoutReturns null if no Sensor recorded.
getFirstSensor in interface Turnoutpublic Sensor getSecondSensor()
TurnoutReturns null if no Sensor recorded.
getSecondSensor in interface Turnoutpublic void setInitialKnownStateFromFeedback()
TurnoutThis 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.
setInitialKnownStateFromFeedback in interface Turnoutpublic void propertyChange(PropertyChangeEvent evt)
propertyChange in interface PropertyChangeListenerpublic void setBinaryOutput(boolean state)
Turnout
setBinaryOutput in interface Turnoutpublic void dispose()
NamedBeanFor 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.
dispose in interface NamedBeandispose in class AbstractNamedBean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||