Package adams.core.io.filechanged
Class MultiMonitor
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.io.filechanged.AbstractFileChangeMonitor
-
- adams.core.io.filechanged.MultiMonitor
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,FileChangeMonitor
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
public class MultiMonitor extends AbstractFileChangeMonitor
Combines the results of the specified monitors according to the combination type. Uses short-circuit evaluation.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MultiMonitor.CombinationType
Defines how to combine the results from the base monitors.
-
Field Summary
Fields Modifier and Type Field Description protected MultiMonitor.CombinationType
m_CombinationType
the combination.protected FileChangeMonitor[]
m_Monitors
the base monitors to use.-
Fields inherited from class adams.core.io.filechanged.AbstractFileChangeMonitor
m_File, m_Initialized
-
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 MultiMonitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
checkChange(File file)
Performs the actual check whether the file has changed.String
combinationTypeTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected String
doInitialize(File file)
Performs the actual initialization of the monitor with the specified file.protected String
doUpdate(File file)
Performs the actual updating of the monitor with the specified file.MultiMonitor.CombinationType
getCombinationType()
Returns how to combine the results of the monitors.FileChangeMonitor[]
getMonitors()
Returns the monitors to apply.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.String
globalInfo()
Returns a string describing the object.String
monitorsTipText()
Returns the tip text for this property.void
setCombinationType(MultiMonitor.CombinationType value)
Sets how to combine the results of the monitors.void
setMonitors(FileChangeMonitor[] value)
Sets the monitors to apply.-
Methods inherited from class adams.core.io.filechanged.AbstractFileChangeMonitor
checkFile, getMonitoredFile, hasChanged, initialize, isInitialized, reset, update
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, 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
-
-
-
-
Field Detail
-
m_Monitors
protected FileChangeMonitor[] m_Monitors
the base monitors to use.
-
m_CombinationType
protected MultiMonitor.CombinationType m_CombinationType
the combination.
-
-
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
-
setMonitors
public void setMonitors(FileChangeMonitor[] value)
Sets the monitors to apply.- Parameters:
value
- the monitors
-
getMonitors
public FileChangeMonitor[] getMonitors()
Returns the monitors to apply.- Returns:
- the monitors
-
monitorsTipText
public String monitorsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCombinationType
public void setCombinationType(MultiMonitor.CombinationType value)
Sets how to combine the results of the monitors.- Parameters:
value
- the type
-
getCombinationType
public MultiMonitor.CombinationType getCombinationType()
Returns how to combine the results of the monitors.- Returns:
- the type
-
combinationTypeTipText
public String combinationTypeTipText()
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 a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractFileChangeMonitor
- Returns:
- null if no info available, otherwise short string
-
doInitialize
protected String doInitialize(File file)
Performs the actual initialization of the monitor with the specified file.- Specified by:
doInitialize
in classAbstractFileChangeMonitor
- Parameters:
file
- the file to initialize with- Returns:
- null if successful, otherwise error message
-
checkChange
protected boolean checkChange(File file)
Performs the actual check whether the file has changed.- Specified by:
checkChange
in classAbstractFileChangeMonitor
- Parameters:
file
- the file to check- Returns:
- true if changed
-
doUpdate
protected String doUpdate(File file)
Performs the actual updating of the monitor with the specified file.- Specified by:
doUpdate
in classAbstractFileChangeMonitor
- Parameters:
file
- the file to update with- Returns:
- null if successful, otherwise error message
-
-