public abstract class AbstractSearchResult extends java.lang.Object implements SearchResult
Modifier and Type | Field and Description |
---|---|
protected AnnotationBuffer |
annotationBuffer |
protected boolean |
finalized |
protected SearchConstraint[] |
groupConstraints |
protected int[] |
groupIndexMap
Maps from static groupId to current potentially reordered index
in other grouping related fields
|
protected de.ims.icarus.util.SubstitutionSupport[] |
groupInstances |
protected java.lang.String[] |
groupTokens |
protected java.lang.Object |
lock |
protected de.ims.icarus.util.CompactProperties |
properties |
protected Search |
search |
DUMMY_INSTANCE, FORCE_SIMPLE_OUTLINE_PROPERTY
Modifier | Constructor and Description |
---|---|
protected |
AbstractSearchResult(Search search,
SearchConstraint[] groupConstraints) |
Modifier and Type | Method and Description |
---|---|
abstract void |
addEntry(ResultEntry entry,
int... groupIndices) |
boolean |
canReorder() |
void |
finish()
Attempts to finalize this result so that future modifications
will be discarded.
|
de.ims.icarus.util.annotation.AnnotatedData |
getAnnotatedEntry(ResultEntry entry) |
AnnotationBuffer |
getAnnotationBuffer() |
de.ims.icarus.util.data.ContentType |
getAnnotationType() |
de.ims.icarus.util.data.ContentType |
getContentType()
Returns the
ContentType representing the entries in this
result. |
ConstraintContext |
getContext() |
int |
getDimension()
Returns the total number of groupings in the result
|
SearchConstraint |
getGroupConstraint(int groupId)
Returns the
SearchConstraint that declared the grouping
for the given index |
java.lang.Object |
getGroupLabel(int groupId)
Returns the label to be used as title for the grouping at index
groupId . |
int |
getIndexOf(int groupId,
java.lang.Object label)
Returns the index of the given
label object within the list
that holds all the encountered labels for the specified group. |
int |
getInstanceCount(int groupId)
Returns the number of instances that were reported for the
given
groupId . |
java.lang.Object |
getInstanceLabel(int groupId,
int index)
Returns the label to be used for the instance at
index in
group groupId . |
java.lang.Object |
getPlainEntry(ResultEntry entry) |
java.lang.Object |
getProperty(java.lang.String key) |
Search |
getSource()
Returns the
Search that wraps all the information
about the origin of this result. |
SearchResult |
getSubResult(int... groupInstances)
Creates and returns a new
SearchResult that is backed by this
result object and presents a view of a lesser dimension with some
group variables set to the specified instances. |
de.ims.icarus.util.data.DataList<?> |
getTarget() |
boolean |
isFinal()
Returns
true if and only if the search constructing this
result is completed and no more modifications are to be expected. |
boolean |
reorder(int[] permutation)
Applies the given
permutation array to the internal order
of groups and reorders all affected entries in this result. |
void |
setAnnotationBuffer(AnnotationBuffer annotationBuffer) |
void |
setGroupInstances(int groupId,
java.lang.String[] instances) |
void |
setProperty(java.lang.String key,
java.lang.Object value) |
abstract void |
writeEntries(SearchWriter writer) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, createCache, getEntry, getEntryAt, getEntryList, getGroupMatchCount, getMatchCount, getRawEntry, getRawEntryAt, getRawEntryList, getTotalHitCount, getTotalMatchCount
protected final transient Search search
protected java.lang.String[] groupTokens
protected de.ims.icarus.util.SubstitutionSupport[] groupInstances
protected SearchConstraint[] groupConstraints
protected int[] groupIndexMap
protected de.ims.icarus.util.CompactProperties properties
protected AnnotationBuffer annotationBuffer
protected boolean finalized
protected final java.lang.Object lock
protected AbstractSearchResult(Search search, SearchConstraint[] groupConstraints)
public java.lang.Object getProperty(java.lang.String key)
getProperty
in interface SearchResult
public void setProperty(java.lang.String key, java.lang.Object value)
setProperty
in interface SearchResult
public AnnotationBuffer getAnnotationBuffer()
public void setAnnotationBuffer(AnnotationBuffer annotationBuffer)
public de.ims.icarus.util.data.DataList<?> getTarget()
public boolean reorder(int[] permutation)
SearchResult
permutation
array to the internal order
of groups and reorders all affected entries in this result.
Returns true
in case the reordering was successful
reorder
in interface SearchResult
public boolean canReorder()
canReorder
in interface SearchResult
public int getDimension()
SearchResult
getDimension
in interface SearchResult
SearchResult.getDimension()
public Search getSource()
SearchResult
Search
that wraps all the information
about the origin of this result.getSource
in interface SearchResult
SearchResult.getSource()
public int getInstanceCount(int groupId)
SearchResult
groupId
.getInstanceCount
in interface SearchResult
SearchResult.getInstanceCount(int)
public SearchConstraint getGroupConstraint(int groupId)
SearchResult
SearchConstraint
that declared the grouping
for the given indexgetGroupConstraint
in interface SearchResult
SearchResult.getGroupConstraint(int)
public de.ims.icarus.util.data.ContentType getContentType()
SearchResult
ContentType
representing the entries in this
result. For treebanks this would be directly forwarded to the
treebank the search was targeted at.getContentType
in interface SearchResult
SearchResult.getContentType()
public ConstraintContext getContext()
public java.lang.Object getGroupLabel(int groupId)
SearchResult
groupId
. Typically this will be the localized string as
returned by ConstraintFactory.getName()
by the factory
that created the SearchConstraint
at the specified index.getGroupLabel
in interface SearchResult
SearchResult.getGroupLabel(int)
public java.lang.Object getInstanceLabel(int groupId, int index)
SearchResult
index
in
group groupId
. Typically this will be the actual value as
encountered by the search without any localization or other modification
outside the value-to-label-conversion performed by
ConstraintFactory#valueToLabel(Object)
.getInstanceLabel
in interface SearchResult
SearchResult.getInstanceLabel(int, int)
public int getIndexOf(int groupId, java.lang.Object label)
SearchResult
label
object within the list
that holds all the encountered labels for the specified group.getIndexOf
in interface SearchResult
SearchResult.getIndexOf(int, java.lang.Object)
public SearchResult getSubResult(int... groupInstances)
SearchResult
SearchResult
that is backed by this
result object and presents a view of a lesser dimension with some
group variables set to the specified instances.getSubResult
in interface SearchResult
SearchResult.getSubResult(int[])
public boolean isFinal()
SearchResult
true
if and only if the search constructing this
result is completed and no more modifications are to be expected.
Since construction of specialized views on a complex search-result can
be quite expensive, visualization facilities are adviced to check this
method before attempting to present such views while the search is still
in progress or before allowing the user to do so.
Note that implementations are allowed to throw IllegalStateException
when they do not support certain operations during a running search.
isFinal
in interface SearchResult
SearchResult.isFinal()
public void finish()
SearchResult
An implementation should throw an IllegalStateException
in case
the result is already final.
finish
in interface SearchResult
public java.lang.Object getPlainEntry(ResultEntry entry)
getPlainEntry
in interface SearchResult
public de.ims.icarus.util.annotation.AnnotatedData getAnnotatedEntry(ResultEntry entry)
getAnnotatedEntry
in interface SearchResult
SearchResult.getAnnotatedEntry(de.ims.icarus.search_tools.result.ResultEntry)
public de.ims.icarus.util.data.ContentType getAnnotationType()
getAnnotationType
in interface de.ims.icarus.util.annotation.AnnotationContainer
public abstract void writeEntries(SearchWriter writer) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public abstract void addEntry(ResultEntry entry, int... groupIndices)
public void setGroupInstances(int groupId, java.lang.String[] instances)