Coverage Report - net.sourceforge.pebble.search.SearchHit
 
Classes in this File Line Coverage Branch Coverage Complexity
SearchHit
100%
19/19
N/A
1
 
 1  
 /*
 2  
  * Copyright (c) 2003-2011, 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  
    */
 72  80
   public SearchHit(Blog blog, String id, String permalink, String title, String excerpt, Date date, float score) {
 73  80
     this.blog = blog;
 74  80
     this.id = id;
 75  80
     this.permalink = permalink;
 76  80
     this.title = title;
 77  80
     this.excerpt = excerpt;
 78  80
     this.date = date;
 79  80
     this.score = score;
 80  80
   }
 81  
 
 82  
   /**
 83  
    * Gets the blog for the matching blog entry.
 84  
    *
 85  
    * @return  the owning Blog instance
 86  
    */
 87  
   public Blog getBlog() {
 88  4
     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() {
 97  4
     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() {
 106  4
     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() {
 115  4
     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() {
 124  4
     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() {
 133  68
     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() {
 142  60
     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() {
 151  4
     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) {
 160  28
     this.number = n;
 161  28
   }
 162  
 
 163  
 }