Source code: com/sample/addressbook/controller/components/search/SearchResult.java
1 /*
2 * SearchResult.java
3 *
4 * Copyright (c) 2001, 2002 Aendvari, Ltd. All Rights Reserved.
5 *
6 * See the file LICENSE for terms of use.
7 *
8 */
9
10 package com.sample.addressbook.controller.components.search;
11
12 import java.util.Collection;
13
14 import java.io.Serializable;
15
16
17 /**
18 * Contains the results of a search:<p>
19 *
20 * The total number of result items.<br>
21 * The subset of the result items requested.<p>
22 *
23 * A search result may contain only a subset of the query. Each subset
24 * typically represents a single "page" of results.<p>
25 *
26 * @author Trevor Milne
27 *
28 */
29
30 public class SearchResult implements Serializable
31 {
32 /** Total number of items in result. */
33 protected int totalCount;
34
35 /** The subset of the result items. */
36 protected Collection items;
37
38 /* Construction. */
39
40 /**
41 * Creates an instance.
42 *
43 * @param totalCount The total number of items in the result.
44 * @param items A subset of the result.
45 *
46 */
47
48 public SearchResult(int setTotalCount, Collection setItems)
49 {
50 totalCount = setTotalCount;
51 items = setItems;
52 }
53
54 /* Accessors. */
55
56 /**
57 * Returns the total number of items.
58 *
59 * @return The total number of items.
60 *
61 */
62
63 public int getTotalCount()
64 {
65 return totalCount;
66 }
67
68 /**
69 * Returns the subset of the result.
70 *
71 * @return The subset of the result.
72 *
73 */
74
75 public Collection getItems()
76 {
77 return items;
78 }
79 }
80