File Source: searchhit.java
/*
P/P * Method: net.sourceforge.pebble.search.SearchHit__static_init
*/
1 /*
2 * Copyright (c) 2003-2006, Simon Brown
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 *
16 * - Neither the name of Pebble nor the names of its contributors may
17 * be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32 package net.sourceforge.pebble.search;
33
34 import net.sourceforge.pebble.domain.Blog;
35
36 import java.util.Date;
37
38 /**
39 * A container for the results of a search (a search hit).
40 *
41 * @author Simon Brown
42 */
43 public class SearchHit {
44
45 /** the blog to which the result belongs */
46 private Blog blog;
47
48 /** the id of the blog entry that matched the search query */
49 private String id;
50
51 /** the permalink of the blog entry that matched the search query */
52 private String permalink;
53
54 /** the title of the blog entry that matched the search query */
55 private String title;
56
57 /** the excerpt of the blog entry that matched the search query */
58 private String excerpt;
59
60 /** the date of the blog entry */
61 private Date date;
62
63 /** the score of the matched */
64 private float score;
65
66 /** the number of this result */
67 private int number;
68
69 /**
70 * Creates a new instance with the specified message.
71 */
/*
P/P * Method: void net.sourceforge.pebble.search.SearchHit(Blog, String, String, String, String, Date, float)
*
* Postconditions:
* this.blog == blog
* init'ed(this.blog)
* this.date == date
* init'ed(this.date)
* this.excerpt == excerpt
* init'ed(this.excerpt)
* this.id == id
* init'ed(this.id)
* this.permalink == permalink
* init'ed(this.permalink)
* ...
*/
72 public SearchHit(Blog blog, String id, String permalink, String title, String excerpt, Date date, float score) {
73 this.blog = blog;
74 this.id = id;
75 this.permalink = permalink;
76 this.title = title;
77 this.excerpt = excerpt;
78 this.date = date;
79 this.score = score;
80 }
81
82 /**
83 * Gets the blog for the matching blog entry.
84 *
85 * @return the owning Blog instance
86 */
87 public Blog getBlog() {
/*
P/P * Method: Blog getBlog()
*
* Preconditions:
* init'ed(this.blog)
*
* Postconditions:
* return_value == this.blog
* init'ed(return_value)
*/
88 return this.blog;
89 }
90
91 /**
92 * Gets the id for the matching blog entry.
93 *
94 * @return the id as a String
95 */
96 public String getId() {
/*
P/P * Method: String getId()
*
* Preconditions:
* init'ed(this.id)
*
* Postconditions:
* return_value == this.id
* init'ed(return_value)
*/
97 return this.id;
98 }
99
100 /**
101 * Gets the permalink for the matching blog entry.
102 *
103 * @return a permalink as a String
104 */
105 public String getPermalink() {
/*
P/P * Method: String getPermalink()
*
* Preconditions:
* init'ed(this.permalink)
*
* Postconditions:
* return_value == this.permalink
* init'ed(return_value)
*/
106 return this.permalink;
107 }
108
109 /**
110 * Gets the title for the matching blog entry.
111 *
112 * @return a title as a String
113 */
114 public String getTitle() {
/*
P/P * Method: String getTitle()
*
* Preconditions:
* init'ed(this.title)
*
* Postconditions:
* return_value == this.title
* init'ed(return_value)
*/
115 return title;
116 }
117
118 /**
119 * Gets the excerpt for the matching blog entry.
120 *
121 * @return a excerpt as a String
122 */
123 public String getExcerpt() {
/*
P/P * Method: String getExcerpt()
*
* Preconditions:
* init'ed(this.excerpt)
*
* Postconditions:
* return_value == this.excerpt
* init'ed(return_value)
*/
124 return excerpt;
125 }
126
127 /**
128 * Gets the date of the matching blog entry.
129 *
130 * @return the date as a Date
131 */
132 public Date getDate() {
/*
P/P * Method: Date getDate()
*
* Preconditions:
* init'ed(this.date)
*
* Postconditions:
* return_value == this.date
* init'ed(return_value)
*/
133 return this.date;
134 }
135
136 /**
137 * Gets the score for the matching blog entry.
138 *
139 * @return a score as a float
140 */
141 public float getScore() {
/*
P/P * Method: float getScore()
*
* Preconditions:
* init'ed(this.score)
*
* Postconditions:
* return_value == this.score
* init'ed(return_value)
*/
142 return this.score;
143 }
144
145 /**
146 * Gets the number of this result.
147 *
148 * @return the number as an int
149 */
150 public int getNumber() {
/*
P/P * Method: int getNumber()
*
* Preconditions:
* init'ed(this.number)
*
* Postconditions:
* return_value == this.number
* init'ed(return_value)
*/
151 return this.number;
152 }
153
154 /**
155 * Sets the number of this result.
156 *
157 * @param n the number as an int
158 */
159 public void setNumber(int n) {
/*
P/P * Method: void setNumber(int)
*
* Postconditions:
* this.number == n
* init'ed(this.number)
*/
160 this.number = n;
161 }
162
163 }
SofCheck Inspector Build Version : 2.22510
| searchhit.java |
2010-Jun-25 19:40:32 |
| searchhit.class |
2010-Jul-19 20:23:38 |