Package adams.core
Class AbstractHistory<T>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.AbstractHistory<T>
-
- Type Parameters:
T
- the type of object to handler
- All Implemented Interfaces:
LoggingSupporter
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractPersistentHistory
public abstract class AbstractHistory<T> extends LoggingObject
Ancestor for classes maintaining a history of objects.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<T>
m_History
the history of objects.static int
MAX_HISTORY_COUNT
the maximum entries in the history.static int
MAX_HISTORY_LENGTH
the maximum length of a caption in the history.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractHistory()
Initializes the history.
-
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.protected abstract T
copy(T obj)
Creates a copy of the object.List<T>
getHistory()
Returns the current history.protected void
initialize()
Initializes members.int
size()
Returns the number of entries in the history.-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
MAX_HISTORY_COUNT
public static final int MAX_HISTORY_COUNT
the maximum entries in the history.- See Also:
- Constant Field Values
-
MAX_HISTORY_LENGTH
public static final int MAX_HISTORY_LENGTH
the maximum length of a caption in the history.- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
protected void initialize()
Initializes members.
-
copy
protected abstract T copy(T obj)
Creates a copy of the object.- Parameters:
obj
- the object to copy
-
clear
public void clear()
Clears the history.
-
add
public void add(T obj)
Adds the object to the history.- Parameters:
obj
- the object to add
-
size
public int size()
Returns the number of entries in the history.- Returns:
- the size of the history
-
-