Package adams.flow.condition.bool
Class Scripted
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,FileBasedScripting
,FileBasedScriptingWithOptions
,ShallowCopySupporter<BooleanCondition>
,SizeOfHandler
,Stoppable
,BooleanCondition
,Serializable
public class Scripted extends AbstractScriptedCondition
A boolean condition that uses the condition defined in an external script.
Valid options are:
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-script <adams.core.io.PlaceholderFile> (property: scriptFile) The script file to load and execute. default: ${CWD}
-options <java.lang.String> (property: scriptOptions) The options for the script. default:
-handler <adams.core.scripting.AbstractScriptingHandler> (property: handler) The handler to use for scripting. default: adams.core.scripting.Dummy
- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
adams.core.scripting.Scripted
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BooleanCondition
m_ConditionObject
the loaded script object.protected AbstractScriptingHandler
m_Handler
the scripting handler to use.-
Fields inherited from class adams.flow.condition.bool.AbstractScriptedCondition
m_ScriptFile, m_ScriptObject, m_ScriptOptions
-
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 Scripted()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
checkScriptObject()
Checks the script object.void
defineOptions()
Adds options to the internal list of options.protected boolean
doScriptEvaluate(Actor owner, Token token)
Runs the script evaluation.AbstractScriptingHandler
getHandler()
Gets the handler to use for scripting.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
globalInfo()
Returns a string describing the object.String
handlerTipText()
Returns the tip text for this property.protected String
loadScriptObject()
Loads the scripts object and sets its options.void
setHandler(AbstractScriptingHandler value)
Sets the handler to use for scripting.void
stopExecution()
Stops the execution.-
Methods inherited from class adams.flow.condition.bool.AbstractScriptedCondition
accepts, doEvaluate, getScriptFile, getScriptOptions, initScriptObject, reset, scriptFileTipText, scriptOptionsTipText, setScriptFile, setScriptOptions, setUp
-
Methods inherited from class adams.flow.condition.bool.AbstractBooleanCondition
evaluate, preEvaluate, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, 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_ConditionObject
protected transient BooleanCondition m_ConditionObject
the loaded script object.
-
m_Handler
protected AbstractScriptingHandler m_Handler
the scripting handler to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractScriptedCondition
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceBooleanCondition
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractScriptedCondition
- Returns:
- null if no info available, otherwise short string
-
setHandler
public void setHandler(AbstractScriptingHandler value)
Sets the handler to use for scripting.- Parameters:
value
- the handler
-
getHandler
public AbstractScriptingHandler getHandler()
Gets the handler to use for scripting.- Returns:
- the handler
-
handlerTipText
public String handlerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
loadScriptObject
protected String loadScriptObject()
Loads the scripts object and sets its options.- Specified by:
loadScriptObject
in classAbstractScriptedCondition
- Returns:
- null if OK, otherwise the error message
-
checkScriptObject
protected String checkScriptObject()
Checks the script object.- Specified by:
checkScriptObject
in classAbstractScriptedCondition
- Returns:
- always null, i.e., OK
-
doScriptEvaluate
protected boolean doScriptEvaluate(Actor owner, Token token)
Runs the script evaluation.- Specified by:
doScriptEvaluate
in classAbstractScriptedCondition
- Returns:
- the boolean result of the evaluation
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceBooleanCondition
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractBooleanCondition
-
-