1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.ratings.internal

File MemoryAverageRating.java

 

Coverage histogram

../../../../img/srcFileCovDistChart4.png
78% of files have more coverage

Code metrics

0
12
10
1
117
60
10
0.83
1.2
10
1

Classes

Class Line # Actions
MemoryAverageRating 31 12 0% 10 13
0.409090940.9%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software 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 GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.ratings.internal;
21   
22    import org.xwiki.model.reference.DocumentReference;
23    import org.xwiki.ratings.AverageRating;
24    import org.xwiki.ratings.RatingsException;
25   
26    /**
27    * @version $Id: d3706262a0ffe124bbb56a8685468f8f22b838a4 $
28    * @see AverageRating
29    * @since 6.4M3
30    */
 
31    public class MemoryAverageRating implements AverageRating
32    {
33    private DocumentReference documentRef;
34   
35    private int nbVotes;
36   
37    private float averageVote;
38   
39    private String method;
40   
41    /**
42    * MemoryAverageRating constructor.
43    *
44    * @param documentRef the document with which the average rating is associated
45    * @param nbVotes the total number of votes
46    * @param averageVote the average rating
47    * @param method the method to use when calculating the average
48    */
 
49  68 toggle public MemoryAverageRating(DocumentReference documentRef, int nbVotes, float averageVote, String method)
50    {
51  68 this.documentRef = documentRef;
52  68 this.nbVotes = nbVotes;
53  67 this.averageVote = averageVote;
54  67 this.method = method;
55    }
56   
57    /**
58    * Gets the document with which the average rating is associated.
59    *
60    * @return the document with which the average rating is associated
61    */
 
62  0 toggle public DocumentReference getDocumentReference()
63    {
64  0 return documentRef;
65    }
66   
67    /**
68    * Sets the document with which the average rating is associated.
69    *
70    * @param documentRef the document with which the average rating is associated
71    */
 
72  0 toggle public void setDocumentReference(DocumentReference documentRef)
73    {
74  0 this.documentRef = documentRef;
75    }
76   
 
77  67 toggle @Override
78    public int getNbVotes()
79    {
80  67 return nbVotes;
81    }
82   
 
83  0 toggle @Override
84    public void setNbVotes(int nbVotes)
85    {
86  0 this.nbVotes = nbVotes;
87    }
88   
 
89  67 toggle @Override
90    public float getAverageVote()
91    {
92  68 return averageVote;
93    }
94   
 
95  0 toggle @Override
96    public void setAverageVote(float averageVote)
97    {
98  0 this.averageVote = averageVote;
99    }
100   
 
101  0 toggle @Override
102    public String getMethod()
103    {
104  0 return method;
105    }
106   
 
107  0 toggle @Override
108    public void setMethod(String method)
109    {
110  0 this.method = method;
111    }
112   
 
113  0 toggle @Override
114    public void save() throws RatingsException
115    {
116    }
117    }