The R Project SVN R

Rev

Rev 1230 | Rev 3786 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1230 Rev 3765
Line 3... Line 3...
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 IndexTable
5
  JAVA Source file for the class IndexTable
6
  
6
  
7
  COPYRIGHT (C), 1998, Thomas Baier
7
  COPYRIGHT (C), 1998, Thomas Baier
-
 
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
8
  ALL RIGHTS RESERVED.
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
-
 
21
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
 
22
  
9
  
23
  
10
  $Source: /scratch/CVS-ARCHIVE/R/doc/html/search/IndexTable.java,v $
24
  $Source: /scratch/CVS-ARCHIVE/R/doc/html/search/IndexTable.java,v $
11
  
25
  
12
  $Revision: 1.1 $
26
  $Revision: 1.2 $
13
 
27
 
14
  $Date: 1998/05/15 10:38:10 $
28
  $Date: 1999/03/04 17:15:18 $
15
  
29
  
16
  $Author: leisch $
30
  $Author: leisch $
17
 
31
 
18
==============================================================================*/
32
==============================================================================*/
19
 
33
 
Line 35... Line 49...
35
  CONF. TO: 
49
  CONF. TO: 
36
  PURPOSE:  
50
  PURPOSE:  
37
  NOTES:    
51
  NOTES:    
38
 
52
 
39
  HISTORY:  98-04-26: created
53
  HISTORY:  98-04-26: created
-
 
54
            98-05-15: new static members for search-mode
40
------------------------------------------------------------------------------*/
55
------------------------------------------------------------------------------*/
41
public class IndexTable extends Vector
56
public class IndexTable extends Vector
42
{
57
{
43
  /*============================================================================
58
  /*============================================================================
44
                                Public methods
59
                                Public methods
Line 53... Line 68...
53
    PARAMS:    String key: the search string
68
    PARAMS:    String key: the search string
54
    THROWS:    
69
    THROWS:    
55
    RETURNS:   Vector: a vector of found entries or null if no matches found
70
    RETURNS:   Vector: a vector of found entries or null if no matches found
56
  
71
  
57
    HISTORY:   98-04-26: created
72
    HISTORY:   98-04-26: created
-
 
73
               98-05-15: new parameter for search mode
58
  ----------------------------------------------------------------------------*/
74
  ----------------------------------------------------------------------------*/
59
  public Vector search (String key)
75
  public Vector search (String key,int mode)
60
  {
76
  {
61
    Vector returnValue = new Vector ();
77
    Vector returnValue = new Vector ();
62
    Enumeration cursor = elements ();
78
    Enumeration cursor = elements ();
63
 
79
 
64
    while (cursor.hasMoreElements ()) {
80
    while (cursor.hasMoreElements ()) {
65
      IndexEntry entry = (IndexEntry) cursor.nextElement ();
81
      IndexEntry entry = (IndexEntry) cursor.nextElement ();
66
      
82
      
67
      if (entry.matches (key)) {
83
      if (entry.matches (key,mode)) {
68
	returnValue.addElement (entry);
84
	returnValue.addElement (entry);
69
      }
85
      }
70
    }
86
    }
71
    if (!returnValue.isEmpty ()) {
87
    if (!returnValue.isEmpty ()) {
72
      return returnValue;
88
      return returnValue;
Line 89... Line 105...
89
  ============================================================================*/
105
  ============================================================================*/
90
 
106
 
91
  /*============================================================================
107
  /*============================================================================
92
                                Static Data
108
                                Static Data
93
  ============================================================================*/
109
  ============================================================================*/
-
 
110
  public static final int cSearchDescription = 0x00000001;
94
}
111
}
95
 
112
 
96
 
113
 
97
/*==============================================================================
114
/*==============================================================================
98
 
115
 
99
  HISTORY:
116
  HISTORY:
100
  
117
  
101
  $Log: IndexTable.java,v $
118
  $Log: IndexTable.java,v $
102
  Revision 1.1  1998/05/15 10:38:10  leisch
119
  Revision 1.2  1999/03/04 17:15:18  leisch
-
 
120
  various bugfixes
-
 
121
 
-
 
122
  Revision 1.1.4.1  1999/03/02 15:19:56  leisch
-
 
123
  search used only kewords, no titles
-
 
124
 
-
 
125
  Revision 1.2  1998/05/15 22:09:15  baier
103
  New: Search Engine
126
  support searching in description
104
 
127
 
105
  Revision 1.1  1998/04/26 21:46:51  baier
128
  Revision 1.1  1998/04/26 21:46:51  baier
106
  Initial revision
129
  Initial revision
107
 
130
 
108
 
131