Class DefaultLogix
- All Implemented Interfaces:
Comparable<NamedBean>,PropertyChangeProvider,Logix,NamedBean
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException -
Field Summary
FieldsFields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, registerFields inherited from interface jmri.Logix
LISTENER_TYPE_CONDITIONAL, LISTENER_TYPE_ENTRYEXIT, LISTENER_TYPE_FASTCLOCK, LISTENER_TYPE_LIGHT, LISTENER_TYPE_MEMORY, LISTENER_TYPE_OBLOCK, LISTENER_TYPE_SENSOR, LISTENER_TYPE_SIGNALHEAD, LISTENER_TYPE_SIGNALMAST, LISTENER_TYPE_TURNOUT, LISTENER_TYPE_WARRANTFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN -
Constructor Summary
ConstructorsConstructorDescriptionDefaultLogix(String systemName) DefaultLogix(String systemName, String userName) DefaultLogix(String systemName, String userName, ConditionalManager conditionalManager) DefaultLogix(String systemName, ConditionalManager conditionalManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidActivate the Logix, starts Logix processing by connecting all inputs that are included the Conditionals in this Logix.voidaddConditional(String systemName, int order) Add a Conditional to this Logix RbooleanaddConditional(String systemName, Conditional conditional) Add a child Conditional to the parent Logix.voidCalculate all Conditionals, triggering action if the user specified conditions are met, and the Logix is enabled.voidDeactivate the Logix.String[]deleteConditional(String systemName) Delete a Conditional and remove it from this Logixvoiddispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.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.getConditional(String systemName) Get a Conditional belonging to this Logix.getConditionalByNumberOrder(int order) Returns the system name of the conditional that will calculate in the specified order.booleanGet enabled statusintGet number of Conditionals for this LogixintgetState()Not needed for Logixs - included to complete implementation of the NamedBean interface.getUsageReport(NamedBean bean) Get a list of references for the specified bean.voidsetEnabled(boolean state) Set enabled status.voidConditionalVariables only have a single name field.voidsetState(int state) Not needed for Logixs - included to complete implementation of the NamedBean interface.voidswapConditional(int nextInOrder, int row) Move 'row' to 'nextInOrder' and shift all between 'row' and 'nextInOrder' up one position ( row > nextInOrder )voidMethods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, 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, describeState, 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, removePropertyChangeListener
-
Field Details
-
NXUUID
-
-
Constructor Details
-
DefaultLogix
-
DefaultLogix
-
DefaultLogix
-
DefaultLogix
-
-
Method Details
-
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
-
getNumConditionals
Get number of Conditionals for this Logix- Specified by:
getNumConditionalsin interfaceLogix- Returns:
- the number of conditionals
-
swapConditional
Move 'row' to 'nextInOrder' and shift all between 'row' and 'nextInOrder' up one position ( row > nextInOrder )- Specified by:
swapConditionalin interfaceLogix- Parameters:
nextInOrder- target order for Conditional at rowrow- position of Conditional to move
-
getConditionalByNumberOrder
Returns the system name of the conditional that will calculate in the specified order. This is also the order the Conditional is listed in the Add/Edit Logix dialog. If 'order' is greater than the number of Conditionals for this Logix, null is returned.- Specified by:
getConditionalByNumberOrderin interfaceLogix- Parameters:
order- order in which the Conditional calculates.- Returns:
- system name of conditional or an empty String
-
addConditional
Add a Conditional to this Logix R- Specified by:
addConditionalin interfaceLogix- Parameters:
systemName- The Conditional system nameorder- the order this conditional should calculate in if order is negative, the conditional is added at the end of current group of conditionals
-
addConditional
Add a child Conditional to the parent Logix.- Specified by:
addConditionalin interfaceLogix- Parameters:
systemName- The system name for the Conditional object.conditional- The Conditional object.- Returns:
- true if the Conditional was added, false otherwise.
- Since:
- 4.7.4
-
getConditional
Get a Conditional belonging to this Logix.- Specified by:
getConditionalin interfaceLogix- Parameters:
systemName- The name of the Conditional object.- Returns:
- the Conditional object or null if not found.
- Since:
- 4.7.4
-
setEnabled
Set enabled status. Enabled is a bound property All conditionals are set to UNKNOWN state and recalculated when the Logix is enabled, provided the Logix has been previously activated.- Specified by:
setEnabledin interfaceLogix- Parameters:
state- true if Logix should be enabled; false otherwise
-
getEnabled
Get enabled status- Specified by:
getEnabledin interfaceLogix- Returns:
- true if enabled; false otherwise
-
deleteConditional
Delete a Conditional and remove it from this LogixNote: Since each Logix must have at least one Conditional to do anything, the user is warned in Logix Table Action when the last Conditional is deleted.
- Specified by:
deleteConditionalin interfaceLogix- Parameters:
systemName- The Conditional system name- Returns:
- null if Conditional was successfully deleted or not present, otherwise returns a string array list of current usage that prevent deletion, used to present a warning dialog to the user
-
calculateConditionals
Calculate all Conditionals, triggering action if the user specified conditions are met, and the Logix is enabled.- Specified by:
calculateConditionalsin interfaceLogix
-
activateLogix
Activate the Logix, starts Logix processing by connecting all inputs that are included the Conditionals in this Logix.A Logix must be activated before it will calculate any of its Conditionals.
- Specified by:
activateLogixin interfaceLogix
-
setGuiNames
ConditionalVariables only have a single name field. For user interface purposes a gui name is used for the referenced conditional user name. This is not used for other object types.In addition to setting the GUI name, any state variable references are changed to conditional system names. This converts the XML system/user name field to the system name for conditional references. It does not affect other objects such as sensors, turnouts, etc.
For Entry/Exit references, replace NX user names and old style NX UUID references with the new style "IN:" + UUID reference. If the referenced NX does not exist, it will be removed from the Variable or Action list. (4.11.4)
Called by
DefaultLogixManager.activateAllLogixs()- Specified by:
setGuiNamesin interfaceLogix- Since:
- 4.7.4
-
deActivateLogix
Deactivate the Logix. This method disconnects the Logix from all input objects and stops it from being triggered to calculate.A Logix must be deactivated before its Conditionals are changed.
- Specified by:
deActivateLogixin interfaceLogix
-
getState
Not needed for Logixs - included to complete implementation of the NamedBean interface. -
setState
Not needed for Logixs - included to complete implementation of the NamedBean interface. -
vetoableChange
Description copied from class:AbstractNamedBean- Specified by:
vetoableChangein interfaceNamedBean- Overrides:
vetoableChangein classAbstractNamedBean- Throws:
PropertyVetoException
-
getUsageReport
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.
-
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
-