View Javadoc

1   /*
2    * Copyright 2000-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.services.search;
18  
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  
23  /***
24   * Container for search result entries
25   *
26   * @author <a href="mailto:taylor@apache.org">David Sean taylor</a>
27   * @version $Id: SearchResults.java,v 1.3 2004/02/23 03:48:47 jford Exp $
28   */
29  public class SearchResults
30  {
31      private List results = null;
32  
33      /***
34       */
35      public SearchResults()
36      {
37          init(0);
38      }
39  
40      /***
41       * 
42       * @param initialCapacity
43       */
44      public SearchResults(int initialCapacity)
45      {
46          init(initialCapacity);
47      }
48  
49      /***
50       * 
51       * @param initialCapacity
52       */
53      private void init(int initialCapacity)
54      {
55          results = new ArrayList(initialCapacity);
56      }
57  
58      /***
59       * 
60       * @param searchResult
61       * @return 
62       */
63      public boolean add(ParsedObject searchResult)
64      {
65          return results.add(searchResult);
66      }
67  
68      /***
69       * 
70       * @param index
71       * @param searchResult
72       */
73      public void add(int index, ParsedObject searchResult)
74      {
75          results.add(index, searchResult);
76          return;
77      }
78  
79      /***
80       * 
81       * @param index
82       * @return 
83       */
84      public ParsedObject get(int index)
85      {
86          return(ParsedObject) results.get(index);
87      }
88  
89      /***
90       * 
91       * @return 
92       */
93      public int size()
94      {
95          return results.size();
96      }
97  
98      /***
99       * 
100      * @return 
101      */
102     public List getResults()
103     {
104         return this.results;
105     }
106 }