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 classArithmeticQualifier.Test
-
Field Summary
Fields Modifier and Type Field Description (package private) ArithmeticQualifier.Testtest(package private) longvalue(package private) booleanwarnedDoesntExist-
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 booleanavailableStateFromValue(java.lang.Object now)Calculate whether a particular value for the qualifier Variable means that the qualified Object should be set Available or not.booleancurrentDesiredState()Does the current value of qualifier Variable means that the qualified object should be set Available or not?voidupdate()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:AbstractQualifierDoes the current value of qualifier Variable means that the qualified object should be set Available or not?- Specified by:
currentDesiredStatein interfaceQualifier- Specified by:
currentDesiredStatein classAbstractQualifier- Returns:
- true if should be set available
-
availableStateFromValue
protected boolean availableStateFromValue(java.lang.Object now)
Description copied from class:AbstractQualifierCalculate whether a particular value for the qualifier Variable means that the qualified Object should be set Available or not.- Specified by:
availableStateFromValuein classAbstractQualifier- Parameters:
now- base for the calculation- Returns:
- true if should be set available
-
-