Package adams.flow.condition.bool
Class HasLength
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<BooleanCondition>
,SizeOfHandler
,Stoppable
,BooleanCondition
,Serializable
public class HasLength extends AbstractBooleanCondition
Checks whether the array passing through has the required number of elements.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-min-length <int> (property: minLength) The minimum number of elements that the array needs to have, no lower bound if -1. default: 1 minimum: -1
-max-length <int> (property: maxLength) The maximum number of elements that the array can have, no upper bound if -1. default: -1 minimum: -1
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_MaxLength
the maximum number of elements.protected int
m_MinLength
the minimum number of elements.-
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 HasLength()
-
Method Summary
All Methods Instance 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(Actor owner, Token token)
Performs the actual evaluation.int
getMaxLength()
Returns the maximum number of elements the array can haveint
getMinLength()
Returns the minimum number of elements the array has to haveString
getQuickInfo()
Returns the quick info string to be displayed in the flow editor.String
globalInfo()
Returns a string describing the object.String
maxLengthTipText()
Returns the tip text for this property.String
minLengthTipText()
Returns the tip text for this property.void
setMaxLength(int value)
Sets the maximum number of elements the array can have.void
setMinLength(int value)
Sets the minimum number of elements the array has to have.-
Methods inherited from class adams.flow.condition.bool.AbstractBooleanCondition
evaluate, preEvaluate, setUp, shallowCopy, shallowCopy, stopExecution
-
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:
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 classAbstractOptionHandler
-
setMinLength
public void setMinLength(int value)
Sets the minimum number of elements the array has to have.- Parameters:
value
- the number of elements (-1: no lower bound)
-
getMinLength
public int getMinLength()
Returns the minimum number of elements the array has to have- Returns:
- the number of elements (-1: no lower bound)
-
minLengthTipText
public String minLengthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMaxLength
public void setMaxLength(int value)
Sets the maximum number of elements the array can have.- Parameters:
value
- the number of elements (-1: no upper bound)
-
getMaxLength
public int getMaxLength()
Returns the maximum number of elements the array can have- Returns:
- the number of elements (-1: no upper bound)
-
maxLengthTipText
public String maxLengthTipText()
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:
- the accepted classes
-
doEvaluate
protected boolean doEvaluate(Actor owner, Token token)
Performs the actual evaluation.- Specified by:
doEvaluate
in classAbstractBooleanCondition
- Parameters:
owner
- the owning actortoken
- the current token passing through- Returns:
- the result of the evaluation
-
-