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 int
m_LoopLower
the lower bound of the for loop.protected int
m_LoopStep
the step size.protected int
m_LoopUpper
the 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 void
check()
Hook method for checks.void
defineOptions()
Adds options to the internal list of options.protected List<String>
doGenerate()
Generates the actual list.int
getLoopLower()
Returns the lower bound of the loop.int
getLoopStep()
Returns the step size.int
getLoopUpper()
Returns the upper bound of the loop.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
loopLowerTipText()
Returns the tip text for this property.String
loopStepTipText()
Returns the tip text for this property.String
loopUpperTipText()
Returns the tip text for this property.void
setLoopLower(int value)
Sets the lower bound of the loop.void
setLoopStep(int value)
Sets the step size.void
setLoopUpper(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:
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
-
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 Exception
Hook method for checks.
Ensures that loop setup makes sense.- Overrides:
check
in 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:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractListGenerator
- Returns:
- null if no info available, otherwise short string
-
doGenerate
protected List<String> doGenerate() throws Exception
Generates the actual list.- Specified by:
doGenerate
in classAbstractListGenerator
- Returns:
- the list of elements
- Throws:
Exception
- if generation fails
-
-