Constructor and Description |
---|
AbstractIndex() |
Modifier and Type | Method and Description |
---|---|
void |
add(V value,
long timestamp)
Adds a value to the cache.
|
void |
addIndexListener(@NotNull IndexListener<V> listener)
Adds an
IndexListener to be notified of changes. |
void |
beginUpdate()
Starts an update.
|
void |
clear()
Clears all values from the index.
|
void |
endUpdate()
Ends an update.
|
@NotNull java.util.Collection<V> |
findPartialName(@NotNull java.lang.String name)
Returns all matching values for a (possibly partial) key name.
|
@Nullable java.lang.String |
getName(V value)
Returns the name associated with a value.
|
boolean |
hasPending()
Returns whether at least one pending value exists.
|
void |
indexingFinished()
Should be called after indexing has finished.
|
boolean |
isModified()
Returns whether the state was modified since last save.
|
void |
load(@NotNull java.io.ObjectInputStream objectInputStream)
Restores the state from an
ObjectInputStream . |
void |
remove(V value)
Removes a value from the cache.
|
void |
removeIndexListener(@NotNull IndexListener<V> listener)
Removes an
IndexListener to be notified of changes. |
V |
removePending()
Returns one pending value.
|
void |
save(@NotNull java.io.ObjectOutputStream objectOutputStream)
Saves the state to an
ObjectOutputStream . |
void |
setName(V value,
long timestamp,
@NotNull java.lang.String name)
Associates a value with a name.
|
void |
setPending(V value)
Marks a value as pending.
|
int |
size()
Returns the number of values in this cache.
|
public int size()
Index
@NotNull public @NotNull java.util.Collection<V> findPartialName(@NotNull @NotNull java.lang.String name)
Index
findPartialName
in interface Index<V extends java.io.Serializable>
name
- the partial name to look uppublic void beginUpdate()
Index
Index.endUpdate()
should be called from only a single thread.beginUpdate
in interface Index<V extends java.io.Serializable>
public void endUpdate()
Index
added
since the last call to Index.beginUpdate()
.
Must not be called unless a directly preceding call to beginUpdate()
was made.public void add(@NotNull V value, long timestamp)
Index
public void remove(@NotNull V value)
Index
public void setPending(@NotNull V value)
Index
setPending
in interface Index<V extends java.io.Serializable>
value
- the value to mark pendingpublic void setName(@NotNull V value, long timestamp, @NotNull @NotNull java.lang.String name)
Index
@Nullable public @Nullable java.lang.String getName(@NotNull V value)
Index
@Nullable public V removePending()
Index
removePending
in interface Index<V extends java.io.Serializable>
null
if no pending values existpublic boolean hasPending()
Index
hasPending
in interface Index<V extends java.io.Serializable>
public boolean isModified()
Index
isModified
in interface Index<V extends java.io.Serializable>
public void addIndexListener(@NotNull @NotNull IndexListener<V> listener)
Index
IndexListener
to be notified of changes.addIndexListener
in interface Index<V extends java.io.Serializable>
listener
- the index listener to addpublic void removeIndexListener(@NotNull @NotNull IndexListener<V> listener)
Index
IndexListener
to be notified of changes.removeIndexListener
in interface Index<V extends java.io.Serializable>
listener
- the index listener to removepublic void save(@NotNull @NotNull java.io.ObjectOutputStream objectOutputStream) throws java.io.IOException
Index
ObjectOutputStream
. Pending maps are not
saved.public void load(@NotNull @NotNull java.io.ObjectInputStream objectInputStream) throws java.io.IOException
Index
ObjectInputStream
. The previous state
is overwritten.public void clear()
Index
public void indexingFinished()
Index
indexingFinished
in interface Index<V extends java.io.Serializable>