public class SubResult extends java.lang.Object implements SearchResult
Modifier and Type | Field and Description |
---|---|
protected SearchResult |
base |
protected int |
baseSize |
protected int |
fixedDimensions |
protected int[][] |
groupMatchCounts |
protected int[][] |
groupTranslate |
protected int[] |
indexBuffer |
protected de.ims.icarus.util.CompactProperties |
properties |
protected int |
size |
DUMMY_INSTANCE, FORCE_SIMPLE_OUTLINE_PROPERTY
Constructor and Description |
---|
SubResult(SearchResult base,
int... groupInstances) |
Modifier and Type | Method and Description |
---|---|
int[] |
asFilter() |
boolean |
canReorder() |
protected void |
checkIndices(int... indices) |
void |
clear()
Deletes the content of this result.
|
GroupCache |
createCache() |
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. |
int |
getDimension()
Returns the total number of groupings in the result
|
java.lang.Object |
getEntry(int index)
Returns the entry object at the specified index.
|
java.lang.Object |
getEntryAt(int index,
int... groupIndices)
Shorthand method for accessing an entry within the list-view
that is represented by
SearchResult.getEntryList(int...) |
de.ims.icarus.util.data.DataList<? extends java.lang.Object> |
getEntryList(int... indices)
Returns a list-oriented view of all the entries for the
specified combination of group-instances.
|
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 |
getGroupMatchCount(int groupId,
int index)
Returns the number of matches with an instance of the given
group in them.
|
int |
getIndexOf(int dimension,
java.lang.Object label)
We would have to traverse our translate array for
the given dimension.
|
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 . |
int |
getMatchCount(int... indices)
Returns the number of matches reported for the given combination
of instances.
|
java.lang.Object |
getPlainEntry(ResultEntry entry) |
java.lang.Object |
getProperty(java.lang.String key) |
ResultEntry |
getRawEntry(int index) |
ResultEntry |
getRawEntryAt(int index,
int... groupIndices) |
java.util.List<ResultEntry> |
getRawEntryList(int... indices) |
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. |
int |
getTotalHitCount()
Returns the total count of reported hits in this result.
|
int |
getTotalMatchCount()
Returns the total count of reported matches in this result
|
boolean |
isFinal()
Returns
true if and only if the search constructing this
result is completed and no more modifications are to be expected. |
protected void |
prepareIndices(int[] indices) |
boolean |
reorder(int[] permutation)
Applies the given
permutation array to the internal order
of groups and reorders all affected entries in this result. |
void |
setProperty(java.lang.String key,
java.lang.Object value) |
protected final SearchResult base
protected final int fixedDimensions
protected final int[] indexBuffer
protected int baseSize
protected int size
protected int[][] groupTranslate
protected int[][] groupMatchCounts
protected de.ims.icarus.util.CompactProperties properties
public SubResult(SearchResult base, int... groupInstances)
public int getDimension()
SearchResult
getDimension
in interface SearchResult
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
public int getInstanceCount(int groupId)
SearchResult
groupId
.getInstanceCount
in interface SearchResult
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
public int getGroupMatchCount(int groupId, int index)
SearchResult
getGroupMatchCount
in interface SearchResult
SearchResult.getGroupMatchCount(int, int)
public int getIndexOf(int dimension, java.lang.Object label)
getIndexOf
in interface SearchResult
protected void prepareIndices(int[] indices)
protected void checkIndices(int... indices)
public java.lang.Object getEntryAt(int index, int... groupIndices)
SearchResult
SearchResult.getEntryList(int...)
getEntryAt
in interface SearchResult
public ResultEntry getRawEntryAt(int index, int... groupIndices)
getRawEntryAt
in interface SearchResult
SearchResult.getRawEntryAt(int, int[])
public int getMatchCount(int... indices)
SearchResult
getMatchCount
in interface SearchResult
public AnnotationBuffer getAnnotationBuffer()
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
public de.ims.icarus.util.data.DataList<? extends java.lang.Object> getEntryList(int... indices)
SearchResult
getEntryList
in interface SearchResult
public java.util.List<ResultEntry> getRawEntryList(int... indices)
getRawEntryList
in interface SearchResult
public int getTotalMatchCount()
SearchResult
getTotalMatchCount
in interface SearchResult
public int[] asFilter()
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
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
SearchResult.canReorder()
public Search getSource()
SearchResult
Search
that wraps all the information
about the origin of this result.getSource
in interface SearchResult
SearchResult.getSource()
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 java.lang.Object getEntry(int index)
SearchResult
getEntry
in interface SearchResult
SearchResult.getEntry(int)
public ResultEntry getRawEntry(int index)
getRawEntry
in interface SearchResult
SearchResult.getRawEntry(int)
public GroupCache createCache()
createCache
in interface SearchResult
SearchResult.createCache()
public void clear()
SearchResult
An implementation should throw an IllegalStateException
in case
the result is still under construction and not final.
clear
in interface SearchResult
SearchResult.clear()
public void finish()
SearchResult
An implementation should throw an IllegalStateException
in case
the result is already final.
finish
in interface SearchResult
SearchResult.finish()
public java.lang.Object getPlainEntry(ResultEntry entry)
getPlainEntry
in interface SearchResult
SearchResult.getPlainEntry(de.ims.icarus.search_tools.result.ResultEntry)
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
AnnotationContainer.getAnnotationType()
public int getTotalHitCount()
SearchResult
Note that an arbitrary number of hits can be wrapped into a single match!
getTotalHitCount
in interface SearchResult
SearchResult.getTotalHitCount()
public void setProperty(java.lang.String key, java.lang.Object value)
setProperty
in interface SearchResult
SearchResult.setProperty(java.lang.String, java.lang.Object)
public java.lang.Object getProperty(java.lang.String key)
getProperty
in interface SearchResult
SearchResult.getProperty(java.lang.String)