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

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

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
SubReportBlock.java | 100% (1/1) | 88% (7/8) | 56% (82/146) | 70% (15,4/22)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class SubReportBlock | 100% (1/1) | 88% (7/8) | 56% (82/146) | 70% (15,4/22)
toString (): String |  | 0% (0/1) | 0% (0/14) | 0% (0/2)
generate (byte [], int): int |  | 100% (1/1) | 52% (22/42) | 66% (3,3/5)
parse (byte [], int, int): int |  | 100% (1/1) | 54% (34/63) | 64% (5,2/8)
<static initializer> |  | 100% (1/1) | 88% (7/8) | 87% (0,9/1)
SubReportBlock (): void |  | 100% (1/1) | 100% (9/9) | 100% (3/3)
getLength (): int |  | 100% (1/1) | 100% (3/3) | 100% (1/1)
getType (): int |  | 100% (1/1) | 100% (3/3) | 100% (1/1)
setType (int): void |  | 100% (1/1) | 100% (4/4) | 100% (2/2)

1 | package cz.vutbr.feec.packets.rsi;
2 |
3 | import cz.vutbr.feec.packets.IPacket;
4 | import cz.vutbr.feec.packets.PacketGenerateException;
5 | import cz.vutbr.feec.packets.PacketParseException;
6 | import cz.vutbr.feec.packets.PacketUtils;
7 | import org.apache.commons.lang.builder.ToStringBuilder;
8 |
9 | public class SubReportBlock implements IPacket {
10 | // Feedback Address Target sub-report block
11 | public static final int ipv4Address = 0;
12 | public static final int ipv6Address = 1;
13 | public static final int dnsUnicastFeedback = 2;
14 | // Generic Sub-report Block
15 | public static final int loss = 4;
16 | public static final int jitter = 5;
17 | public static final int rtt = 6;
18 | public static final int cummulLoss = 7;
19 | // Collisions sub-report block
20 | public static final int collisionFeedback = 8;
21 | // General Statistics sub-report block
22 | public static final int generalStatistics = 10;
23 | // RTCP Bandwidth Indication sub-report block
24 | public static final int receiverBandwidth = 11;
25 | // RTCP Group and Average Packet Size Sub-report Block
26 | public static final int groupAndAvgPktSize = 12;
27 |
28 | private int type = -1;
29 | protected int length = -1;
30 |
31 | public int generate(byte[] array, int offset) throws PacketGenerateException {
32 | assert PacketUtils.checkSize(type, 8);
33 | assert PacketUtils.checkSize(length, 8);
34 |
35 | array[offset + 0] = (byte)this.type;
36 | array[offset + 1] = (byte)this.length;
37 | return 2;
38 | }
39 |
40 | public int parse(byte[] array, int offset, int packetLength) throws PacketParseException {
41 | assert array.length >= packetLength+offset;
42 | if(packetLength < 4){
43 | throw new PacketParseException("Parsed data is too short!");
44 | }
45 | this.type = array[offset];
46 | this.length = array[offset+1];
47 | if(this.type < 0 || this.type > 12 || this.type == 3|| this.type == 9) {
48 | throw new PacketParseException("Detected type:"+this.type+ " is unknown");
49 | }
50 | return 2;
51 | }
52 | public int getLength() {
53 | return length;
54 | }
55 |
56 | public int getType() {
57 | return type;
58 | }
59 |
60 | protected void setType(int type) {
61 | this.type = type;
62 | }
63 |
64 | /**
65 | * @see java.lang.Object#toString()
66 | */
67 | public String toString() {
68 | return new ToStringBuilder(this).append("type", this.type).append(
69 | "length", this.length).toString();
70 | }
71 | }

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