public class QueryHistory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
currentPosition
Current position in the history list
|
private static QueryHistory |
instance
Singleton instance
|
private static org.apache.log4j.Logger |
LOGGER
Logger
|
private static int |
MAXIMUM_HISTORY_ENTRIES
Maximum size of the query history list
|
private java.util.List<QueryInfo> |
queryHistoryList
Collection of historical queries
|
Modifier | Constructor and Description |
---|---|
private |
QueryHistory()
Private constructor for Singleton
|
Modifier and Type | Method and Description |
---|---|
void |
addQuery(QueryInfo query)
Places the query at end of list and changes current position to point to
that query.
|
private void |
appendQuery(QueryInfo query)
Append a query at the end of the history list.
|
void |
clearAllQueries()
Remove all queries from history
|
void |
deleteQueryAtIndex(int index)
Delete the query at the SQL index position given.
|
private void |
enforceSize()
Ensure that the size of the history list does not go beyond the defined
maximum size
|
QueryInfo |
getCurrentQueryInfo()
Get the query info for the current query position in the history list.
|
private int |
getHistoryPosition()
Get the position of the current query in the history list
|
static QueryHistory |
getInstance()
Get the instance
|
int |
getNumberOfQueries()
Get the number of queries in the history list
|
boolean |
hasNext()
Check whether there is a query in the history list after to the current
history position.
|
boolean |
hasPrevious()
Check whether there is a query in the history list prior to the current
history position.
|
void |
moveBackward()
Move back one position in the history list.
|
void |
moveForward()
Move forward on position in the history list.
|
private void |
setHistoryPosition(int position)
Set the current history position
|
private void |
truncateQueryHistory()
Remove queries that follow the currently selected query in the history
list.
|
private static final org.apache.log4j.Logger LOGGER
private static final int MAXIMUM_HISTORY_ENTRIES
private static QueryHistory instance
private final java.util.List<QueryInfo> queryHistoryList
private int currentPosition
public static final QueryHistory getInstance()
public void addQuery(QueryInfo query)
query
- The query that is to be added to the history listpublic void deleteQueryAtIndex(int index)
index
- The SQL index of the query being deletedprivate void truncateQueryHistory()
private void appendQuery(QueryInfo query)
query
- The query to be inserted at the end of the query history listprivate void enforceSize()
private void setHistoryPosition(int position)
position
- The current history positionpublic int getNumberOfQueries()
private int getHistoryPosition()
public QueryInfo getCurrentQueryInfo()
public void moveBackward()
hasPrevious()
public void moveForward()
hasNext()
public boolean hasPrevious()
moveBackward()
public boolean hasNext()
moveForward()
public void clearAllQueries()