Package adams.flow.condition.bool
Class AbstractExpression
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.condition.bool.AbstractBooleanCondition
-
- adams.flow.condition.bool.AbstractExpression
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<BooleanCondition>
,SizeOfHandler
,Stoppable
,BooleanCondition
,GrammarSupplier
,Serializable
- Direct Known Subclasses:
Expression
public abstract class AbstractExpression extends AbstractBooleanCondition implements GrammarSupplier
Ancestor for conditions that use a boolean expression.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BooleanExpressionText
m_Expression
the "If" expression to evaluate.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractExpression()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the class that the consumer accepts.void
defineOptions()
Adds options to the internal list of options.protected boolean
doEvaluate(String exp, HashMap symbols)
Evaluates the condition.abstract String
expressionTipText()
Returns the tip text for this property.protected abstract BooleanExpressionText
getDefaultExpression()
Returns the default expression to use.BooleanExpressionText
getExpression()
Returns the expression to evaluate.String
getGrammar()
Returns a string representation of the grammar.String
getQuickInfo()
Returns the quick info string to be displayed in the flow editor.void
setExpression(BooleanExpressionText value)
Sets the expression to evaluate.void
setExpression(String value)
Sets the expression to evaluate.String
setUp(Actor owner)
Configures the condition.-
Methods inherited from class adams.flow.condition.bool.AbstractBooleanCondition
doEvaluate, evaluate, preEvaluate, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Expression
protected BooleanExpressionText m_Expression
the "If" expression to evaluate.
-
-
Method Detail
-
getGrammar
public String getGrammar()
Returns a string representation of the grammar.- Specified by:
getGrammar
in interfaceGrammarSupplier
- Returns:
- the grammar, null if not available
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
getDefaultExpression
protected abstract BooleanExpressionText getDefaultExpression()
Returns the default expression to use.- Returns:
- the default
-
setExpression
public void setExpression(String value)
Sets the expression to evaluate. Automatically wraps expressions in parentheses that consists only of a variable. Otherwise, the expresssion would get interpreted as attached variable for the expression option.- Parameters:
value
- the expression
-
setExpression
public void setExpression(BooleanExpressionText value)
Sets the expression to evaluate. Automatically wraps expressions in parentheses that consists only of a variable. Otherwise, the expresssion would get interpreted as attached variable for the expression option.- Parameters:
value
- the expression
-
getExpression
public BooleanExpressionText getExpression()
Returns the expression to evaluate.- Returns:
- the expression
-
expressionTipText
public abstract String expressionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns the quick info string to be displayed in the flow editor.- Specified by:
getQuickInfo
in interfaceBooleanCondition
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Specified by:
getQuickInfo
in classAbstractBooleanCondition
- Returns:
- the info or null if no info to be displayed
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Specified by:
accepts
in interfaceBooleanCondition
- Specified by:
accepts
in classAbstractBooleanCondition
- Returns:
- adams.flow.core.Unknown.class
-
setUp
public String setUp(Actor owner)
Configures the condition.- Specified by:
setUp
in interfaceBooleanCondition
- Overrides:
setUp
in classAbstractBooleanCondition
- Parameters:
owner
- the actor this condition belongs to- Returns:
- null if everything is fine, otherwise error message
-
-