Package adams.flow.source.newlist
Class ForLoop
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<AbstractListGenerator>,SizeOfHandler,Serializable
public class ForLoop extends AbstractListGenerator
Emulates the following for-loop for integer IDs:
- positive step size:
for (int i = lower; i <= upper; i += step)
- negative step size:
for (int i = upper; i >= lower; i += step)
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-lower <int> (property: loopLower) The lower bound of the loop (= the first value). default: 1
-upper <int> (property: loopUpper) The upper bound of the loop. default: 10
-step <int> (property: loopStep) The step size of the loop. default: 1
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_LoopLowerthe lower bound of the for loop.protected intm_LoopStepthe step size.protected intm_LoopUpperthe upper bound of the for loop.-
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 ForLoop()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheck()Hook method for checks.voiddefineOptions()Adds options to the internal list of options.protected List<String>doGenerate()Generates the actual list.intgetLoopLower()Returns the lower bound of the loop.intgetLoopStep()Returns the step size.intgetLoopUpper()Returns the upper bound of the loop.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringglobalInfo()Returns a string describing the object.StringloopLowerTipText()Returns the tip text for this property.StringloopStepTipText()Returns the tip text for this property.StringloopUpperTipText()Returns the tip text for this property.voidsetLoopLower(int value)Sets the lower bound of the loop.voidsetLoopStep(int value)Sets the step size.voidsetLoopUpper(int value)Sets the upper bound of the loop.-
Methods inherited from class adams.flow.source.newlist.AbstractListGenerator
generate, shallowCopy, shallowCopy
-
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
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setLoopLower
public void setLoopLower(int value)
Sets the lower bound of the loop.- Parameters:
value- the lower bound
-
getLoopLower
public int getLoopLower()
Returns the lower bound of the loop.- Returns:
- the lower bound
-
loopLowerTipText
public String loopLowerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLoopUpper
public void setLoopUpper(int value)
Sets the upper bound of the loop.- Parameters:
value- the upper bound
-
getLoopUpper
public int getLoopUpper()
Returns the upper bound of the loop.- Returns:
- the upper bound
-
loopUpperTipText
public String loopUpperTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLoopStep
public void setLoopStep(int value)
Sets the step size.- Parameters:
value- the step size
-
getLoopStep
public int getLoopStep()
Returns the step size.- Returns:
- the step size
-
loopStepTipText
public String loopStepTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
check
protected void check() throws ExceptionHook method for checks.
Ensures that loop setup makes sense.- Overrides:
checkin classAbstractListGenerator- Throws:
Exception- if check fails
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractListGenerator- Returns:
- null if no info available, otherwise short string
-
doGenerate
protected List<String> doGenerate() throws Exception
Generates the actual list.- Specified by:
doGeneratein classAbstractListGenerator- Returns:
- the list of elements
- Throws:
Exception- if generation fails
-
-