The R Project SVN R

Rev

Rev 5458 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1230 leisch 1
/*==============================================================================
2
 
3
  Project: Simple JAVA Search Engine for Keyword Search
4
 
5
  JAVA Source file for the class IndexTable
6
 
7
  COPYRIGHT (C), 1998, Thomas Baier
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
22
 
1230 leisch 23
 
24
  $Source: /scratch/CVS-ARCHIVE/R/doc/html/search/IndexTable.java,v $
25
 
5458 ripley 26
  $Revision: 1.4 $
1230 leisch 27
 
3786 pd 28
 
5458 ripley 29
  $Date: 1999/08/10 09:56:03 $
1230 leisch 30
 
5458 ripley 31
  $Author: ripley $
1230 leisch 32
 
33
==============================================================================*/
34
 
35
 
36
/* -------------------------------- Imports --------------------------------- */
37
 
38
import java.util.Vector;
39
import java.util.Enumeration;
40
 
41
 
42
 
43
/*==============================================================================
44
                          Interface of class IndexTable
45
==============================================================================*/
46
 
47
/*------------------------------------------------------------------------------
48
  CLASS:    IndexTable
49
  SUPER:    Vector
50
  CONF. TO: 
51
  PURPOSE:  
52
  NOTES:    
53
 
54
  HISTORY:  98-04-26: created
3765 leisch 55
            98-05-15: new static members for search-mode
1230 leisch 56
------------------------------------------------------------------------------*/
57
public class IndexTable extends Vector
58
{
59
  /*============================================================================
60
                                Public methods
61
  ============================================================================*/
62
 
63
  /*----------------------------------------------------------------------------
64
    INTERFACE: 
65
    PURPOSE:   build a vector of found entries
66
 
67
    NOTES:     convenience function to extend Vector super class
68
 
69
    PARAMS:    String key: the search string
70
    THROWS:    
71
    RETURNS:   Vector: a vector of found entries or null if no matches found
72
 
73
    HISTORY:   98-04-26: created
3765 leisch 74
               98-05-15: new parameter for search mode
1230 leisch 75
  ----------------------------------------------------------------------------*/
3765 leisch 76
  public Vector search (String key,int mode)
1230 leisch 77
  {
78
    Vector returnValue = new Vector ();
79
    Enumeration cursor = elements ();
80
 
81
    while (cursor.hasMoreElements ()) {
82
      IndexEntry entry = (IndexEntry) cursor.nextElement ();
83
 
3765 leisch 84
      if (entry.matches (key,mode)) {
1230 leisch 85
	returnValue.addElement (entry);
86
      }
87
    }
88
    if (!returnValue.isEmpty ()) {
89
      return returnValue;
90
    }
91
 
92
    return null;
93
  }
94
 
95
 
96
  /*============================================================================
97
                              Protected methods
98
  ============================================================================*/
99
 
100
  /*============================================================================
101
                               Private methods
102
  ============================================================================*/
103
 
104
  /*============================================================================
105
                             Instance Variables
106
  ============================================================================*/
107
 
108
  /*============================================================================
109
                                Static Data
110
  ============================================================================*/
3765 leisch 111
  public static final int cSearchDescription = 0x00000001;
1230 leisch 112
}
113
 
114
 
115
/*==============================================================================
116
 
117
  HISTORY:
118
 
119
  $Log: IndexTable.java,v $
5458 ripley 120
  Revision 1.4  1999/08/10 09:56:03  ripley
121
  change FSF address in copyrights
122
  add some copyrights in src/gnome and elsewhere
123
 
3786 pd 124
  Revision 1.3  1999/03/05 19:18:38  pd
125
  branch update
126
 
127
 
3765 leisch 128
  Revision 1.2  1999/03/04 17:15:18  leisch
129
  various bugfixes
1230 leisch 130
 
3765 leisch 131
  Revision 1.1.4.1  1999/03/02 15:19:56  leisch
132
  search used only kewords, no titles
133
 
134
  Revision 1.2  1998/05/15 22:09:15  baier
135
  support searching in description
136
 
1230 leisch 137
  Revision 1.1  1998/04/26 21:46:51  baier
138
  Initial revision
139
 
140
 
141
==============================================================================*/
142
 
143
 
144
// Local Variables:
145
// mode: Java
146
// mode: font-lock
147
// End: