Interface Conditional
- All Superinterfaces:
Comparable<NamedBean>,NamedBean,PropertyChangeProvider
- All Known Implementing Classes:
DefaultConditional,SensorGroupConditional
A Conditional does not exist on its own, but is part of a Logix. The system name of each Conditional is set automatically when the conditional is created. It begins with the system name of its parent Logix. There is no Conditional Table. Conditionals are created, edited, and deleted via the Logix Table.
A Conditional has a "state", which changes depending on whether its logical expression calculates to TRUE or FALSE. The "state" may not be changed by the user. It only changes in response to changes in the "state variables" used in its logical expression.
Listeners may be set to monitor a change in the state of a conditional.
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 ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumstatic enumstatic enumstatic enumstatic enumNested 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 intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intNew Variable and Action type scheme for Logix UI.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final ResourceBundlestatic final ResourceBundlestatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic 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 TypeMethodDescriptionvoidRequest a call-back when the bound KnownState property changes.intcalculate(boolean enabled, PropertyChangeEvent evt) Calculate this Conditional, triggering either or both actions if the user specified conditions are met, and the Logix is enabled.voidcancelSensorTimer(String sname) Stop a sensor timer if one is actively delaying setting of the specified sensorvoidcancelTurnoutTimer(String sname) Stop a turnout timer if one is actively delaying setting of the specified turnoutvoiddispose()Remove references to and from this object, so that it can eventually be garbage-collected.Get antecedent (boolean expression) of ConditionalMake deep clone of actions.Make deep clone of variables.Get type of operators in the antecedent statementintgetState()State of the Conditional is returned.booleanvoidRemove a request for a call-back when a bound property changes.voidsetAction(List<ConditionalAction> arrayList) Set list of actionsvoidsetLogicType(Conditional.AntecedentOperator type, String antecedent) set the logic type (all AND's all OR's or mixed AND's and OR's set the antecedent expression - should be a well formed boolean statement with parenthesis indicating the order of evaluationvoidsetStateVariables(List<ConditionalVariable> arrayList) Set State Variables for this Conditional.voidsetTriggerOnChange(boolean trigger) Set policy for execution of action listvalidateAntecedent(String ant, List<ConditionalVariable> variableList) Check that an antecedent is well formed.Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setState, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
-
Field Details
-
rbx
-
rbxWarrant
-
FALSE
- See Also:
-
TRUE
- See Also:
-
ALL_AND
- See Also:
-
ALL_OR
- See Also:
-
MIXED
- See Also:
-
OPERATOR_AND
- See Also:
-
OPERATOR_NONE
- See Also:
-
OPERATOR_OR
- See Also:
-
TYPE_ERROR
- See Also:
-
TYPE_NONE
- See Also:
-
TYPE_SENSOR_ACTIVE
- See Also:
-
TYPE_SENSOR_INACTIVE
- See Also:
-
TYPE_TURNOUT_THROWN
- See Also:
-
TYPE_TURNOUT_CLOSED
- See Also:
-
TYPE_CONDITIONAL_TRUE
- See Also:
-
TYPE_CONDITIONAL_FALSE
- See Also:
-
TYPE_LIGHT_ON
- See Also:
-
TYPE_LIGHT_OFF
- See Also:
-
TYPE_MEMORY_EQUALS
- See Also:
-
TYPE_FAST_CLOCK_RANGE
- See Also:
-
TYPE_SIGNAL_HEAD_RED
- See Also:
-
TYPE_SIGNAL_HEAD_YELLOW
- See Also:
-
TYPE_SIGNAL_HEAD_GREEN
- See Also:
-
TYPE_SIGNAL_HEAD_DARK
- See Also:
-
TYPE_SIGNAL_HEAD_FLASHRED
- See Also:
-
TYPE_SIGNAL_HEAD_FLASHYELLOW
- See Also:
-
TYPE_SIGNAL_HEAD_FLASHGREEN
- See Also:
-
TYPE_SIGNAL_HEAD_LIT
- See Also:
-
TYPE_SIGNAL_HEAD_HELD
- See Also:
-
TYPE_MEMORY_COMPARE
- See Also:
-
TYPE_SIGNAL_HEAD_LUNAR
- See Also:
-
TYPE_SIGNAL_HEAD_FLASHLUNAR
- See Also:
-
TYPE_MEMORY_EQUALS_INSENSITIVE
- See Also:
-
TYPE_MEMORY_COMPARE_INSENSITIVE
- See Also:
-
TYPE_ROUTE_FREE
- See Also:
-
TYPE_ROUTE_OCCUPIED
- See Also:
-
TYPE_ROUTE_ALLOCATED
- See Also:
-
TYPE_ROUTE_SET
- See Also:
-
TYPE_TRAIN_RUNNING
- See Also:
-
TYPE_SIGNAL_MAST_ASPECT_EQUALS
- See Also:
-
TYPE_SIGNAL_MAST_LIT
- See Also:
-
TYPE_SIGNAL_MAST_HELD
- See Also:
-
TYPE_SIGNAL_HEAD_APPEARANCE_EQUALS
- See Also:
-
TYPE_BLOCK_STATUS_EQUALS
- See Also:
-
TYPE_ENTRYEXIT_ACTIVE
- See Also:
-
TYPE_ENTRYEXIT_INACTIVE
- See Also:
-
TYPE_OBLOCK_UNOCCUPIED
- See Also:
-
TYPE_OBLOCK_OCCUPIED
- See Also:
-
TYPE_OBLOCK_ALLOCATED
- See Also:
-
TYPE_OBLOCK_RUNNING
- See Also:
-
TYPE_OBLOCK_OUT_OF_SERVICE
- See Also:
-
TYPE_OBLOCK_DARK
- See Also:
-
TYPE_OBLOCK_POWER_ERROR
- See Also:
-
TYPE_XXXXXXX
- See Also:
-
ACTION_OPTION_ON_CHANGE_TO_TRUE
- See Also:
-
ACTION_OPTION_ON_CHANGE_TO_FALSE
- See Also:
-
ACTION_OPTION_ON_CHANGE
- See Also:
-
NUM_ACTION_OPTIONS
- See Also:
-
ACTION_NONE
- See Also:
-
ACTION_SET_TURNOUT
- See Also:
-
ACTION_SET_SIGNAL_APPEARANCE
- See Also:
-
ACTION_SET_SIGNAL_HELD
- See Also:
-
ACTION_CLEAR_SIGNAL_HELD
- See Also:
-
ACTION_SET_SIGNAL_DARK
- See Also:
-
ACTION_SET_SIGNAL_LIT
- See Also:
-
ACTION_TRIGGER_ROUTE
- See Also:
-
ACTION_SET_SENSOR
- See Also:
-
ACTION_DELAYED_SENSOR
- See Also:
-
ACTION_SET_LIGHT
- See Also:
-
ACTION_SET_MEMORY
- See Also:
-
ACTION_ENABLE_LOGIX
- See Also:
-
ACTION_DISABLE_LOGIX
- See Also:
-
ACTION_PLAY_SOUND
- See Also:
-
ACTION_RUN_SCRIPT
- See Also:
-
ACTION_DELAYED_TURNOUT
- See Also:
-
ACTION_LOCK_TURNOUT
- See Also:
-
ACTION_RESET_DELAYED_SENSOR
- See Also:
-
ACTION_CANCEL_SENSOR_TIMERS
- See Also:
-
ACTION_RESET_DELAYED_TURNOUT
- See Also:
-
ACTION_CANCEL_TURNOUT_TIMERS
- See Also:
-
ACTION_SET_FAST_CLOCK_TIME
- See Also:
-
ACTION_START_FAST_CLOCK
- See Also:
-
ACTION_STOP_FAST_CLOCK
- See Also:
-
ACTION_COPY_MEMORY
- See Also:
-
ACTION_SET_LIGHT_INTENSITY
- See Also:
-
ACTION_SET_LIGHT_TRANSITION_TIME
- See Also:
-
ACTION_CONTROL_AUDIO
- See Also:
-
ACTION_JYTHON_COMMAND
- See Also:
-
ACTION_ALLOCATE_WARRANT_ROUTE
- See Also:
-
ACTION_DEALLOCATE_WARRANT_ROUTE
- See Also:
-
ACTION_SET_ROUTE_TURNOUTS
- See Also:
-
ACTION_AUTO_RUN_WARRANT
- See Also:
-
ACTION_CONTROL_TRAIN
- See Also:
-
ACTION_SET_TRAIN_ID
- See Also:
-
ACTION_SET_SIGNALMAST_ASPECT
- See Also:
-
ACTION_GET_TRAIN_LOCATION
- See Also:
-
ACTION_SET_SIGNALMAST_HELD
- See Also:
-
ACTION_CLEAR_SIGNALMAST_HELD
- See Also:
-
ACTION_SET_SIGNALMAST_DARK
- See Also:
-
ACTION_SET_SIGNALMAST_LIT
- See Also:
-
ACTION_SET_BLOCK_ERROR
- See Also:
-
ACTION_CLEAR_BLOCK_ERROR
- See Also:
-
ACTION_DEALLOCATE_BLOCK
- See Also:
-
ACTION_SET_BLOCK_OUT_OF_SERVICE
- See Also:
-
ACTION_SET_BLOCK_IN_SERVICE
- See Also:
-
ACTION_MANUAL_RUN_WARRANT
- See Also:
-
ACTION_SET_TRAIN_NAME
- See Also:
-
ACTION_SET_BLOCK_VALUE
- See Also:
-
ACTION_SET_NXPAIR_ENABLED
- See Also:
-
ACTION_SET_NXPAIR_DISABLED
- See Also:
-
ACTION_SET_NXPAIR_SEGMENT
- See Also:
-
ACTION_GET_BLOCK_WARRANT
- See Also:
-
ACTION_GET_BLOCK_TRAIN_NAME
- See Also:
-
ITEM_TYPE_SENSOR
New Variable and Action type scheme for Logix UI. State Variables and actions are grouped according to type. Variable and action types share the following group categories:- See Also:
-
ITEM_TYPE_TURNOUT
- See Also:
-
ITEM_TYPE_LIGHT
- See Also:
-
ITEM_TYPE_SIGNALHEAD
- See Also:
-
ITEM_TYPE_SIGNALMAST
- See Also:
-
ITEM_TYPE_MEMORY
- See Also:
-
ITEM_TYPE_CONDITIONAL
- See Also:
-
ITEM_TYPE_LOGIX
- See Also:
-
ITEM_TYPE_WARRANT
- See Also:
-
ITEM_TYPE_CLOCK
- See Also:
-
ITEM_TYPE_OBLOCK
- See Also:
-
ITEM_TYPE_ENTRYEXIT
- See Also:
-
ITEM_TYPE_AUDIO
- See Also:
-
ITEM_TYPE_SCRIPT
- See Also:
-
ITEM_TYPE_OTHER
- See Also:
-
-
Method Details
-
setLogicType
set the logic type (all AND's all OR's or mixed AND's and OR's set the antecedent expression - should be a well formed boolean statement with parenthesis indicating the order of evaluation- Parameters:
type- the typeantecedent- the expression
-
getAntecedentExpression
Get antecedent (boolean expression) of Conditional- Returns:
- the expression
-
getLogicType
Get type of operators in the antecedent statement- Returns:
- the type
-
getTriggerOnChange
boolean getTriggerOnChange()- Returns:
- true if action list is executed only when state changes, false if action list is executed on every calculation of state
-
setTriggerOnChange
Set policy for execution of action list- Parameters:
trigger- true execute only on change of state
-
setAction
Set list of actions- Parameters:
arrayList- the actions
-
getCopyOfActions
Make deep clone of actions.- Returns:
- a list of copies of actions
-
setStateVariables
Set State Variables for this Conditional. Each state variable will evaluate either True or False when this Conditional is calculated.This method assumes that all information has been validated.
- Parameters:
arrayList- the list of variables
-
getCopyOfStateVariables
Make deep clone of variables.- Returns:
- a list containing copies of variables
-
calculate
Calculate this Conditional, triggering either or both actions if the user specified conditions are met, and the Logix is enabled. Sets the state of the conditional. Returns the calculated state of this Conditional.- Parameters:
enabled- true if Logix should be enabled; false otherwiseevt- event to trigger if true- Returns:
- the new state
-
validateAntecedent
@CheckForNull String validateAntecedent(@Nonnull String ant, List<ConditionalVariable> variableList) Check that an antecedent is well formed. If not, returns an error message. Otherwise returns null.- Parameters:
ant- the expressionvariableList- list of variables- Returns:
- true if well formed; false otherwise
-
cancelSensorTimer
Stop a sensor timer if one is actively delaying setting of the specified sensor- Parameters:
sname- the name of the timer
-
cancelTurnoutTimer
Stop a turnout timer if one is actively delaying setting of the specified turnout- Parameters:
sname- the name of the timer
-
getState
int getState()State of the Conditional is returned. -
addPropertyChangeListener
Request a call-back when the bound KnownState property changes.- Specified by:
addPropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
l- the listener
-
removePropertyChangeListener
Remove a request for a call-back when a bound property changes.- Specified by:
removePropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
l- the listener
-
dispose
void dispose()Remove references to and from this object, so that it can eventually be garbage-collected.
-