Class FileContainer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.gui.tools.wekainvestigator.data.AbstractDataContainer
-
- adams.gui.tools.wekainvestigator.data.FileContainer
-
- All Implemented Interfaces:
adams.core.CleanUpHandler
,adams.core.logging.LoggingSupporter
,adams.core.SizeOfHandler
,adams.gui.core.UndoHandler
,adams.gui.core.UndoHandlerWithQuickAccess
,adams.gui.event.UndoListener
,DataContainer
,MonitoringDataContainer
,Serializable
,Comparable<DataContainer>
,EventListener
public class FileContainer extends AbstractDataContainer implements MonitoringDataContainer
File-based dataset.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.core.converters.AbstractFileLoader
m_Loader
the reader used to load the data.protected adams.core.io.filechanged.FileChangeMonitor
m_Monitor
the file monitor to use.protected File
m_Source
the source.-
Fields inherited from class adams.gui.tools.wekainvestigator.data.AbstractDataContainer
m_Data, m_ID, m_IDCounter, m_LastUpdated, m_Modified, m_Undo
-
-
Constructor Summary
Constructors Constructor Description FileContainer(weka.core.converters.AbstractFileLoader loader, adams.core.io.PlaceholderFile source)
Loads the data using the specified loader.FileContainer(weka.core.converters.AbstractFileLoader loader, File source)
Loads the data using the specified loader.FileContainer(weka.core.converters.AbstractFileLoader loader, File source, weka.core.Instances data)
Uses the provided data, but also stores the reader/file for reloading it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyUndoData(Serializable[] data)
Restores the data from the undo point.boolean
canReload()
Whether it is possible to reload this item.void
cleanUp()
Cleans up data structures, frees up memory.protected String
doReload()
Reloads the data.String
getSource()
Returns the source of the data item.protected Serializable[]
getUndoData()
Returns the data to store in the undo.boolean
hasSourceChanged()
Returns true if the source has changed.void
setModified(boolean value)
Sets whether the data has been modified.-
Methods inherited from class adams.gui.tools.wekainvestigator.data.AbstractDataContainer
addUndoPoint, compareTo, equals, getData, getID, getUndo, handleException, isModified, isUndoSupported, lastUpdated, nextID, redo, reload, setData, setUndo, toString, undo, undoOccurred
-
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 java.lang.Comparable
compareTo
-
Methods inherited from interface adams.gui.tools.wekainvestigator.data.DataContainer
getData, getID, isModified, lastUpdated, reload, setData
-
-
-
-
Field Detail
-
m_Source
protected File m_Source
the source.
-
m_Loader
protected weka.core.converters.AbstractFileLoader m_Loader
the reader used to load the data.
-
m_Monitor
protected adams.core.io.filechanged.FileChangeMonitor m_Monitor
the file monitor to use.
-
-
Constructor Detail
-
FileContainer
public FileContainer(weka.core.converters.AbstractFileLoader loader, adams.core.io.PlaceholderFile source)
Loads the data using the specified loader.- Parameters:
loader
- the loader to usesource
- the file to load
-
FileContainer
public FileContainer(weka.core.converters.AbstractFileLoader loader, File source)
Loads the data using the specified loader.- Parameters:
loader
- the loader to usesource
- the file to load
-
FileContainer
public FileContainer(weka.core.converters.AbstractFileLoader loader, File source, weka.core.Instances data)
Uses the provided data, but also stores the reader/file for reloading it.- Parameters:
loader
- the loader to usesource
- the file to loaddata
- the data to use
-
-
Method Detail
-
getSource
public String getSource()
Returns the source of the data item.- Specified by:
getSource
in interfaceDataContainer
- Returns:
- the source
-
canReload
public boolean canReload()
Whether it is possible to reload this item.- Specified by:
canReload
in interfaceDataContainer
- Returns:
- true if reloadable
-
doReload
protected String doReload()
Reloads the data.- Specified by:
doReload
in classAbstractDataContainer
- Returns:
- null if successfully reloaded, otherwise error message
-
setModified
public void setModified(boolean value)
Sets whether the data has been modified.- Specified by:
setModified
in interfaceDataContainer
- Overrides:
setModified
in classAbstractDataContainer
- Parameters:
value
- true if modified
-
hasSourceChanged
public boolean hasSourceChanged()
Returns true if the source has changed.- Specified by:
hasSourceChanged
in interfaceMonitoringDataContainer
- Returns:
- true if changed
-
getUndoData
protected Serializable[] getUndoData()
Returns the data to store in the undo.- Overrides:
getUndoData
in classAbstractDataContainer
- Returns:
- the undo point
-
applyUndoData
protected void applyUndoData(Serializable[] data)
Restores the data from the undo point.- Overrides:
applyUndoData
in classAbstractDataContainer
- Parameters:
data
- the undo point
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceadams.core.CleanUpHandler
- Overrides:
cleanUp
in classAbstractDataContainer
-
-