Package eu.clarin.sru.client.fcs
Class DataViewHits
- java.lang.Object
-
- eu.clarin.sru.client.fcs.DataView
-
- eu.clarin.sru.client.fcs.DataViewHits
-
public class DataViewHits extends DataView
A Data View implementation that stores the content of a HITS Data View.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DataViewHits(String pid, String ref, String text, int[] offsets, int offsets_idx)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getHitCount()
Get the total number of hits in the result.int[]
getHitOffsets(int idx)
Get the offsets pointing to range in the text content that yield the hit.String
getText()
Get the text content of the hit.-
Methods inherited from class eu.clarin.sru.client.fcs.DataView
getMimeType, getPid, getRef, isMimeType
-
-
-
-
Field Detail
-
TYPE
public static final String TYPE
The MIME type for CLARIN-FCS KWIC data views.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DataViewHits
protected DataViewHits(String pid, String ref, String text, int[] offsets, int offsets_idx)
Constructor.- Parameters:
pid
- a persistent identifier ornull
ref
- a reference URI ornull
text
- the textual content of the hitsoffsets
- an array of (start, end) offset pairs that indicate the part of the text, that is considered a hitoffsets_idx
- the largest index (= hit_count * 2) within the offsets array plus one- Throws:
NullPointerException
- if any mandatory argument isnull
IllegalArgumentException
- if any argument is illegal
-
-
Method Detail
-
getHitCount
public int getHitCount()
Get the total number of hits in the result.- Returns:
- the number of hits
-
getText
public String getText()
Get the text content of the hit. Usually this is complete sentence.- Returns:
- the text content of the hit
-
getHitOffsets
public int[] getHitOffsets(int idx)
Get the offsets pointing to range in the text content that yield the hit.- Parameters:
idx
- the hit to retrieve. Must be larger than0
and smaller than the result ofgetHitCount()
.- Returns:
- An array of two elements. The first array element is the start offset, the second array element is the end offset of the hit range.
- Throws:
ArrayIndexOutOfBoundsException
- of theidx
argument is out of bounds.
-
-