Package adams.parser
Class ActorTemplateSuggestion
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,GrammarSupplier,Serializable
public class ActorTemplateSuggestion extends AbstractExpressionEvaluator<AbstractActorTemplate> implements GrammarSupplier
Evaluates rules for suggesting actor templates.
It uses the following grammar:
expr_list ::= expr_list expr_part | expr_part ;
expr_part ::= boolexpr : <classname | "classname+options">;
boolexpr ::= ( boolean )
| boolean
| boolexpr AND boolexpr
| boolexpr OR boolexpr
| TRUE
| FALSE
| NOT boolexpr
| ISFIRST
| ISLAST
| PARENT IS <classname|interface>
| BEFORE STANDALONE
| AFTER STANDALONE
| BEFORE SOURCE
| AFTER SOURCE
| BEFORE TRANSFORMER
| AFTER TRANSFORMER
| BEFORE SINK
| AFTER SINK
| BEFORE <classname|interface>
| AFTER <classname|interface>
;
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-env <java.lang.String> (property: environment) The class to use for determining the environment. default: adams.env.Environment
-expression <java.lang.String> (property: expression) The rule for determining the actor template to propose (result is null if rul does not apply). default: TRUE: adams.flow.template.UpdateVariable
-parent <adams.flow.core.Actor> (property: parent) The parent actor to use. default: adams.flow.control.Flow
-position <int> (property: position) The position to add the proposed actor at. default: 0 minimum: 0
-actor <adams.flow.core.Actor> [-actor ...] (property: actors) The actors to insert the proposed actor in. default:
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Actor[]m_Actorsthe actors in which the proposed actor template gets inserted.protected Actorm_Parentthe parent of the proposed actor template.protected intm_Positionthe position the actor template is to be inserted at.-
Fields inherited from class adams.parser.AbstractExpressionEvaluator
m_Environment, m_Expression
-
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 ActorTemplateSuggestion()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringactorsTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.AbstractActorTemplateevaluate()Performs the evaluation.static AbstractActorTemplate[]evaluate(String[] expr, Actor parent, int position, Actor[] actors)Performs the evaluation.static AbstractActorTemplateevaluate(String expr, Actor parent, int position, Actor[] actors)Performs the evaluation.StringexpressionTipText()Returns the tip text for this property.Actor[]getActors()Returns the actors to insert the proposed actor in.protected StringgetDefaultExpression()Returns the default expression to use.StringgetGrammar()Returns a string representation of the grammar.ActorgetParent()Returns the current parent in use.intgetPosition()Returns the position to add the proposed actor at.StringglobalInfo()Returns a string describing the object.StringparentTipText()Returns the tip text for this property.StringpositionTipText()Returns the tip text for this property.voidsetActors(Actor[] value)Sets the actors to insert the proposed actor in.voidsetParent(Actor value)Sets the parent to use.voidsetPosition(int value)The position to add the proposed actor at.-
Methods inherited from class adams.parser.AbstractExpressionEvaluator
environmentTipText, forCommandLine, forName, getEnvironment, getExpression, runEvaluator, setEnvironment, setExpression
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, 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
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
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 classAbstractExpressionEvaluator<AbstractActorTemplate>
-
getDefaultExpression
protected String getDefaultExpression()
Returns the default expression to use.- Specified by:
getDefaultExpressionin classAbstractExpressionEvaluator<AbstractActorTemplate>- Returns:
- the default expression
-
expressionTipText
public String expressionTipText()
Returns the tip text for this property.- Specified by:
expressionTipTextin classAbstractExpressionEvaluator<AbstractActorTemplate>- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setParent
public void setParent(Actor value)
Sets the parent to use.- Parameters:
value- the parent
-
getParent
public Actor getParent()
Returns the current parent in use.- Returns:
- the parent
-
parentTipText
public String parentTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPosition
public void setPosition(int value)
The position to add the proposed actor at.- Parameters:
value- the position
-
getPosition
public int getPosition()
Returns the position to add the proposed actor at.- Returns:
- the position
-
positionTipText
public String positionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setActors
public void setActors(Actor[] value)
Sets the actors to insert the proposed actor in.- Parameters:
value- the actors
-
getActors
public Actor[] getActors()
Returns the actors to insert the proposed actor in.- Returns:
- the actors
-
actorsTipText
public String actorsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
evaluate
public AbstractActorTemplate evaluate() throws Exception
Performs the evaluation.- Specified by:
evaluatein classAbstractExpressionEvaluator<AbstractActorTemplate>- Returns:
- the evaluation, or null in case of error
- Throws:
Exception- if evaluation fails
-
evaluate
public static AbstractActorTemplate evaluate(String expr, Actor parent, int position, Actor[] actors) throws Exception
Performs the evaluation.- Parameters:
expr- the expression/rule to evaluateparent- the parent of the proposed actorposition- the position of the proposed actoractors- the actors to insert the proposed actor in- Returns:
- the proposed classname in case of a match, otherwise null
- Throws:
Exception- if evaluation fails
-
evaluate
public static AbstractActorTemplate[] evaluate(String[] expr, Actor parent, int position, Actor[] actors) throws Exception
Performs the evaluation.- Parameters:
expr- the expressions/rules to evaluateparent- the parent of the proposed actorposition- the position of the proposed actoractors- the actors to insert the proposed actor in- Returns:
- array with proposed classnames (cells are null if rule wasn't a match)
- Throws:
Exception- if evaluation fails
-
-