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

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

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
CollisionsBlock.java | 0% (0/1) | 0% (0/6) | 0% (0/192) | 0% (0/21)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class CollisionsBlock | 0% (0/1) | 0% (0/6) | 0% (0/192) | 0% (0/21)
<static initializer> |  | 0% (0/1) | 0% (0/8) | 0% (0/1)
CollisionsBlock (): void |  | 0% (0/1) | 0% (0/8) | 0% (0/2)
addSSRC (long): void |  | 0% (0/1) | 0% (0/7) | 0% (0/2)
generate (byte [], int): int |  | 0% (0/1) | 0% (0/61) | 0% (0/6)
parse (byte [], int, int): int |  | 0% (0/1) | 0% (0/94) | 0% (0/9)
toString (): String |  | 0% (0/1) | 0% (0/14) | 0% (0/2)

1 | package cz.vutbr.feec.packets.rsi;
2 |
3 | import java.util.Vector;
4 |
5 | import cz.vutbr.feec.packets.PacketGenerateException;
6 | import cz.vutbr.feec.packets.PacketParseException;
7 | import cz.vutbr.feec.packets.PacketUtils;
8 | import org.apache.commons.lang.builder.ToStringBuilder;
9 |
10 | public class CollisionsBlock extends SubReportBlock {
11 | private Vector<Long> SSRCs = new Vector<Long>();
12 |
13 | public void addSSRC(long ssrc) {
14 | SSRCs.add(ssrc);
15 | }
16 |
17 | @Override
18 | public int generate(byte[] array, int offset) throws PacketGenerateException {
19 | assert this.getType() == collisionFeedback;
20 | super.generate(array, offset);
21 | assert SSRCs.size()+1 == length;
22 |
23 | for (int i = 0; i < SSRCs.size(); i++) {
24 | PacketUtils.setOctet4(array, offset+8+i*4, SSRCs.get(i));
25 | }
26 | return 4+4*SSRCs.size();
27 | }
28 |
29 | @Override
30 | public int parse(byte[] array, int offset, int packetLength) throws PacketParseException {
31 | super.parse(array, offset, packetLength);
32 | assert this.getType() == 8;
33 | for (int i = 0; i < SSRCs.size(); i++) {
34 | long tmp = ((array[4 + i*4 + offset] & 0xff) << 24)
35 | | ((array[5 + i*4 + offset] & 0xff) << 16)
36 | | ((array[6 + i*4 + offset] & 0xff) << 8)
37 | | (array[7 + i*4 + offset] & 0xff);
38 | SSRCs.add(tmp);
39 | }
40 | return 4+4*SSRCs.size();
41 | }
42 |
43 | /**
44 | * @see java.lang.Object#toString()
45 | */
46 | public String toString() {
47 | return new ToStringBuilder(this).append("type", this.getType()).append(
48 | "length", this.length).toString();
49 | }
50 |
51 | }

[all classes][cz.vutbr.feec.packets.rsi]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov