Package jmri.jmrit.symbolicprog
Class AbstractQualifier
- java.lang.Object
-
- jmri.jmrit.symbolicprog.AbstractQualifier
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.util.EventListener,Qualifier
- Direct Known Subclasses:
ArithmeticQualifier
public abstract class AbstractQualifier extends java.lang.Object implements Qualifier, java.beans.PropertyChangeListener
Watches a specific Variable to qualify another object, e.g. another Variable or a Pane.The "qualifier" variable is the one being watched; its properties control whether the "qualified" Object is available or not.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) VariableValuewatchedVal
-
Constructor Summary
Constructors Constructor Description AbstractQualifier(VariableValue watchedVal)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleanavailableStateFromEvent(java.beans.PropertyChangeEvent e)Calculate whether this PropertyChangeEvent means that the qualified Object should be set Available or not.protected abstract booleanavailableStateFromValue(java.lang.Object value)Calculate whether a particular value for the qualifier Variable means that the qualified Object should be set Available or not.protected abstract booleancurrentAvailableState()Retrieve the current "available" state from the qualified Object.abstract booleancurrentDesiredState()Does the current value of qualifier Variable means that the qualified object should be set Available or not?VariableValuegetWatchedVariable()(package private) voidprocessValueChangeEvent(java.beans.PropertyChangeEvent e)Process Value property change from the qualifier Variable (one being watched).voidpropertyChange(java.beans.PropertyChangeEvent e)Process property change from the qualifier Variable (one being watched).abstract voidsetWatchedAvailable(boolean enable)Drive the available or not state of the qualified Object.
-
-
-
Field Detail
-
watchedVal
VariableValue watchedVal
-
-
Constructor Detail
-
AbstractQualifier
public AbstractQualifier(VariableValue watchedVal)
-
-
Method Detail
-
getWatchedVariable
public VariableValue getWatchedVariable()
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Process property change from the qualifier Variable (one being watched).Follows changes "Value" property, which it assumes is an Integer.
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener- Parameters:
e- The event that triggered the query
-
processValueChangeEvent
void processValueChangeEvent(java.beans.PropertyChangeEvent e)
Process Value property change from the qualifier Variable (one being watched).- Parameters:
e- The event that triggered the query
-
availableStateFromEvent
protected boolean availableStateFromEvent(java.beans.PropertyChangeEvent e)
Calculate whether this PropertyChangeEvent means that the qualified Object should be set Available or not.- Parameters:
e- The event that triggered the query- Returns:
- true if should be set available
-
currentAvailableState
protected abstract boolean currentAvailableState()
Retrieve the current "available" state from the qualified Object.- Returns:
- true if available
-
currentDesiredState
public abstract boolean currentDesiredState()
Does the current value of qualifier Variable means that the qualified object should be set Available or not?- Specified by:
currentDesiredStatein interfaceQualifier- Returns:
- true if should be set available
-
availableStateFromValue
protected abstract boolean availableStateFromValue(java.lang.Object value)
Calculate whether a particular value for the qualifier Variable means that the qualified Object should be set Available or not.- Parameters:
value- base for the calculation- Returns:
- true if should be set available
-
setWatchedAvailable
public abstract void setWatchedAvailable(boolean enable)
Drive the available or not state of the qualified Object.Subclasses implement this to control a specific type of qualified Object, like a Variable or Pane.
- Specified by:
setWatchedAvailablein interfaceQualifier- Parameters:
enable- true if should be enabled
-
-