API Overview API Index Package Overview Direct link to this page
JavaOnTracks 0.1.2
  net.jot.search.simpleindexer. JOTSearchResult View Javadoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

/*
------------------------------------
JavaOnTracks          Thibaut Colar
tcolar-jot AT colar DOT net
Artistic Licence 2.0
http://www.javaontracks.net
------------------------------------
 */

package net.jot.search.simpleindexer;

import java.util.Hashtable;

/**
 * Represented an entry of the sorted search result (ie: a file)
 * This is of type hashtable, so that a user writing it's own JOTSearchsorter implementation could add it's own extra element data
 * @author tcolar
 */
public class JOTSearchResult extends Hashtable
{
    public static final String ID="ID";
    public static final String SCORE="SCORE";
    public static final String HITS="HITS";
    public static final String BEST_LINE="BESTLINE";
    public static final String BEST_LINE_SCORE="BESTLINESCORE";
    
    /**
     * creates an entry with specific id,score,hits
     * @param id
     * @param score
     * @param hits
     */
    public JOTSearchResult(String id, int score, int hits, int bestLine, int bestLineScore )
    {
        put(ID,id);
        put(SCORE,new Integer(score));
        put(HITS,new Integer(hits));
        put(BEST_LINE,new Integer(bestLine));
        put(BEST_LINE_SCORE,new Integer(bestLineScore));
    }
    
    /**
     * score 0 to 10   (how many of the keywords where found in the file)
     * @return
     */
    public int getScore()
    {
        return ((Integer)get(SCORE)).intValue();
    }
    /**
     * how many of the keywords on the best line
     * @return
     */
    public int getBestLineScore()
    {
        return ((Integer)get(BEST_LINE_SCORE)).intValue();
    }
    /**
     * line number of best line
     * @return
     */
    public int getBestLine()
    {
        return ((Integer)get(BEST_LINE)).intValue();
    }
    /**
     * total number of keywords hits in whole file
     * @return
     */
    public Integer getHits()
    {
        return ((Integer)get(HITS));
    }
    /**
     * return uniqueId of the matching entry(ex: filename)
     * @return
     */
    public String  getID()
    {
        return (String)get(ID);
    }
}

Generated By: JavaOnTracks Doclet 0.1.5     ©Thibaut Colar