Package adams.core
Class AbstractPersistentHistory<T>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.AbstractHistory<T>
-
- adams.core.AbstractPersistentHistory<T>
-
- Type Parameters:
T
- the type of objects to handler
- All Implemented Interfaces:
LoggingSupporter
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractFileBasedHistory
,PersistentObjectHistory
,StringHistory
public abstract class AbstractPersistentHistory<T> extends AbstractHistory<T>
Ancestor of classes for maintaining a history of objects that are stored on disk.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected PlaceholderFile
m_HistoryFile
the file to save the history to.-
Fields inherited from class adams.core.AbstractHistory
m_History, MAX_HISTORY_COUNT, MAX_HISTORY_LENGTH
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractPersistentHistory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
add(T obj)
Adds the object to the history.void
clear()
Clears the history.PlaceholderFile
getHistoryFile()
Returns the file to load from/save to.protected void
initialize()
Initializes members.protected abstract boolean
load()
Loads the history from disk.protected abstract boolean
save()
Saves the history to disk.void
setHistoryFile(PlaceholderFile value)
Sets the file to load from/save to.-
Methods inherited from class adams.core.AbstractHistory
copy, getHistory, size
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_HistoryFile
protected PlaceholderFile m_HistoryFile
the file to save the history to.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes members.- Overrides:
initialize
in classAbstractHistory<T>
-
clear
public void clear()
Clears the history.- Overrides:
clear
in classAbstractHistory<T>
-
setHistoryFile
public void setHistoryFile(PlaceholderFile value)
Sets the file to load from/save to.- Parameters:
value
- the history file
-
getHistoryFile
public PlaceholderFile getHistoryFile()
Returns the file to load from/save to.- Returns:
- the history file
-
add
public void add(T obj)
Adds the object to the history.- Overrides:
add
in classAbstractHistory<T>
- Parameters:
obj
- the object to add
-
save
protected abstract boolean save()
Saves the history to disk.- Returns:
- true if successfully saved
-
load
protected abstract boolean load()
Loads the history from disk.- Returns:
- true if successfully loaded
-
-