Interface Logix
-
- All Superinterfaces:
java.lang.Comparable<NamedBean>
,NamedBean
,PropertyChangeProvider
- All Known Implementing Classes:
DefaultLogix
public interface Logix extends NamedBean
A Logix is a group of Conditionals that monitor one or more conditions (internal or on the layout). It services these Conditionals by installing and deinstalling the proper listeners for their variables.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
Fields Modifier and Type Field Description static int
LISTENER_TYPE_CONDITIONAL
static int
LISTENER_TYPE_ENTRYEXIT
static int
LISTENER_TYPE_FASTCLOCK
static int
LISTENER_TYPE_LIGHT
static int
LISTENER_TYPE_MEMORY
static int
LISTENER_TYPE_OBLOCK
static int
LISTENER_TYPE_SENSOR
static int
LISTENER_TYPE_SIGNALHEAD
static int
LISTENER_TYPE_SIGNALMAST
static int
LISTENER_TYPE_TURNOUT
static int
LISTENER_TYPE_WARRANT
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
activateLogix()
Activate the Logix, starts Logix processing by connecting all inputs that are included the Conditionals in this Logix.void
addConditional(java.lang.String systemName, int order)
Add a Conditional name and sequence number to this Logix.boolean
addConditional(java.lang.String systemName, Conditional conditional)
Add a child Conditional to the parent Logix.void
calculateConditionals()
Calculate all Conditionals, triggering action if the user specified conditions are met, and the Logix is enabled.void
deActivateLogix()
Deactivate the Logix.java.lang.String[]
deleteConditional(java.lang.String systemName)
Delete a Conditional from this Logix.Conditional
getConditional(java.lang.String systemName)
Get a Conditional belonging to this Logix.java.lang.String
getConditionalByNumberOrder(int order)
Returns the system name of the conditional that will calculate in the specified order.boolean
getEnabled()
Get enabled status.int
getNumConditionals()
Get number of Conditionals for this Logix.void
setEnabled(boolean state)
Set enabled status.void
setGuiNames()
ConditionalVariables only have a single name field.void
swapConditional(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, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
LISTENER_TYPE_SENSOR
static final int LISTENER_TYPE_SENSOR
- See Also:
- Constant Field Values
-
LISTENER_TYPE_TURNOUT
static final int LISTENER_TYPE_TURNOUT
- See Also:
- Constant Field Values
-
LISTENER_TYPE_LIGHT
static final int LISTENER_TYPE_LIGHT
- See Also:
- Constant Field Values
-
LISTENER_TYPE_CONDITIONAL
static final int LISTENER_TYPE_CONDITIONAL
- See Also:
- Constant Field Values
-
LISTENER_TYPE_SIGNALHEAD
static final int LISTENER_TYPE_SIGNALHEAD
- See Also:
- Constant Field Values
-
LISTENER_TYPE_MEMORY
static final int LISTENER_TYPE_MEMORY
- See Also:
- Constant Field Values
-
LISTENER_TYPE_FASTCLOCK
static final int LISTENER_TYPE_FASTCLOCK
- See Also:
- Constant Field Values
-
LISTENER_TYPE_WARRANT
static final int LISTENER_TYPE_WARRANT
- See Also:
- Constant Field Values
-
LISTENER_TYPE_SIGNALMAST
static final int LISTENER_TYPE_SIGNALMAST
- See Also:
- Constant Field Values
-
LISTENER_TYPE_OBLOCK
static final int LISTENER_TYPE_OBLOCK
- See Also:
- Constant Field Values
-
LISTENER_TYPE_ENTRYEXIT
static final int LISTENER_TYPE_ENTRYEXIT
- See Also:
- Constant Field Values
-
-
Method Detail
-
setEnabled
void setEnabled(boolean state)
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
void swapConditional(int nextInOrder, int row)
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
java.lang.String getConditionalByNumberOrder(int order)
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, and empty String is returned.- Parameters:
order
- order in which the Conditional calculates- Returns:
- system name of conditional or an empty String
-
addConditional
void addConditional(java.lang.String systemName, int order)
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
boolean addConditional(java.lang.String systemName, Conditional conditional)
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
Conditional getConditional(java.lang.String systemName)
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
java.lang.String[] deleteConditional(java.lang.String systemName)
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
-
-