Class DataViewHits


  • public class DataViewHits
    extends DataView
    A Data View implementation that stores the content of a HITS Data View.
    • Constructor Detail

      • DataViewHits

        protected DataViewHits​(String pid,
                               String ref,
                               String text,
                               int[] offsets,
                               int offsets_idx)
        Constructor.
        Parameters:
        pid - a persistent identifier or null
        ref - a reference URI or null
        text - the textual content of the hits
        offsets - an array of (start, end) offset pairs that indicate the part of the text, that is considered a hit
        offsets_idx - the largest index (= hit_count * 2) within the offsets array plus one
        Throws:
        NullPointerException - if any mandatory argument is null
        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 than 0 and smaller than the result of getHitCount().
        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 the idx argument is out of bounds.