1 /* 2 * Copyright (C) 2005 Alfresco, Inc. 3 * 4 * Licensed under the Mozilla Public License version 1.1 5 * with a permitted attribution clause. You may obtain a 6 * copy of the License at 7 * 8 * http://www.alfresco.org/legal/license.txt 9 * 10 * Unless required by applicable law or agreed to in writing, 11 * software distributed under the License is distributed on an 12 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 13 * either express or implied. See the License for the specific 14 * language governing permissions and limitations under the 15 * License. 16 */ 17 package org.alfresco.service.cmr.search; 18 19 import java.util.List; 20 21 import org.alfresco.service.cmr.repository.ChildAssociationRef; 22 import org.alfresco.service.cmr.repository.NodeRef; 23 import org.alfresco.service.cmr.repository.Path; 24 25 /** 26 * An iterable result set from a searcher query. TODO: Expose meta data and XML 27 * 28 * @author andyh 29 * 30 */ 31 public interface ResultSet extends Iterable<ResultSetRow> // Specfic iterator 32 // over 33 // ResultSetRows 34 { 35 /** 36 * Get the relative paths to all the elements contained in this result set 37 */ 38 Path[] getPropertyPaths(); 39 40 /** 41 * Get the size of the result set 42 */ 43 int length(); 44 45 /** 46 * Get the id of the node at the given index 47 */ 48 NodeRef getNodeRef(int n); 49 50 /** 51 * Get the score for the node at the given position 52 */ 53 float getScore(int n); 54 55 /** 56 * Close the result set. 57 * This must be called to allow the release of underlying resources. 58 */ 59 60 void close(); 61 62 /** 63 * Get a row from the result set by row index, starting at 0. 64 * 65 * @param i 66 * @return 67 */ 68 ResultSetRow getRow(int i); 69 70 /** 71 * Get a list of all the node refs in the result set 72 * @return 73 */ 74 List<NodeRef> getNodeRefs(); 75 76 /** 77 * Get a list of all the child associations in the results set. 78 * 79 * @return 80 */ 81 List<ChildAssociationRef> getChildAssocRefs(); 82 83 /** 84 * Get the child assoc ref for a particular row. 85 * 86 * @param n 87 * @return 88 */ 89 ChildAssociationRef getChildAssocRef(int n); 90 91 /** 92 * Get the meta data for the results set. 93 * 94 * @return 95 */ 96 ResultSetMetaData getResultSetMetaData(); 97 } 98