public class ResultRepository extends Object
Result that have been created in an Application run.| Modifier and Type | Class and Description |
|---|---|
static interface |
ResultRepository.ResultConsumer
Interface for classes that consume
Results, i.e., that need to react to the addition or removal
of results from the repository. |
| Modifier and Type | Field and Description |
|---|---|
static BooleanProperty |
autosave
Global property for an
Application run, if the workspace is automatically saved to disk. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Result result)
Adds a result to the repository
|
void |
add(Result result,
boolean store)
Adds a result to the repository.
|
boolean |
autostore()
|
List<Result> |
filterByMimeAndExtendedType(String mime,
String extendedType)
Returns all
Results in the repository that match the filter criteria. |
List<Result> |
getAllResults()
Returns all results (top-level and nested in
ResultSetResults) in the repository. |
ArrayList<ResultRepository.ResultConsumer> |
getConsumers()
Returns the list of
ResultRepository.ResultConsumers registered for the current ResultRepository. |
static ResultRepository |
getInstance()
Returns the singleton instance of the
ResultRepository. |
List<Result> |
getResults()
Returns only the top-level
Results of this repository. |
void |
notifyRefresh(Result renamed)
Notifies this
ResultRepository that a Result has been modified
and consumers should be notified. |
void |
register(ResultRepository.ResultConsumer resultConsumer)
Registers a
ResultRepository.ResultConsumer to this repository. |
boolean |
remove(Result result)
Removes a top-level result (i.e., no
Result that are contained in ResultSetResults)
from the repository. |
void |
restoreResultsFromXML(StringBuffer sb)
Restores the contents of a repository from its XML representation.
|
StringBuffer |
storeResultsToXML()
Stores the current contents of the repository to an XML representation.
|
public static BooleanProperty autosave
Application run, if the workspace is automatically saved to disk.public static ResultRepository getInstance()
ResultRepository.public void notifyRefresh(Result renamed)
ResultRepository that a Result has been modified
and consumers should be notified.renamed - the Result renamedResultRepository.ResultConsumerpublic void add(Result result)
result - the Result addedpublic void add(Result result, boolean store)
store is true.
As many successive autostores could be inefficient for sequential addition of many objects, store
should be true only for the last of a successive series of additions.result - the Result addedstore - if autosave should be considered.public boolean autostore()
autosavepublic boolean remove(Result result)
Result that are contained in ResultSetResults)
from the repository.public List<Result> getAllResults()
ResultSetResults) in the repository.public List<Result> getResults()
Results of this repository.Resultspublic List<Result> filterByMimeAndExtendedType(String mime, String extendedType)
Results in the repository that match the filter criteria.mime - the mime type (or extension) of the Result that are to be returnedextendedType - an extended type, also TextResults with extended type null are returned if they match mimeResultspublic void register(ResultRepository.ResultConsumer resultConsumer)
ResultRepository.ResultConsumer to this repository. All ResultRepository.ResultConsumer registered will be notified
for changes (additions or removals) in the repository.resultConsumer - the consumerpublic ArrayList<ResultRepository.ResultConsumer> getConsumers()
ResultRepository.ResultConsumers registered for the current ResultRepository.public void restoreResultsFromXML(StringBuffer sb) throws NonParsableException
Results are added to the current contents of the repository.sb - the XML representationNonParsableException - if the XML could not be parsedpublic StringBuffer storeResultsToXML()