EMMA Coverage Report (generated Tue Dec 18 20:38:46 CET 2007)
[all classes][cz.vutbr.feec.session.rtprtcp.internal]

## COVERAGE SUMMARY FOR SOURCE FILE [MemberTable.java]

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
MemberTable.java | 0% (0/1) | 0% (0/23) | 0% (0/593) | 0% (0/87)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class MemberTable | 0% (0/1) | 0% (0/23) | 0% (0/593) | 0% (0/87)
<static initializer> |  | 0% (0/1) | 0% (0/8) | 0% (0/1)
MemberTable (): void |  | 0% (0/1) | 0% (0/21) | 0% (0/5)
addMember (long, long): Source |  | 0% (0/1) | 0% (0/87) | 0% (0/9)
addSender (long, long): void |  | 0% (0/1) | 0% (0/54) | 0% (0/12)
existInvalid (long): boolean |  | 0% (0/1) | 0% (0/10) | 0% (0/1)
existMember (long): boolean |  | 0% (0/1) | 0% (0/10) | 0% (0/1)
existSender (long): boolean |  | 0% (0/1) | 0% (0/10) | 0% (0/1)
expireInvalid (long): void |  | 0% (0/1) | 0% (0/69) | 0% (0/8)
expireMember (long): void |  | 0% (0/1) | 0% (0/58) | 0% (0/8)
expireSender (long): void |  | 0% (0/1) | 0% (0/24) | 0% (0/3)
getInvalidCount (): int |  | 0% (0/1) | 0% (0/4) | 0% (0/1)
getMember (long): Source |  | 0% (0/1) | 0% (0/7) | 0% (0/1)
getMemberOrCreateMember (long): Source |  | 0% (0/1) | 0% (0/25) | 0% (0/6)
getMemberOrInvalid (long): Source |  | 0% (0/1) | 0% (0/41) | 0% (0/6)
getMembersCount (): int |  | 0% (0/1) | 0% (0/4) | 0% (0/1)
getMembersTable (): Enumeration |  | 0% (0/1) | 0% (0/4) | 0% (0/1)
getPreviousMemebersCount (): int |  | 0% (0/1) | 0% (0/3) | 0% (0/1)
getSendersCount (): int |  | 0% (0/1) | 0% (0/4) | 0% (0/1)
getSendersTable (): Enumeration |  | 0% (0/1) | 0% (0/4) | 0% (0/1)
printMembersInfo (): String |  | 0% (0/1) | 0% (0/79) | 0% (0/7)
removeMember (long): void |  | 0% (0/1) | 0% (0/19) | 0% (0/4)
setPreviousMemebersCount (int): void |  | 0% (0/1) | 0% (0/4) | 0% (0/2)
validate (long): void |  | 0% (0/1) | 0% (0/44) | 0% (0/7)

