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 BooleanExpressionTextm_Expressionthe "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.voiddefineOptions()Adds options to the internal list of options.protected booleandoEvaluate(String exp, HashMap symbols)Evaluates the condition.abstract StringexpressionTipText()Returns the tip text for this property.protected abstract BooleanExpressionTextgetDefaultExpression()Returns the default expression to use.BooleanExpressionTextgetExpression()Returns the expression to evaluate.StringgetGrammar()Returns a string representation of the grammar.StringgetQuickInfo()Returns the quick info string to be displayed in the flow editor.voidsetExpression(BooleanExpressionText value)Sets the expression to evaluate.voidsetExpression(String value)Sets the expression to evaluate.StringsetUp(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:
getGrammarin interfaceGrammarSupplier- Returns:
- the grammar, null if not available
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin 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:
getQuickInfoin interfaceBooleanCondition- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Specified by:
getQuickInfoin 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:
acceptsin interfaceBooleanCondition- Specified by:
acceptsin classAbstractBooleanCondition- Returns:
- adams.flow.core.Unknown.class
-
setUp
public String setUp(Actor owner)
Configures the condition.- Specified by:
setUpin interfaceBooleanCondition- Overrides:
setUpin classAbstractBooleanCondition- Parameters:
owner- the actor this condition belongs to- Returns:
- null if everything is fine, otherwise error message
-
-