|
Gridarta Editor
|
Abstract base class for Index implementations. More...
Inheritance diagram for net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >:
Collaboration diagram for net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >:Public Member Functions | |
| void | add (@NotNull final V value, final long timestamp) |
| Adds a value to the cache. More... | |
| void | addIndexListener (@NotNull final IndexListener< V > listener) |
| Adds an IndexListener to be notified of changes. More... | |
| void | beginUpdate () |
| Starts an update. More... | |
| void | clear () |
| Clears all values from the index. More... | |
| void | endUpdate () |
| Ends an update. More... | |
| Collection< V > | findPartialName (@NotNull final String name) |
| Returns all matching values for a (possibly partial) key name. More... | |
| String | getName (@NotNull final V value) |
| Returns the name associated with a value. More... | |
| boolean | hasPending () |
| Returns whether at least one pending value exists. More... | |
| void | indexingFinished () |
| Should be called after indexing has finished. More... | |
| boolean | isModified () |
| Returns whether the state was modified since last save. More... | |
| void | load (@NotNull final ObjectInputStream objectInputStream) throws IOException |
| unchecked More... | |
| void | remove (@NotNull final V value) |
| Removes a value from the cache. More... | |
| void | removeIndexListener (@NotNull final IndexListener< V > listener) |
| Removes an IndexListener to be notified of changes. More... | |
| V | removePending () |
| Returns one pending value. More... | |
| void | save (@NotNull final ObjectOutputStream objectOutputStream) throws IOException |
| Saves the state to an ObjectOutputStream. More... | |
| void | setName (@NotNull final V value, final long timestamp, @NotNull final String name) |
| Associates a value with a name. More... | |
| void | setPending (@NotNull final V value) |
| Marks a value as pending. More... | |
| int | size () |
| Returns the number of values in this cache. More... | |
Private Attributes | |
| final EventListenerList2< IndexListener< V > > | indexListeners = new EventListenerList2<>(IndexListener.class) |
| The registered listeners. More... | |
| boolean | modified |
| Whether the state (timestamps or names) was modified since last save. More... | |
| final Map< V, String > | names = new HashMap<>() |
| Maps value to name. More... | |
| final Collection< V > | pending = new HashSet<>() |
| Pending values. More... | |
| final Object | sync = new Object() |
| Objects used to synchronize accesses to other fields. More... | |
| final Map< V, Long > | timestamps = new HashMap<>() |
| Maps value to timestamp. More... | |
| boolean | transaction |
| Whether a transaction is active. More... | |
| final Collection< V > | transactionDelete = new HashSet<>() |
| The values to delete at the end of the current transaction. More... | |
Abstract base class for Index implementations.
| <V> | the value's type |
Definition at line 42 of file AbstractIndex.java.
| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.add | ( | @NotNull final V | value, |
| final long | timestamp | ||
| ) |
Adds a value to the cache.
Newly added values and existing values for which the new timestamp does not match the old timestamp are marked as pending.
| value | the value to add |
| timestamp | a timestamp associated with the value |
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 154 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.scanMapsDirectoryInt().
Here is the caller graph for this function:| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.addIndexListener | ( | @NotNull final IndexListener< V > | listener | ) |
Adds an IndexListener to be notified of changes.
| listener | the index listener to add |
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 269 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.start(), and net.sf.gridarta.model.index.MapsIndexerTest.test2().
Here is the caller graph for this function:| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.beginUpdate | ( | ) |
Starts an update.
Updates do not nest. This function and endUpdate() should be called from only a single thread.
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 118 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.updateMapsDirectory().
Here is the caller graph for this function:| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.clear | ( | ) |
Clears all values from the index.
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 316 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.AbstractIndex< MapFile >.load(), and net.sf.gridarta.model.index.MapsIndexer< G, A, R >.loadMapsIndex().
Here is the caller graph for this function:| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.endUpdate | ( | ) |
Ends an update.
Removes all values from the index that were not added since the last call to beginUpdate(). Must not be called unless a directly preceding call to
was made.
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 127 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.updateMapsDirectory().
Here is the caller graph for this function:| Collection<V> net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.findPartialName | ( | @NotNull final String | name | ) |
Returns all matching values for a (possibly partial) key name.
| name | the partial name to look up |
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 104 of file AbstractIndex.java.
Here is the caller graph for this function:| String net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.getName | ( | @NotNull final V | value | ) |
Returns the name associated with a value.
| value | the value |
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 233 of file AbstractIndex.java.
Referenced by net.sf.gridarta.gui.dialog.gomap.MapListCellRenderer.getListCellRendererComponent().
Here is the caller graph for this function:| boolean net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.hasPending | ( | ) |
Returns whether at least one pending value exists.
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 255 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.waitForIdle().
Here is the caller graph for this function:| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.indexingFinished | ( | ) |
Should be called after indexing has finished.
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 327 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.reportStateChange().
Here is the caller graph for this function:| boolean net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.isModified | ( | ) |
Returns whether the state was modified since last save.
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 262 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.saveMapsIndex().
Here is the caller graph for this function:| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.load | ( | @NotNull final ObjectInputStream | objectInputStream | ) | throws IOException |
unchecked
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 292 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.loadMapsIndex().
Here is the caller graph for this function:| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.remove | ( | @NotNull final V | value | ) |
Removes a value from the cache.
Does nothing if the values does not exist.
| value | the value to remove |
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 182 of file AbstractIndex.java.
| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.removeIndexListener | ( | @NotNull final IndexListener< V > | listener | ) |
Removes an IndexListener to be notified of changes.
| listener | the index listener to remove |
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 274 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.stop().
Here is the caller graph for this function:| V net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.removePending | ( | ) |
Returns one pending value.
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 241 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.indexPendingMaps().
Here is the caller graph for this function:| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.save | ( | @NotNull final ObjectOutputStream | objectOutputStream | ) | throws IOException |
Saves the state to an ObjectOutputStream.
Pending maps are not saved.
| objectOutputStream | the object output stream to write to |
| IOException | if an I/O error occurs |
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 279 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.saveMapsIndex().
Here is the caller graph for this function:| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.setName | ( | @NotNull final V | value, |
| final long | timestamp, | ||
| @NotNull final String | name | ||
| ) |
Associates a value with a name.
Adds the value if it does not exist.
| value | the value to associate with a name |
| timestamp | the value's timestamp |
| name | the name associated with the value |
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 217 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.indexPendingMaps().
Here is the caller graph for this function:| void net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.setPending | ( | @NotNull final V | value | ) |
Marks a value as pending.
The value is added if it does not exist.
| value | the value to mark pending |
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 198 of file AbstractIndex.java.
| int net.sf.gridarta.model.index.AbstractIndex< V extends Serializable >.size | ( | ) |
Returns the number of values in this cache.
Implements net.sf.gridarta.model.index.Index< V >.
Definition at line 98 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.loadMapsIndex(), and net.sf.gridarta.model.index.MapsIndexer< G, A, R >.saveMapsIndex().
Here is the caller graph for this function:
|
private |
The registered listeners.
Definition at line 55 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.AbstractIndex< MapFile >.indexingFinished().
|
private |
Whether the state (timestamps or names) was modified since last save.
Definition at line 82 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.AbstractIndex< MapFile >.clear(), and net.sf.gridarta.model.index.AbstractIndex< MapFile >.isModified().
|
private |
Maps value to name.
Definition at line 69 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.AbstractIndex< MapFile >.clear().
|
private |
Pending values.
Definition at line 76 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.AbstractIndex< MapFile >.clear().
|
private |
Objects used to synchronize accesses to other fields.
Definition at line 49 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.AbstractIndex< MapFile >.add(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.beginUpdate(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.clear(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.endUpdate(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.findPartialName(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.getName(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.hasPending(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.isModified(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.load(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.remove(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.removePending(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.save(), net.sf.gridarta.model.index.AbstractIndex< MapFile >.setName(), and net.sf.gridarta.model.index.AbstractIndex< MapFile >.setPending().
|
private |
Maps value to timestamp.
Definition at line 62 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.AbstractIndex< MapFile >.clear().
|
private |
Whether a transaction is active.
Definition at line 87 of file AbstractIndex.java.
|
private |
The values to delete at the end of the current transaction.
Empty if no transaction is active.
Definition at line 95 of file AbstractIndex.java.
Referenced by net.sf.gridarta.model.index.AbstractIndex< MapFile >.clear(), and net.sf.gridarta.model.index.AbstractIndex< MapFile >.endUpdate().