Clover Coverage Report - AnCal Coverage Report
Coverage timestamp: gio dic 18 2014 12:18:42 EST
../../../../../img/srcFileCovDistChart8.png 73% of files have more coverage
64   173   25   4,27
20   140   0,39   15
15     1,67  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  AlarmDataViewItem       Line # 9 64 25 77,8% 0.7777778
 
No Tests
 
1   
2    package pl.magot.vetch.ancal.reminder;
3   
4   
5    import pl.magot.vetch.ancal.R;
6    import pl.magot.vetch.ancal.Utils;
7   
8   
 
9    public class AlarmDataViewItem
10    {
11    //fields
12    public static final int iOrderAppts = 0;
13    public static final int iOrderTasks = 1;
14   
15    //fields
16    private long lID = -1;
17    protected String sSubject = "";
18    private int iOrder = -1;
19    private int iHour = 0;
20    private int iMinute = 0;
21    private int iDurationInMinutes = 0;
22    protected boolean bAlarm = false;
23    protected long lPriority = -1;
24    private long lRepeatDaysBitMask = 0;
25   
26    //methods
 
27  15 toggle public AlarmDataViewItem(long lID, String sSubject, int iOrder, boolean bAlarm)
28    {
29  15 this.lID = lID;
30  15 this.sSubject = sSubject;
31  15 this.iOrder = iOrder;
32  15 this.bAlarm = bAlarm;
33    }
34   
 
35  9 toggle public void Set(int iHour, int iMinute, int iDurationInMinutes)
36    {
37  9 this.iHour = iHour;
38  9 this.iMinute = iMinute;
39  9 this.iDurationInMinutes = iDurationInMinutes;
40    }
41   
 
42  6 toggle public void Set(long lPriority)
43    {
44  6 this.lPriority = lPriority;
45    }
46   
 
47  4 toggle public int TimeAsSeconds()
48    {
49  4 return (iMinute * 60) + (iHour * 3600);
50    }
51   
 
52  9 toggle public long GetID()
53    {
54  9 return lID;
55    }
56   
 
57  48 toggle public int GetOrder()
58    {
59  48 return this.iOrder;
60    }
61   
 
62  0 toggle public int GetDuration()
63    {
64  0 return iDurationInMinutes;
65    }
66   
 
67  9 toggle public void SetRepeatDays(long lDaysData)
68    {
69  9 lRepeatDaysBitMask = lDaysData;
70    }
71   
72    //returns true if 0, +1, +2, and so on day back is active
 
73  0 toggle public boolean GetVisibleDay(int iDay)
74    {
75  0 long bitMask = 0x01L << iDay;
76  0 return ((lRepeatDaysBitMask & bitMask) != 0);
77    }
78   
 
79  9 toggle public int GetOverdueDays()
80    {
81  9 long bitMask = 0x01L;
82  37 for (int iDayOffset = 0; iDayOffset < 7; iDayOffset++)
83    {
84  33 if ((lRepeatDaysBitMask & bitMask) == bitMask)
85  5 return iDayOffset;
86  28 bitMask <<= 1;
87    }
88  4 return 0;
89    }
90   
 
91  4 toggle public boolean IsOverdue()
92    {
93  4 long bitMask = 0x01L;
94  4 return ((lRepeatDaysBitMask & bitMask) == 0);
95    }
96   
 
97  0 toggle public int GetTimeKey()
98    {
99  0 return (iHour * 100) + iMinute;
100    }
101   
 
102  5 toggle public String GetTimeAsText(boolean b24HourMode)
103    {
104  5 String s = "";
105  5 String sm = "AM";
106  5 if (iHour >= 12)
107  0 sm = "PM";
108  5 int iDisplayHour = iHour;
109  5 if (iDisplayHour == 0)
110  5 iDisplayHour = 12;
111  5 if (iDisplayHour > 12)
112  0 iDisplayHour -= 12;
113    //format time
114  5 if (b24HourMode)
115    {
116  0 s = String.format("%1$d:%2$02d", iHour, iMinute);
117    } else {
118  5 s = String.format("%1$d:%2$02d %3$s", iDisplayHour, iMinute, sm);
119    }
120  5 return s;
121    }
122   
 
123  9 toggle public String GetText(Utils utils, boolean b24HourMode)
124    {
125  9 final int iOverdueDays = GetOverdueDays();
126  9 String s = "";
127   
128  9 String sText = new String(sSubject);
129  9 sText = sText.replace("\n", " ");
130  9 sText = Utils.CapitalizeFirstLetter(sText);
131   
132    //appt info
133  9 if (iOrder == iOrderAppts)
134    {
135  5 if (iOverdueDays == 0)
136    {
137  5 String sTime = GetTimeAsText(b24HourMode);
138  5 s = String.format("%1$s. %2$s", sTime, sText);
139    } else {
140  0 String sOverdueText = utils.GetResStr(R.string.msgDaysOverdue);
141  0 s = String.format("%1$s. (%2$d %3$s)", sText, iOverdueDays, sOverdueText);
142  0 if (iOverdueDays == 1)
143    {
144  0 sOverdueText = utils.GetResStr(R.string.msgDayOverdue);
145  0 s = String.format("%1$s. (%2$s)", sText, sOverdueText);
146    }
147    }
148    }
149   
150    //task info
151  9 if (iOrder == iOrderTasks)
152    {
153  4 s = String.format("%2$s. (%1$d)", lPriority, sText);
154    }
155   
156  9 return s;
157    }
158   
 
159  15 toggle public String GetHashString()
160    {
161  15 String s = "";
162  15 s += Long.toString(lID);
163  15 s += sSubject;
164  15 s += Integer.toString(iOrder);
165  15 s += Integer.toString(iHour);
166  15 s += Integer.toString(iMinute);
167  15 s += Boolean.toString(bAlarm);
168  15 s += Long.toString(lPriority);
169  15 s += Long.toString(lRepeatDaysBitMask);
170  15 return s;
171    }
172   
173    }