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
Result s, 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
Result s in the repository that match the filter criteria. |
List<Result> |
getAllResults()
Returns all results (top-level and nested in
ResultSetResult s) in the repository. |
ArrayList<ResultRepository.ResultConsumer> |
getConsumers()
Returns the list of
ResultRepository.ResultConsumer s registered for the current ResultRepository . |
static ResultRepository |
getInstance()
Returns the singleton instance of the
ResultRepository . |
List<Result> |
getResults()
Returns only the top-level
Result s 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 ResultSetResult s)
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.ResultConsumer
public 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()
autosave
public boolean remove(Result result)
Result
that are contained in ResultSetResult
s)
from the repository.public List<Result> getAllResults()
ResultSetResult
s) in the repository.public List<Result> getResults()
Result
s of this repository.Result
spublic List<Result> filterByMimeAndExtendedType(String mime, String extendedType)
Result
s 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 TextResult
s with extended type null
are returned if they match mime
Result
spublic 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.ResultConsumer
s registered for the current ResultRepository
.public void restoreResultsFromXML(StringBuffer sb) throws NonParsableException
Result
s are added to the current contents of the repository.sb
- the XML representationNonParsableException
- if the XML could not be parsedpublic StringBuffer storeResultsToXML()