class H2Set extends java.util.TreeSet implements StoredCollection
| Modifier and Type | Field and Description |
|---|---|
protected LoggedCollection |
changes
The change logger for this collection.
|
private java.lang.String |
clearSql
The set's clear SQL.
|
private DBHelper |
helper
The helper for SQL usage.
|
private java.lang.String |
insertSql
The set's insert SQL.
|
private java.lang.Class<?> |
keyClass
The element's class.
|
private AstManager |
manager
The AST manager.
|
private AstSymbolResolver |
resolver
The AST symbol resolver.
|
private java.lang.String |
tableName
The set's table name.
|
private java.lang.String |
workClearSql
The set's work table clear SQL.
|
private java.lang.String |
workInsertSql
The set's work table insert SQL.
|
private java.lang.String |
workTable
The set's work table name.
|
| Modifier | Constructor and Description |
|---|---|
protected |
H2Set()
Constructor used for sub-classes, which delegate the db-storage to another collection.
|
|
H2Set(java.lang.Class<?> keyClass,
java.lang.String table,
DBHelper helper)
Create a new db-backed set, with the specified name.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(java.lang.Object key)
Perform an add operation.
|
boolean |
addAll(java.util.Collection c)
Merge the specified collection into this one.
|
void |
clear()
Clear the set and all its changes.
|
boolean |
contains(java.lang.Object key)
Check if the set contains the specified key.
|
private void |
logChange(java.lang.Object key)
Log this access in the set as a change.
|
void |
persist()
Persist this set and all the changes to the database.
|
boolean |
remove(java.lang.Object key)
Remove this key from the set.
|
ceiling, clone, comparator, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, size, spliterator, subSet, subSet, tailSet, tailSetcontainsAll, retainAll, toArray, toArray, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcompact, inPersist, unwrapValue, wrapValueprotected final LoggedCollection changes
private final AstSymbolResolver resolver
private final AstManager manager
private final DBHelper helper
private final java.lang.Class<?> keyClass
private final java.lang.String tableName
private final java.lang.String workTable
private final java.lang.String insertSql
private final java.lang.String clearSql
private final java.lang.String workInsertSql
private final java.lang.String workClearSql
public H2Set(java.lang.Class<?> keyClass,
java.lang.String table,
DBHelper helper)
keyClass - The element's class.table - The set's (and main table) name.helper - The SQL helper.protected H2Set()
public boolean contains(java.lang.Object key)
If the key exists, the access will be logged. This assumes the source AST requires for the key to have this specific value.
contains in interface java.util.Collectioncontains in interface java.util.Setcontains in class java.util.TreeSetkey - The key to check.true if the key exists in the set.public boolean add(java.lang.Object key)
The access will be logged. This assumes the source AST requires for the key to have this specific value.
add in interface java.util.Collectionadd in interface java.util.Setadd in class java.util.TreeSetkey - The key.true if the key already exists.public boolean addAll(java.util.Collection c)
add(java.lang.Object) to log the
access to the set.addAll in interface java.util.CollectionaddAll in interface java.util.SetaddAll in class java.util.TreeSetc - The collection to merge.public boolean remove(java.lang.Object key)
If the key exists, then all changes related to it will be cleared.
remove in interface java.util.Collectionremove in interface java.util.Setremove in class java.util.TreeSetkey - The key to remove.public void clear()
clear in interface StoredCollectionclear in interface java.util.Collectionclear in interface java.util.Setclear in class java.util.TreeSetpublic void persist()
persist in interface StoredCollectionprivate void logChange(java.lang.Object key)
key - The accessed key.