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 classMultiMonitor.CombinationTypeDefines how to combine the results from the base monitors.
-
Field Summary
Fields Modifier and Type Field Description protected MultiMonitor.CombinationTypem_CombinationTypethe combination.protected FileChangeMonitor[]m_Monitorsthe 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 booleancheckChange(File file)Performs the actual check whether the file has changed.StringcombinationTypeTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.protected StringdoInitialize(File file)Performs the actual initialization of the monitor with the specified file.protected StringdoUpdate(File file)Performs the actual updating of the monitor with the specified file.MultiMonitor.CombinationTypegetCombinationType()Returns how to combine the results of the monitors.FileChangeMonitor[]getMonitors()Returns the monitors to apply.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.StringglobalInfo()Returns a string describing the object.StringmonitorsTipText()Returns the tip text for this property.voidsetCombinationType(MultiMonitor.CombinationType value)Sets how to combine the results of the monitors.voidsetMonitors(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:
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
-
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:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin 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:
doInitializein 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:
checkChangein 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:
doUpdatein classAbstractFileChangeMonitor- Parameters:
file- the file to update with- Returns:
- null if successful, otherwise error message
-
-