Package adams.flow.template
Class IterateFilesWithProgressBar
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.template.AbstractActorTemplate
-
- adams.flow.template.IterateFilesWithProgressBar
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<AbstractActorTemplate>,SizeOfHandler,Serializable
public class IterateFilesWithProgressBar extends AbstractActorTemplate
Generates a sub-flow that looks for files in a directory and then iterates those. The progress is displayed using a ProgressBar.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The new name for the actor; leave empty to use current. default: process
-dir <adams.core.io.PlaceholderDirectory> (property: dir) The directory to search for files matching the regular expression. default: ${CWD}-regexp <adams.core.base.BaseRegExp> (property: regExp) The regular expression that the files must match. default: .* more: https://docs.oracle.com/javase/tutorial/essential/regex/ https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html
-recursive <boolean> (property: recursive) If enabled, the file search is performed recursively. default: false
-select-subset <boolean> (property: selectSubset) If enabled, the user can select a subset of the files. default: false
-num-files <adams.core.VariableName> (property: numFiles) The name of the variable to use for storing the total number of files located. default: num_files
-file-counter <adams.core.VariableName> (property: fileCounter) The name of the variable to use for storing the current count of files iterated. default: file_counter
-unfold-file-array <boolean> (property: unfoldFileArray) If enabled, the file array gets flattened using the adams.flow.transformer.ArrayToSequence transformer instead of processing files within the adams.flow.control.ArrayProcess control actor. default: true
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected PlaceholderDirectorym_Dirthe directory to search.protected VariableNamem_FileCounterthe counter variable.protected VariableNamem_NumFilesthe number of files variable.protected booleanm_Recursivewhether to search recursively.protected BaseRegExpm_RegExpthe regular expression to apply.protected booleanm_SelectSubsetwhether to let the user select a subset.protected booleanm_UnfoldFileArraywhether to unfold the array (ArrayToSequence) or not (ArrayProcess).-
Fields inherited from class adams.flow.template.AbstractActorTemplate
m_Name
-
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 IterateFilesWithProgressBar()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.StringdirTipText()Returns the tip text for this property.protected ActordoGenerate()Generates the actor.StringfileCounterTipText()Returns the tip text for this property.protected StringgetDefaultName()Returns the default name.PlaceholderDirectorygetDir()Returns the directory to search for files.VariableNamegetFileCounter()Returns the variable name to use for storing the current count of files iterated.VariableNamegetNumFiles()Returns the variable name to use for the total number of files found.booleangetRecursive()Returns whether to search for files recursively.BaseRegExpgetRegExp()Returns the regular expression that the files must match.booleangetSelectSubset()Returns whether to let the user select a subset.booleangetUnfoldFileArray()Returns whether to flatten the file array.StringglobalInfo()Returns a string describing the object.booleanisInteractive()Whether the flow generated is an interactive one.StringnumFilesTipText()Returns the tip text for this property.StringrecursiveTipText()Returns the tip text for this property.StringregExpTipText()Returns the tip text for this property.StringselectSubsetTipText()Returns the tip text for this property.voidsetDir(PlaceholderDirectory value)Sets the directory to search for files.voidsetFileCounter(VariableName value)Sets the variable name to use for storing the current count of files iterated.voidsetNumFiles(VariableName value)Sets the variable name to use for the total number of files found.voidsetRecursive(boolean value)Sets whether to search for files recursively.voidsetRegExp(BaseRegExp value)Sets the regular expressions that the files must match.voidsetSelectSubset(boolean value)Sets whether to let the user select a subset.voidsetUnfoldFileArray(boolean value)Sets whether to flatten the file array.StringunfoldFileArrayTipText()Returns the tip text for this property.-
Methods inherited from class adams.flow.template.AbstractActorTemplate
compareTo, equals, forCommandLine, forName, generate, getBaselineCorrections, getName, nameTipText, postGenerate, preGenerate, setName, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Dir
protected PlaceholderDirectory m_Dir
the directory to search.
-
m_RegExp
protected BaseRegExp m_RegExp
the regular expression to apply.
-
m_Recursive
protected boolean m_Recursive
whether to search recursively.
-
m_SelectSubset
protected boolean m_SelectSubset
whether to let the user select a subset.
-
m_NumFiles
protected VariableName m_NumFiles
the number of files variable.
-
m_FileCounter
protected VariableName m_FileCounter
the counter variable.
-
m_UnfoldFileArray
protected boolean m_UnfoldFileArray
whether to unfold the array (ArrayToSequence) or not (ArrayProcess).
-
-
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 classAbstractActorTemplate
-
getDefaultName
protected String getDefaultName()
Returns the default name.- Overrides:
getDefaultNamein classAbstractActorTemplate- Returns:
- the default
-
setDir
public void setDir(PlaceholderDirectory value)
Sets the directory to search for files.- Parameters:
value- the directory
-
getDir
public PlaceholderDirectory getDir()
Returns the directory to search for files.- Returns:
- the directory
-
dirTipText
public String dirTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRegExp
public void setRegExp(BaseRegExp value)
Sets the regular expressions that the files must match.- Parameters:
value- the expression
-
getRegExp
public BaseRegExp getRegExp()
Returns the regular expression that the files must match.- Returns:
- the expression
-
regExpTipText
public String regExpTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSelectSubset
public void setSelectSubset(boolean value)
Sets whether to let the user select a subset.- Parameters:
value- true if user can select
-
getSelectSubset
public boolean getSelectSubset()
Returns whether to let the user select a subset.- Returns:
- true if user can select
-
selectSubsetTipText
public String selectSubsetTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRecursive
public void setRecursive(boolean value)
Sets whether to search for files recursively.- Parameters:
value- true if recursive
-
getRecursive
public boolean getRecursive()
Returns whether to search for files recursively.- Returns:
- true if recursive
-
recursiveTipText
public String recursiveTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNumFiles
public void setNumFiles(VariableName value)
Sets the variable name to use for the total number of files found.- Parameters:
value- the variable name
-
getNumFiles
public VariableName getNumFiles()
Returns the variable name to use for the total number of files found.- Returns:
- the variable name
-
numFilesTipText
public String numFilesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFileCounter
public void setFileCounter(VariableName value)
Sets the variable name to use for storing the current count of files iterated.- Parameters:
value- the variable name
-
getFileCounter
public VariableName getFileCounter()
Returns the variable name to use for storing the current count of files iterated.- Returns:
- the variable name
-
fileCounterTipText
public String fileCounterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUnfoldFileArray
public void setUnfoldFileArray(boolean value)
Sets whether to flatten the file array.- Parameters:
value- true if to unfold
-
getUnfoldFileArray
public boolean getUnfoldFileArray()
Returns whether to flatten the file array.- Returns:
- true if to unfold
-
unfoldFileArrayTipText
public String unfoldFileArrayTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
isInteractive
public boolean isInteractive()
Whether the flow generated is an interactive one.- Specified by:
isInteractivein classAbstractActorTemplate- Returns:
- true if interactive
-
doGenerate
protected Actor doGenerate()
Generates the actor.- Specified by:
doGeneratein classAbstractActorTemplate- Returns:
- the generated acto
-
-