1 |
|
|
2 |
|
package pl.magot.vetch.ancal.dataview; |
3 |
|
|
4 |
|
|
5 |
|
import java.util.Calendar; |
6 |
|
|
7 |
|
import pl.magot.vetch.ancal.agenda.AgendaViewType; |
8 |
|
|
9 |
|
|
|
|
| 79,5% |
Uncovered Elements: 15 (73) |
Complexity: 25 |
Complexity Density: 0,62 |
|
10 |
|
public class DataViewItem |
11 |
|
{ |
12 |
|
|
13 |
|
public long lID = -1; |
14 |
|
public String sSubject = ""; |
15 |
|
|
16 |
|
private long lStartDate = 0; |
17 |
|
private int iHour = 0; |
18 |
|
private int iMinute = 0; |
19 |
|
|
20 |
|
public long lRepeatEndOnDate = 0; |
21 |
|
public long lDueDate = 0; |
22 |
|
|
23 |
|
public int iDurationInMinutes = 0; |
24 |
|
public boolean bAlarm = false; |
25 |
|
public boolean bDone = false; |
26 |
|
public boolean bAllDay = false; |
27 |
|
public long lPriority = -1; |
28 |
|
public int iRepeatType = 0; |
29 |
|
public int iRepeatEvery = 1; |
30 |
|
public AgendaViewType viewMode = AgendaViewType.NONE; |
31 |
|
|
32 |
|
private long lRepeatDaysBitMask = 0; |
33 |
|
|
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
35 |
443
|
public void Clear()... |
36 |
|
{ |
37 |
443
|
lRepeatDaysBitMask = 0; |
38 |
|
} |
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
40 |
515
|
public boolean IsRepeat()... |
41 |
|
{ |
42 |
515
|
return (iRepeatType > 0); |
43 |
|
} |
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
381
|
public boolean UseRepeatEndOnDate()... |
46 |
|
{ |
47 |
381
|
return (lRepeatEndOnDate > 0); |
48 |
|
} |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
31
|
public boolean UseDueDate()... |
51 |
|
{ |
52 |
31
|
return (lDueDate > 0); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
55 |
105
|
public void SetStartDate(Calendar calUtilDate, long lStartDate)... |
56 |
|
{ |
57 |
105
|
this.lStartDate = lStartDate; |
58 |
105
|
calUtilDate.setTimeInMillis(this.lStartDate); |
59 |
105
|
iHour = calUtilDate.get(Calendar.HOUR_OF_DAY); |
60 |
105
|
iMinute = calUtilDate.get(Calendar.MINUTE); |
61 |
|
} |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
619
|
public long GetStartDateAsLong()... |
64 |
|
{ |
65 |
619
|
return lStartDate; |
66 |
|
} |
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0,67 |
|
68 |
151
|
public int GetStartHour()... |
69 |
|
{ |
70 |
151
|
if (bAllDay) |
71 |
97
|
return 0; |
72 |
54
|
return iHour; |
73 |
|
} |
74 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0,67 |
|
75 |
127
|
public int GetStartMinute()... |
76 |
|
{ |
77 |
127
|
if (bAllDay) |
78 |
83
|
return 0; |
79 |
44
|
return iMinute; |
80 |
|
} |
81 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
9
|
public int GetDuration()... |
83 |
|
{ |
84 |
9
|
return iDurationInMinutes; |
85 |
|
} |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
6
|
public long GetPriority()... |
88 |
|
{ |
89 |
6
|
return lPriority; |
90 |
|
} |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
156
|
public void SetVisibleDay(int iDay)... |
93 |
|
{ |
94 |
156
|
lRepeatDaysBitMask |= 0x01L << iDay; |
95 |
|
} |
96 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
97 |
938
|
public boolean GetVisibleDay(int iDay)... |
98 |
|
{ |
99 |
938
|
long bitMask = 0x01L << iDay; |
100 |
938
|
return ((lRepeatDaysBitMask & bitMask) != 0); |
101 |
|
} |
102 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
9
|
public long GetVisibleDays()... |
104 |
|
{ |
105 |
9
|
return lRepeatDaysBitMask; |
106 |
|
} |
107 |
|
|
108 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0,4 |
|
109 |
0
|
public long GetTimeDataAsBitMask(int iDay)... |
110 |
|
{ |
111 |
0
|
if (GetVisibleDay(iDay)) |
112 |
|
{ |
113 |
0
|
int iHour = GetStartHour(); |
114 |
0
|
long bitHour = 0x01L << iHour; |
115 |
0
|
return bitHour; |
116 |
|
} |
117 |
0
|
return 0; |
118 |
|
} |
119 |
|
|
|
|
| 60% |
Uncovered Elements: 4 (10) |
Complexity: 3 |
Complexity Density: 0,5 |
|
120 |
23
|
public int GetOverdueDays()... |
121 |
|
{ |
122 |
23
|
long bitMask = 0x01L; |
123 |
23
|
for (int iDayOffset = 0; iDayOffset < 7; iDayOffset++) |
124 |
|
{ |
125 |
23
|
if ((lRepeatDaysBitMask & bitMask) == bitMask) |
126 |
23
|
return iDayOffset; |
127 |
0
|
bitMask <<= 1; |
128 |
|
} |
129 |
0
|
return 0; |
130 |
|
} |
131 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
132 |
23
|
public int GetTimeKey()... |
133 |
|
{ |
134 |
23
|
return (GetStartHour() * 100) + GetStartMinute(); |
135 |
|
} |
136 |
|
|
|
|
| 76,9% |
Uncovered Elements: 3 (13) |
Complexity: 4 |
Complexity Density: 0,57 |
|
137 |
23
|
public boolean TimeOverdue(int iCurrTimeKey)... |
138 |
|
{ |
139 |
23
|
final int iOverdueDays = GetOverdueDays(); |
140 |
|
|
141 |
|
|
142 |
23
|
if (iOverdueDays == 0) |
143 |
|
{ |
144 |
23
|
if (iCurrTimeKey >= GetTimeKey()) |
145 |
15
|
return true; |
146 |
|
} |
147 |
|
|
148 |
|
|
149 |
8
|
if (iOverdueDays > 0) |
150 |
0
|
return true; |
151 |
|
|
152 |
8
|
return false; |
153 |
|
} |
154 |
|
|
155 |
|
} |