The R Project SVN R

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8090 leisch 1
/*============================================================================
1230 leisch 2
 
3
  Project: Simple JAVA Search Engine for Keyword Search
4
 
5
  JAVA Source file for the class IndexEntry
6
 
8090 leisch 7
  COPYRIGHT (C), 1998-2000, Thomas Baier, R Core Development Team
3765 leisch 8
 
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  (at your option) any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program; if not, write to the Free Software
5458 ripley 21
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1230 leisch 22
 
8194 leisch 23
  $Revision: 1.5 $
1230 leisch 24
 
8194 leisch 25
  $Date: 2000/02/16 12:54:16 $
1230 leisch 26
 
8090 leisch 27
  $Author: leisch $
1230 leisch 28
 
8090 leisch 29
============================================================================*/
1230 leisch 30
 
31
 
32
import java.lang.Object;
33
import java.lang.String;
34
import java.applet.AppletContext;
35
import java.net.URL;
36
import java.net.MalformedURLException;
37
 
38
 
39
 
40
public class IndexEntry extends Object
41
{
8090 leisch 42
  public IndexEntry (String entry, String keywords, String aliases,
43
		     String desc, String url)
1230 leisch 44
  {
8090 leisch 45
    iEntry = entry;
8194 leisch 46
    iKey = " " + keywords + " ";
47
    iAliases = " " + entry + " " + aliases + " ";
1230 leisch 48
    iDescription = desc;
49
    iURL = url;
8090 leisch 50
 
1230 leisch 51
    // trace here
8090 leisch 52
    Tracer.write ("Created IndexEntry. Entry = \"" +
53
		  entry + "\", Keywords = \"" + keywords + "\"\n");
1230 leisch 54
    return;
55
  }
56
 
57
 
8090 leisch 58
  public boolean matches (String aString, boolean searchDesc,
59
			  boolean searchKeywords, boolean searchAliases)
1230 leisch 60
  {
8090 leisch 61
    if (searchAliases &&
62
	(iAliases.toUpperCase ().indexOf (aString.toUpperCase ()) > -1))
63
      {
3765 leisch 64
	return true;
65
      }
8090 leisch 66
 
67
    if (searchDesc &&
68
	(iDescription.toUpperCase ().indexOf (aString.toUpperCase ()) > -1))
69
      {
3765 leisch 70
	return true;
71
      }
8090 leisch 72
 
73
    if (searchKeywords &&
74
	(iKey.toUpperCase ().indexOf (aString.toUpperCase ()) > -1))
75
      {
76
	return true;
77
      }
78
 
3765 leisch 79
    return false;
1230 leisch 80
  }
81
 
82
 
83
  public String getDescription ()
84
  {
85
    return iDescription;
86
  }
87
 
8090 leisch 88
  public String getEntry ()
89
  {
90
    return iEntry;
91
  }
1230 leisch 92
 
8090 leisch 93
  public String getAliases ()
1230 leisch 94
  {
8090 leisch 95
    return iAliases;
1230 leisch 96
  }
97
 
98
  public String getURL ()
99
  {
100
    return iURL;
101
  }
102
 
103
 
8090 leisch 104
  private String iEntry;
1230 leisch 105
  private String iKey;
8090 leisch 106
  private String iAliases;
1230 leisch 107
  private String iDescription;
108
  private String iURL;
109
 
110
 
111
}
112
 
113
// Local Variables:
114
// mode: Java
115
// mode: font-lock
116
// End: