org.openide.util.lookup
Interface AbstractLookup.Storage<Transaction>

All Known Implementing Classes:
ArrayStorage, DelegatingStorage, InheritanceTree
Enclosing class:
AbstractLookup

static interface AbstractLookup.Storage<Transaction>

Storage to keep the internal structure of Pairs and to answer different queries.


Method Summary
 boolean add(AbstractLookup.Pair<?> item, Transaction transaction)
          Adds an item into the storage.
 Transaction beginTransaction(int ensure)
          Initializes a modification operation by creating an object that will be passsed to all add, remove, retainAll methods and should collect enough information about the change to notify listeners about the transaction later
 AbstractLookup.ReferenceToResult<?> cleanUpResult(Lookup.Template<?> templ)
          Given the provided template, Do cleanup the results.
 void endTransaction(Transaction transaction, java.util.Set<AbstractLookup.R> modifiedResults)
          Collects all affected results R that were modified in the given transaction.
<T> java.util.Enumeration<AbstractLookup.Pair<T>>
lookup(java.lang.Class<T> clazz)
          Queries for instances of given class.
 AbstractLookup.ReferenceToResult<?> registerReferenceToResult(AbstractLookup.ReferenceToResult<?> newRef)
          Registers another reference to a result with the storage.
 void remove(AbstractLookup.Pair item, Transaction transaction)
          Removes an item.
 void retainAll(java.util.Map retain, Transaction transaction)
          Removes all items that are not present in the provided collection.
 

Method Detail

beginTransaction

Transaction beginTransaction(int ensure)
Initializes a modification operation by creating an object that will be passsed to all add, remove, retainAll methods and should collect enough information about the change to notify listeners about the transaction later

Parameters:
ensure - the amount of items that will appear in the storage after the modifications (-1 == remove one, -2 == add one, >= 0 the amount of objects at the end
Returns:
a token to identify the transaction

endTransaction

void endTransaction(Transaction transaction,
                    java.util.Set<AbstractLookup.R> modifiedResults)
Collects all affected results R that were modified in the given transaction.

Parameters:
modified - place to add results R to
transaction - the transaction indentification

add

boolean add(AbstractLookup.Pair<?> item,
            Transaction transaction)
Adds an item into the storage.

Parameters:
item - to add
transaction - transaction token
Returns:
true if the Item has been added for the first time or false if some other item equal to this one already existed in the lookup

remove

void remove(AbstractLookup.Pair item,
            Transaction transaction)
Removes an item.


retainAll

void retainAll(java.util.Map retain,
               Transaction transaction)
Removes all items that are not present in the provided collection.

Parameters:
retain - collection of Pairs to keep them in
transaction - the transaction context

lookup

<T> java.util.Enumeration<AbstractLookup.Pair<T>> lookup(java.lang.Class<T> clazz)
Queries for instances of given class.

Parameters:
clazz - the class to check
Returns:
enumeration of Item
See Also:
#unsorted

registerReferenceToResult

AbstractLookup.ReferenceToResult<?> registerReferenceToResult(AbstractLookup.ReferenceToResult<?> newRef)
Registers another reference to a result with the storage. This method has also a special meaning.

Parameters:
newRef - the new reference to remember
Returns:
the previous reference that was kept (null if newRef is the first one) the applications is expected to link from newRef to this returned value to form a linked list

cleanUpResult

AbstractLookup.ReferenceToResult<?> cleanUpResult(Lookup.Template<?> templ)
Given the provided template, Do cleanup the results.

Parameters:
templ - template of a result(s) that should be checked
Returns:
null if all references for this template were cleared or one of them