1 | package cz.vutbr.feec.session.rtprtcp.internal;
2 |
3 | import java.util.Enumeration;
4 | import java.util.Hashtable;
5 |
6 |
7 | /**
8 | * The Class MemberTable.
9 | */
10 | public class MemberTable {
11 | /** The members map. */
12 | protected Hashtable<Long, Source> membersMap = new Hashtable<Long, Source>();
13 |
14 | /** The senders map. */
15 | protected Hashtable<Long, Source> sendersMap = new Hashtable<Long, Source>();
16 |
17 | /** The invalid map. */
18 | protected Hashtable<Long, Source> invalidMap = new Hashtable<Long, Source>();
19 |
20 | /** The previous memebers count. */
21 | private int previousMemebersCount = 0;
22 |
23 | /**
24 | * Adds the member.
25 | *
26 | * @param seqNo the seq no
27 | * @param SSRC the SSRC
28 | *
29 | * @return the source
30 | */
31 | protected synchronized Source addMember(long SSRC, long seqNo ) {
32 | assert invalidMap.get(Long.valueOf(SSRC)) == null: "Member "+SSRC+" jiz existuje v tabulce invalidMap!!!";;
33 | assert membersMap.get(Long.valueOf(SSRC)) == null: "Member "+SSRC+" jiz existuje v tabulce membersMap!!!";;
34 | assert sendersMap.get(Long.valueOf(SSRC)) == null: "Member "+SSRC+" jiz existuje v tabulce sendersMap!!!";;
35 |
36 | Source src = new Source(SSRC, seqNo);
37 | src.probation = Source.MIN_SEQUENTIAL;
38 | src.timeOfLastRTPSent = 0; // we_sent = false
39 | src.setValidated(false);
40 |
41 | invalidMap.put(Long.valueOf(SSRC), src);
42 | return src;
43 | }
44 |
45 | /**
46 | * Validate.
47 | *
48 | * @param SSRC the SSRC
49 | */
50 | protected synchronized void validate(long SSRC) {
51 | Source src = invalidMap.get(Long.valueOf(SSRC));
52 | assert src != null: "Member "+SSRC+" neexistuje v tabulce invalidMap!!!";
53 |
54 | src.timeOfLastRTPSent = 0; // we_sent = false;
55 | src.setValidated(true);
56 |
57 | invalidMap.remove(Long.valueOf(SSRC));
58 | membersMap.put(Long.valueOf(SSRC), src);
59 | }
60 |
61 | /**
62 | * Vytvori clena v Members a Senders tabulkach a oznaci jej jako Valid.
63 | * Pokud nektery z nich jiz existuje, nic se nedeje.
64 | * Tato akce je volana pri prijeti RTP packetu.
65 | *
66 | * @param seqNo the seq no
67 | * @param SSRC the SSRC
68 | */
69 | protected synchronized void addSender(long SSRC, long seqNo) {
70 | Source src = invalidMap.get(Long.valueOf(SSRC));
71 | // is invalid
72 | if(src!=null){
73 | validate(SSRC);
74 | } else {
75 | // is validated or doesno exists (null)
76 | src = membersMap.get(Long.valueOf(SSRC));
77 | if(src == null){
78 | // vubec neexistuje
79 | src = addMember(SSRC, seqNo);
80 | }
81 | }
82 | sendersMap.put(Long.valueOf(SSRC), src);
83 |
84 | // nastavi Source jako ze odeslal v tento cas
85 | src.timeOfLastRTPSent = System.currentTimeMillis();
86 | src.setValidated(true);
87 |
88 | invalidMap.remove(Long.valueOf(SSRC));
89 | membersMap.put(Long.valueOf(SSRC), src);
90 | }
91 |
92 | /**
93 | * Odstrani z tabulky clenu.
94 | *
95 | * @param SSRC the SSRC
96 | */
97 | protected synchronized void expireSender(long SSRC) {
98 | assert existSender(SSRC): "Pokus o vyprseni neexistujiciho sender:"+SSRC;
99 | sendersMap.remove(Long.valueOf(SSRC));
100 | }
101 |
102 | /**
103 | * Odstrani z tabulky clenu.
104 | *
105 | * @param SSRC the SSRC
106 | */
107 | public synchronized void removeMember(long SSRC) {
108 | sendersMap.remove(Long.valueOf(SSRC));
109 | membersMap.remove(Long.valueOf(SSRC));
110 | invalidMap.remove(Long.valueOf(SSRC));
111 | }
112 |
113 | /**
114 | * Expire member.
115 | *
116 | * @param SSRC the SSRC
117 | */
118 | protected synchronized void expireMember(long SSRC) {
119 | assert existMember(SSRC): "Pokus o vyprseni neexistujiciho member:"+SSRC;
120 | assert !existInvalid(SSRC): "Pokus o vyprseni neexistujiciho member:"+SSRC;
121 |
122 | Long ssrc = Long.valueOf(SSRC);
123 | Source src = membersMap.get(ssrc);
124 | src.probation = Source.MIN_SEQUENTIAL;
125 |
126 | membersMap.remove(ssrc);
127 | invalidMap.put(ssrc, src);
128 | }
129 |
130 | /**
131 | * Expire invalid.
132 | *
133 | * @param SSRC the SSRC
134 | */
135 | protected synchronized void expireInvalid(long SSRC) {
136 | assert !existSender(SSRC): "Pokus o vyprseni z invalid - sender je stale aktivni member:"+SSRC;
137 | assert !existMember(SSRC): "Pokus o vyprseni z invalid - member je stale aktivni member:"+SSRC;
138 | assert existInvalid(SSRC): "Pokus o vyprseni neexistujiciho member:"+SSRC;
139 |
140 | Long ssrc = Long.valueOf(SSRC);
141 | Source src = invalidMap.get(ssrc);
142 | src.probation = Source.MIN_SEQUENTIAL;
143 |
144 | invalidMap.remove(ssrc);
145 | }
146 |
147 | /**
148 | * Gets the invalid count.
149 | *
150 | * @return count of invalid members
151 | */
152 | public synchronized int getInvalidCount() {
153 | return invalidMap.size();
154 | }
155 |
156 | /**
157 | * Gets the members count.
158 | *
159 | * @return count of valid members
160 | */
161 | public synchronized int getMembersCount() {
162 | return membersMap.size();
163 | }
164 |
165 | /**
166 | * Gets the senders count.
167 | *
168 | * @return count of senders
169 | */
170 | public synchronized int getSendersCount() {
171 | return sendersMap.size();
172 | }
173 |
174 | /**
175 | * Gets the member.
176 | *
177 | * @param SSRC the SSRC
178 | *
179 | * @return the member
180 | */
181 | public synchronized Source getMember(long SSRC) {
182 | return membersMap.get(Long.valueOf(SSRC));
183 | }
184 |
185 | /**
186 | * Gets the member or create member.
187 | *
188 | * @param SSRC the SSRC
189 | *
190 | * @return the member or create member
191 | */
192 | public synchronized Source getMemberOrCreateMember(long SSRC) {
193 | // get from members map
194 | Source src = membersMap.get(Long.valueOf(SSRC));
195 | // get from invalidsMap
196 | if(src == null){
197 | src = invalidMap.get(Long.valueOf(SSRC));
198 | }
199 | // create new
200 | if(src == null){
201 | src = addMember(SSRC, 0);
202 | }
203 | return src;
204 | }
205 |
206 | /**
207 | * Gets the member or invalid.
208 | *
209 | * @param SSRC the SSRC
210 | *
211 | * @return the member or invalid
212 | */
213 | public synchronized Source getMemberOrInvalid(long SSRC) {
214 | Source src = membersMap.get(Long.valueOf(SSRC));
215 | if(src == null){
216 | src = invalidMap.get(Long.valueOf(SSRC));
217 | }
218 | assert src != null : "Member nenalezen ("+SSRC+")\n"+printMembersInfo();
219 | printMembersInfo();
220 | return src;
221 | }
222 |
223 | /**
224 | * Exist sender.
225 | *
226 | * @param SSRC the SSRC
227 | *
228 | * @return true, if exist sender
229 | */
230 | private synchronized boolean existSender(long SSRC) {
231 | return sendersMap.get(Long.valueOf(SSRC))!= null;
232 | }
233 |
234 | /**
235 | * Exist member.
236 | *
237 | * @param SSRC the SSRC
238 | *
239 | * @return true, if exist member
240 | */
241 | public synchronized boolean existMember(long SSRC) {
242 | return membersMap.get(Long.valueOf(SSRC))!= null;
243 | }
244 |
245 | /**
246 | * Exist invalid.
247 | *
248 | * @param SSRC the SSRC
249 | *
250 | * @return true, if exist invalid
251 | */
252 | public synchronized boolean existInvalid(long SSRC) {
253 | return invalidMap.get(Long.valueOf(SSRC))!= null;
254 | }
255 |
256 | /**
257 | * Prints the members info.
258 | *
259 | * @return the string
260 | */
261 | protected String printMembersInfo() {
262 | String msg = "INVALID(" + getInvalidCount()+") ";
263 | msg += "MEMBERS(" + getMembersCount()+") ";
264 | msg += "SENDERS(" + getSendersCount()+") ";
265 | msg += " |"+membersMap+" |";
266 | msg += invalidMap+" | ";
267 | msg += sendersMap+" | ";
268 | return msg;
269 | }
270 |
271 | /**
272 | * Gets the senders table.
273 | *
274 | * @return the senders table
275 | */
276 | public Enumeration<Source> getSendersTable() {
277 | return sendersMap.elements();
278 | }
279 |
280 | /**
281 | * Gets the members table.
282 | *
283 | * @return the members table
284 | */
285 | public Enumeration<Source> getMembersTable() {
286 | return membersMap.elements();
287 | }
288 |
289 | /**
290 | * Gets the previous memebers count.
291 | *
292 | * @return the previous memebers count
293 | */
294 | public int getPreviousMemebersCount() {
295 | return previousMemebersCount;
296 | }
297 |
298 | /**
299 | * Sets the previous memebers count.
300 | *
301 | * @param previousMemebersCount the previous memebers count
302 | */
303 | public void setPreviousMemebersCount(int previousMemebersCount) {
304 | this.previousMemebersCount = previousMemebersCount;
305 | }
306 |
307 | }

[all classes][cz.vutbr.feec.session.rtprtcp.internal]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov