Package jmri.jmrit.symbolicprog
Class ArithmeticQualifier
- java.lang.Object
-
- jmri.jmrit.symbolicprog.AbstractQualifier
-
- jmri.jmrit.symbolicprog.ArithmeticQualifier
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.util.EventListener
,Qualifier
- Direct Known Subclasses:
JComponentQualifier
,PaneQualifier
,ValueQualifier
public abstract class ArithmeticQualifier extends AbstractQualifier
Mechanism to qualify on the value of a number.The usual arithmetic operations are possible: ge, le, gt, lt, eq, ne. The sense of this is comparing "current value" to "constant", for example "current value gt 3".
You can also check whether the value "exists" (value of 1) or not (value of 0). Comparisons with the value of a non-existent variable always fail.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ArithmeticQualifier.Test
-
Field Summary
Fields Modifier and Type Field Description (package private) ArithmeticQualifier.Test
test
(package private) long
value
(package private) boolean
warnedDoesntExist
-
Fields inherited from class jmri.jmrit.symbolicprog.AbstractQualifier
watchedVal
-
-
Constructor Summary
Constructors Constructor Description ArithmeticQualifier(VariableValue watchedVal, int value, java.lang.String relation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
availableStateFromValue(java.lang.Object now)
Calculate whether a particular value for the qualifier Variable means that the qualified Object should be set Available or not.boolean
currentDesiredState()
Does the current value of qualifier Variable means that the qualified object should be set Available or not?void
update()
Process the current value and do whatever is needed.-
Methods inherited from class jmri.jmrit.symbolicprog.AbstractQualifier
availableStateFromEvent, currentAvailableState, getWatchedVariable, processValueChangeEvent, propertyChange, setWatchedAvailable
-
-
-
-
Field Detail
-
value
long value
-
warnedDoesntExist
boolean warnedDoesntExist
-
-
Constructor Detail
-
ArithmeticQualifier
public ArithmeticQualifier(VariableValue watchedVal, int value, java.lang.String relation)
-
-
Method Detail
-
currentDesiredState
public boolean currentDesiredState()
Description copied from class:AbstractQualifier
Does the current value of qualifier Variable means that the qualified object should be set Available or not?- Specified by:
currentDesiredState
in interfaceQualifier
- Specified by:
currentDesiredState
in classAbstractQualifier
- Returns:
- true if should be set available
-
availableStateFromValue
protected boolean availableStateFromValue(java.lang.Object now)
Description copied from class:AbstractQualifier
Calculate whether a particular value for the qualifier Variable means that the qualified Object should be set Available or not.- Specified by:
availableStateFromValue
in classAbstractQualifier
- Parameters:
now
- base for the calculation- Returns:
- true if should be set available
-
-