1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * ResultItemPhrase.java -- a phrase result in the Phind applet
|
---|
4 | *
|
---|
5 | * Copyright 2000 Gordon W. Paynter
|
---|
6 | * Copyright 2000 The New Zealand Digital Library Project
|
---|
7 | *
|
---|
8 | * A component of the Greenstone digital library software
|
---|
9 | * from the New Zealand Digital Library Project at the
|
---|
10 | * University of Waikato, New Zealand.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or modify
|
---|
13 | * it under the terms of the GNU General Public License as published by
|
---|
14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
15 | * (at your option) any later version.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful,
|
---|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
20 | * GNU General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, write to the Free Software
|
---|
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
25 | *
|
---|
26 | *********************************************************************/
|
---|
27 |
|
---|
28 | /*********************************************************************
|
---|
29 |
|
---|
30 | This class is used in the Phind java applet (Phind.java).
|
---|
31 |
|
---|
32 | It contains information describing a phrase.
|
---|
33 |
|
---|
34 | **********************************************************************/
|
---|
35 |
|
---|
36 | //package org.nzdl.gsdl.Phind;
|
---|
37 | package org.greenstone.applet.phind;
|
---|
38 | public class ResultItemPhrase extends ResultItem {
|
---|
39 |
|
---|
40 | // The phrase number, stored as a string and as a number
|
---|
41 | String id;
|
---|
42 | int symbol;
|
---|
43 |
|
---|
44 | // The text of the phrase is split into a prefix, body, and suffix.
|
---|
45 | // The body is the same as the parent phrase (or search term) and
|
---|
46 | // the prefix and suffix are the surrounding text.
|
---|
47 | String prefix;
|
---|
48 | String body;
|
---|
49 | String suffix;
|
---|
50 |
|
---|
51 | // The document frequency of the phrase
|
---|
52 | int documentFrequency;
|
---|
53 |
|
---|
54 | // Create a ResultItem for a phrase
|
---|
55 | ResultItemPhrase(String newId, String tf, String df,
|
---|
56 | String p, String b, String s) {
|
---|
57 |
|
---|
58 | kind = phraseItem;
|
---|
59 |
|
---|
60 | id = newId;
|
---|
61 | symbol = Integer.valueOf(newId).intValue();
|
---|
62 |
|
---|
63 | sort = sortPhraseItem;
|
---|
64 | frequency = Integer.valueOf(tf).intValue();
|
---|
65 | documentFrequency = Integer.valueOf(df).intValue();
|
---|
66 |
|
---|
67 | prefix = p;
|
---|
68 | body = b;
|
---|
69 | suffix = s;
|
---|
70 | text = (prefix + " " + body + " " + suffix);
|
---|
71 |
|
---|
72 | }
|
---|
73 |
|
---|
74 | // Is this item a phrase?
|
---|
75 | public boolean isPhrase() { return true; }
|
---|
76 |
|
---|
77 | // Return the text of the item components
|
---|
78 | public String mainText() { return body; }
|
---|
79 | public String docsText() { return Integer.toString(documentFrequency); }
|
---|
80 | public String prefixText() { return prefix; }
|
---|
81 | public String suffixText() { return suffix; }
|
---|
82 | public String hiddenText() { return id; }
|
---|
83 |
|
---|
84 | }
|
---|
85 |
|
---|