Interface Logix
- All Superinterfaces:
Comparable<NamedBean>,NamedBean,PropertyChangeProvider
- All Known Implementing Classes:
DefaultLogix
A Logix can be enabled or not. It passes this attribute to its Conditionals. By default it is enabled. When not enabled, a Conditional will still respond to callbacks from its listeners and calculate its state, however it will not execute its actions. Enabled is a bound property of a Logix.
A Logix can be deactivated or not. When deactivated, the listeners of the Conditional variables are deinstalled.
A Logix does not have a "state", however, each of its Conditionals does.
This file is part of JMRI.
JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
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 TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN -
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 name and sequence number to this Logix.booleanaddConditional(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 from this Logix.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 status.intGet number of Conditionals for this Logix.voidsetEnabled(boolean state) Set enabled status.voidConditionalVariables only have a single name field.voidswapConditional(int nextInOrder, int row) Move 'row' to 'nextInOrder' and shift all between 'nextInOrder' and 'row' up one position.Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, dispose, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getState, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setState, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
LISTENER_TYPE_SENSOR
- See Also:
-
LISTENER_TYPE_TURNOUT
- See Also:
-
LISTENER_TYPE_LIGHT
- See Also:
-
LISTENER_TYPE_CONDITIONAL
- See Also:
-
LISTENER_TYPE_SIGNALHEAD
- See Also:
-
LISTENER_TYPE_MEMORY
- See Also:
-
LISTENER_TYPE_FASTCLOCK
- See Also:
-
LISTENER_TYPE_WARRANT
- See Also:
-
LISTENER_TYPE_SIGNALMAST
- See Also:
-
LISTENER_TYPE_OBLOCK
- See Also:
-
LISTENER_TYPE_ENTRYEXIT
- See Also:
-
-
Method Details
-
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.- Parameters:
state- true if Logix should be enabled; false otherwise
-
getEnabled
boolean getEnabled()Get enabled status.- Returns:
- true if enabled; false otherwise
-
getNumConditionals
int getNumConditionals()Get number of Conditionals for this Logix.- Returns:
- the number of conditionals
-
swapConditional
Move 'row' to 'nextInOrder' and shift all between 'nextInOrder' and 'row' up one position. Requiresrow > nextInOrder.- 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.- Parameters:
order- order in which the Conditional calculates- Returns:
- system name of conditional or an empty String
-
addConditional
Add a Conditional name and sequence number to this Logix.- 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.- 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.- Parameters:
systemName- The name of the Conditional object.- Returns:
- the Conditional object or null if not found.
- Since:
- 4.7.4
-
deleteConditional
Delete a Conditional from this Logix.Note: Since each Logix must have at least one Conditional, the last Conditional will not be deleted.
Returns An array of names used in an error message explaining why Conditional should not be deleted.
- Parameters:
systemName- The Conditional system name- Returns:
- names of objects blocking deletion or null; note that null does not exclusively indicate successful deletion
-
calculateConditionals
void calculateConditionals()Calculate all Conditionals, triggering action if the user specified conditions are met, and the Logix is enabled. -
activateLogix
void 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.
-
deActivateLogix
void 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.
-
setGuiNames
void 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.
- Since:
- 4.7.4
-