Package adams.core.io.lister
Class AbstractDirectoryLister
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.io.lister.AbstractDirectoryLister
-
- All Implemented Interfaces:
DirectoryLister
,LoggingLevelHandler
,LoggingSupporter
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,Serializable
- Direct Known Subclasses:
AbstractRecursiveDirectoryLister
public abstract class AbstractDirectoryLister extends CustomLoggingLevelObject implements DirectoryLister
Ancestor for directory listers.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_ListDirs
whether to list directories.protected boolean
m_ListFiles
whether to list files.protected int
m_MaxItems
the maximum number of files/dirs to return.protected BaseRegExp
m_RegExp
the regular expression for the files/dirs to match.protected boolean
m_SortDescending
whether to sort descending.protected Sorting
m_Sorting
the type of sorting to perform.protected boolean
m_Stopped
whether to stop the currently listing.protected String
m_WatchDir
the directory to watch.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractDirectoryLister()
Initializes the object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getDebug()
Returns whether debugging is turned on.boolean
getListDirs()
Returns whether to list directories or not.boolean
getListFiles()
Returns whether to list files or not.int
getMaxItems()
Returns the maximum number of items to return.BaseRegExp
getRegExp()
Returns the regular expression that the items have to match.boolean
getSortDescending()
Returns whether to sort in descending manner.Sorting
getSorting()
Returns the sorting type.String
getWatchDir()
Returns the directory to watch.boolean
isStopped()
Checks whether the list generation has been stopped.void
setDebug(boolean value)
Set debugging mode.void
setListDirs(boolean value)
Sets whether to list directories or not.void
setListFiles(boolean value)
Sets whether to list files or not.void
setMaxItems(int value)
Sets the maximum number of items to return.void
setRegExp(BaseRegExp value)
Sets the regular expressions that the items have to match.void
setSortDescending(boolean value)
Sets whether to sort in descending manner.void
setSorting(Sorting value)
Sets the sorting type.void
setWatchDir(String value)
Sets the directory to watch.void
stopExecution()
Stops the current list generation.String
toString()
A string representation of the object.-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
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.io.lister.DirectoryLister
hasParentDirectory, isLocal, list, listObjects, newDirectory, newDirectory
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
-
-
-
Field Detail
-
m_WatchDir
protected String m_WatchDir
the directory to watch.
-
m_ListDirs
protected boolean m_ListDirs
whether to list directories.
-
m_ListFiles
protected boolean m_ListFiles
whether to list files.
-
m_Sorting
protected Sorting m_Sorting
the type of sorting to perform.
-
m_SortDescending
protected boolean m_SortDescending
whether to sort descending.
-
m_MaxItems
protected int m_MaxItems
the maximum number of files/dirs to return.
-
m_RegExp
protected BaseRegExp m_RegExp
the regular expression for the files/dirs to match.
-
m_Stopped
protected boolean m_Stopped
whether to stop the currently listing.
-
-
Method Detail
-
setDebug
public void setDebug(boolean value)
Set debugging mode.- Parameters:
value
- true if debug output should be printed
-
getDebug
public boolean getDebug()
Returns whether debugging is turned on.- Returns:
- true if debugging output is on
-
setWatchDir
public void setWatchDir(String value)
Sets the directory to watch.- Specified by:
setWatchDir
in interfaceDirectoryLister
- Parameters:
value
- the directory
-
getWatchDir
public String getWatchDir()
Returns the directory to watch.- Specified by:
getWatchDir
in interfaceDirectoryLister
- Returns:
- the directory
-
setListDirs
public void setListDirs(boolean value)
Sets whether to list directories or not.- Specified by:
setListDirs
in interfaceDirectoryLister
- Parameters:
value
- true if directories are included in the list
-
getListDirs
public boolean getListDirs()
Returns whether to list directories or not.- Specified by:
getListDirs
in interfaceDirectoryLister
- Returns:
- true if directories are listed
-
setListFiles
public void setListFiles(boolean value)
Sets whether to list files or not.- Specified by:
setListFiles
in interfaceDirectoryLister
- Parameters:
value
- true if files are included in the list
-
getListFiles
public boolean getListFiles()
Returns whether to list files or not.- Specified by:
getListFiles
in interfaceDirectoryLister
- Returns:
- true if files are listed
-
setSorting
public void setSorting(Sorting value)
Sets the sorting type.- Specified by:
setSorting
in interfaceDirectoryLister
- Parameters:
value
- the sorting
-
getSorting
public Sorting getSorting()
Returns the sorting type.- Specified by:
getSorting
in interfaceDirectoryLister
- Returns:
- the sorting
-
setSortDescending
public void setSortDescending(boolean value)
Sets whether to sort in descending manner.- Specified by:
setSortDescending
in interfaceDirectoryLister
- Parameters:
value
- true if desending sort manner
-
getSortDescending
public boolean getSortDescending()
Returns whether to sort in descending manner.- Specified by:
getSortDescending
in interfaceDirectoryLister
- Returns:
- true if descending sort manner
-
setMaxItems
public void setMaxItems(int value)
Sets the maximum number of items to return.- Specified by:
setMaxItems
in interfaceDirectoryLister
- Parameters:
value
- the maximum number, <=0 means unbounded
-
getMaxItems
public int getMaxItems()
Returns the maximum number of items to return.- Specified by:
getMaxItems
in interfaceDirectoryLister
- Returns:
- the maximum number, <=0 means unbounded
-
setRegExp
public void setRegExp(BaseRegExp value)
Sets the regular expressions that the items have to match.- Specified by:
setRegExp
in interfaceDirectoryLister
- Parameters:
value
- the regular expression, "" matches all
-
getRegExp
public BaseRegExp getRegExp()
Returns the regular expression that the items have to match.- Specified by:
getRegExp
in interfaceDirectoryLister
- Returns:
- the regular expression, "" matches all
-
stopExecution
public void stopExecution()
Stops the current list generation.- Specified by:
stopExecution
in interfaceStoppable
-
isStopped
public boolean isStopped()
Checks whether the list generation has been stopped.- Specified by:
isStopped
in interfaceStoppableWithFeedback
- Returns:
- true if stopped
-
-