The R Project SVN R

Rev

Rev 8090 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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