1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.monitor.api

File MonitorTimer.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
21
9
1
93
60
10
0.48
2.33
9
1.11

Classes

Class Line # Actions
MonitorTimer 24 21 0% 10 30
0.00%
 

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 com.xpn.xwiki.monitor.api;
21   
22    import java.util.Date;
23   
 
24    public class MonitorTimer
25    {
26    private String name;
27   
28    private String details;
29   
30    private Date startDate;
31   
32    private Date endDate;
33   
 
34  0 toggle public MonitorTimer(String name, String details)
35    {
36  0 this.setName(name);
37  0 this.setDetails(details);
38    }
39   
 
40  0 toggle public void setStartDate()
41    {
42  0 this.startDate = new Date();
43    }
44   
 
45  0 toggle public void setEndDate()
46    {
47  0 this.endDate = new Date();
48    }
49   
 
50  0 toggle public long getDuration()
51    {
52  0 return this.endDate.getTime() - this.startDate.getTime();
53    }
54   
 
55  0 toggle public String getName()
56    {
57  0 return this.name;
58    }
59   
 
60  0 toggle public void setName(String name)
61    {
62  0 this.name = name;
63    }
64   
 
65  0 toggle public String getDetails()
66    {
67  0 return this.details;
68    }
69   
 
70  0 toggle public void setDetails(String details)
71    {
72  0 this.details = details;
73    }
74   
 
75  0 toggle @Override
76    public String toString()
77    {
78  0 StringBuffer str = new StringBuffer();
79  0 str.append(" Name: ");
80  0 str.append(this.name);
81  0 str.append(" Details: ");
82  0 str.append(" Start Date: ");
83  0 str.append(this.startDate);
84  0 str.append(" End Date: ");
85  0 str.append(this.endDate);
86  0 str.append(" Duration: ");
87  0 try {
88  0 str.append(this.endDate.getTime() - this.startDate.getTime());
89    } catch (Exception e) {
90    }
91  0 return str.toString();
92    }
93    }