- Timestamp:
- 2001-03-05T08:44:51+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/java-client/org/nzdl/gsdl/service/NzdlResultSet.java
r2098 r2108 1 1 /* 2 * NzdlResultSet.java 3 * Copyright (C) 2001 New Zealand Digital Library Project 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20 //the package we're in 2 21 package org.nzdl.gsdl.service; 3 22 4 23 import java.util.*; 5 24 25 /** 26 * An object that holds results extracted from a response by 27 * {@link NzdlResponse#getResultSet() NzdlResponse.getResultSet()}. 28 * Easily interrogated by a user. 29 */ 6 30 public class NzdlResultSet extends java.lang.Object { 7 31 … … 11 35 private List m_queryTerms = null; 12 36 private List m_docIDs = null; 13 /** the key is the query term, the value its frequency */ 37 38 /* The key is the query term, the value its frequency */ 14 39 private Map m_frequencies = null; 15 /** 16 * the key is the docID, the value is the doc corresponding 40 41 /* 42 * The key is the docID, the value is the doc corresponding 17 43 * meta data which is also a Map where the key is the meta tag 18 44 * and the value is a set of values for that tag … … 20 46 private Map m_docToMetaDataMap = null; 21 47 22 /** */ 23 48 /** 49 * Creates an empty instance of NzdlResultSet. 50 */ 24 51 public NzdlResultSet() { 25 52 m_resultSet = new ArrayList(); … … 28 55 } 29 56 30 /** */ 31 57 /** 58 * Adds a {@link NzdlQueryHit NzdlQueryHit} to a result set. 59 * @param hit - is an instance of NzdlQueryHit. 60 */ 32 61 public void add( NzdlQueryHit _hit ) { 33 62 m_resultSet.add( _hit ) ; … … 37 66 } 38 67 68 /** 69 * Sets the number of documents in a NzdlResultSet. 70 * @param num the number of documents in the result set 71 */ 39 72 public void setNumOfDocs( int _num ) { 40 73 m_numDocs = _num; 41 74 } 42 75 76 77 /** 78 * Sets the result type. 79 * @param type an integer representing the result type. 80 */ 43 81 public void setResultType( int _type ) { 44 82 m_resultType = _type; 45 83 } 46 84 85 /** 86 * Sets the Query terms of a NzdlResultSet. 87 * @param terms a list of words within the query string. 88 */ 47 89 public void setQueryTerms( List _terms ) { 48 90 m_queryTerms = _terms; … … 53 95 // } 54 96 97 /** 98 * Sets the term frequencies within a NzdlResultSet. 99 * @param freqs a map of the term frequencies. The map key is the query term. 100 */ 55 101 public void setTermFrequencies( Map _freqs ) { 56 102 m_frequencies = _freqs; 57 103 } 58 104 59 /** */ 60 105 /** 106 * Returns the number of documents that matched a query. <br> 107 * Pre: A {@link NzdlResponse NzdlResponse} object has been created. A 108 * {@link NzdlService NzdlService} object has filled the NzdlResponse 109 * object with results from servicing a {@link NzdlRequest NzdlRequest}.<br> 110 * @return The number of documents that matched a query. This is limited 111 * by the maxDocs set in {@link NzdlQuery NzdlQuery} 112 */ 61 113 public int getNumOfDocs() { 62 114 return m_numDocs; 63 115 } 64 116 117 /** 118 * Returns the result type for the NzdlResultSet. <br> 119 * Pre: A {@link NzdlResponse NzdlResponse} object has been created. A 120 * {@link NzdlService NzdlService} object has filled the NzdlResponse 121 * object with results from servicing a {@link NzdlRequest NzdlRequest}.<br> 122 * @return result type as an integer. 123 */ 65 124 public int getResultType() { 66 125 return m_resultType; 67 126 } 68 127 128 /** 129 * Returns a list of the words within the query string. <br> 130 * Pre: A {@link NzdlResponse NzdlResponse} object has been created. A 131 * {@link NzdlService NzdlService} object has filled the NzdlResponse 132 * object with results from servicing a {@link NzdlRequest NzdlRequest}.<br> 133 * @return A list of words within the query string. 134 */ 69 135 public List getQueryTerms() { 70 136 return m_queryTerms; 71 137 } 72 138 139 /** 140 * Returns the number of hits for each word within the query string. <br> 141 * Pre: A {@link NzdlResponse NzdlResponse} object has been created. A 142 * {@link NzdlService NzdlService} object has filled the NzdlResponse 143 * object with results from servicing a {@link NzdlRequest NzdlRequest}.<br> 144 * @return A map of the frequency of each query word. The map key is the query term.. 145 */ 73 146 public Map getTermFrequencies() { 74 147 return m_frequencies; … … 90 163 // } 91 164 165 /** 166 * Returns a list of Document ID's in the NzdlResultSet. <br> 167 * Pre: A {@link NzdlResponse NzdlResponse} object has been created. A 168 * {@link NzdlService NzdlService} object has filled the NzdlResponse 169 * object with results from servicing a {@link NzdlRequest NzdlRequest}.<br> 170 * @return A list of Document ID's in the NzdlResultSet. 171 */ 92 172 public List getDocumentIDs() { 93 173 return m_docIDs; … … 105 185 // } 106 186 187 /** 188 * Returns metatag values for a document. <br> 189 * Pre: A {@link NzdlResponse NzdlResponse} object has been created. A 190 * {@link NzdlService NzdlService} object has filled the NzdlResponse 191 * object with results from servicing a {@link NzdlRequest NzdlRequest}.<br> 192 * @return A map of metatag values in the specified document. The key 193 * of the map is the metatag field such as Author or Title. 194 */ 107 195 public Set getMetaData( String _docID, String _metaTag ) { 108 196 Map metaData = (Map) m_docToMetaDataMap.get( _docID ); … … 110 198 } 111 199 200 /** 201 * Returns all values for a particular metatag in the result set. <br> 202 * Pre: A {@link NzdlResponse NzdlResponse} object has been created. A 203 * {@link NzdlService NzdlService} object has filled the NzdlResponse 204 * object with results from servicing a {@link NzdlRequest NzdlRequest}.<br> 205 * @param metaTag Descriptive data such as Author, Title or Date. 206 * @return A map of all values for a particular metatag in all documents 207 * in the NzdlResultSet. The map key is document ID. 208 */ 112 209 public Map getMetaData( String _metaTag ) { 113 210 Map metaData = new HashMap(); … … 119 216 } 120 217 218 /** 219 * Returns all values for all metatags in the result set. <br> 220 * Pre: A {@link NzdlResponse NzdlResponse} object has been created. A 221 * {@link NzdlService NzdlService} object has filled the NzdlResponse 222 * object with results from servicing a {@link NzdlRequest NzdlRequest}.<br> 223 * @return The metatag values for all metatags in all documents 224 * in the NzdlResultSet. The map key is document ID. 225 */ 121 226 public Map getAllMetaData( ) { 122 227 return m_docToMetaDataMap;
Note:
See TracChangeset
for help on using the changeset viewer.