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

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

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
SDESChunk.java | 100% (1/1) | 83% (10/12) | 87% (187/216) | 89% (40,1/45)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class SDESChunk | 100% (1/1) | 83% (10/12) | 87% (187/216) | 89% (40,1/45)
getItem (int): SDESItem |  | 0% (0/1) | 0% (0/6) | 0% (0/1)
getNumberofItems (): int |  | 0% (0/1) | 0% (0/6) | 0% (0/1)
generate (byte [], int): int |  | 100% (1/1) | 87% (60/69) | 93% (11,2/12)
<static initializer> |  | 100% (1/1) | 88% (7/8) | 87% (0,9/1)
parse (byte [], int, int): int |  | 100% (1/1) | 91% (51/56) | 93% (14/15)
equals (Object): boolean |  | 100% (1/1) | 91% (21/23) | 80% (4/5)
SDESChunk (): void |  | 100% (1/1) | 100% (8/8) | 100% (2/2)
addItem (SDESItem): void |  | 100% (1/1) | 100% (6/6) | 100% (2/2)
getSSRC_CSRC (): long |  | 100% (1/1) | 100% (3/3) | 100% (1/1)
hashCode (): int |  | 100% (1/1) | 100% (13/13) | 100% (2/2)
setSSRC_CSRC (long): void |  | 100% (1/1) | 100% (4/4) | 100% (2/2)
toString (): String |  | 100% (1/1) | 100% (14/14) | 100% (2/2)

1 | package cz.vutbr.feec.packets.rtcp;
2 |
3 | import java.util.Vector;
4 |
5 | import cz.vutbr.feec.packets.IPacket;
6 | import cz.vutbr.feec.packets.PacketGenerateException;
7 | import cz.vutbr.feec.packets.PacketParseException;
8 | import cz.vutbr.feec.packets.PacketUtils;
9 | import org.apache.commons.lang.builder.ToStringBuilder;
10 | import org.apache.commons.lang.builder.EqualsBuilder;
11 | import org.apache.commons.lang.builder.HashCodeBuilder;
12 |
13 | /**
14 | * The Class SDESChunk.
15 | */
16 | public class SDESChunk implements IPacket {
17 |
18 | private long SSRC_CSRC;
19 |
20 | private Vector<SDESItem> items = new Vector<SDESItem>();
21 |
22 | public void addItem(SDESItem item) {
23 | items.add(item);
24 | }
25 |
26 | public SDESItem getItem(int index) {
27 | return items.get(index);
28 | }
29 |
30 | public int getNumberofItems() {
31 | // automaticky pridava END item
32 | return items.size() + 1;
33 | }
34 |
35 | public int generate(byte[] buffer, int offset)
36 | throws PacketGenerateException {
37 | assert PacketUtils.checkSize(getSSRC_CSRC(), 32);
38 | int len = 0;
39 | PacketUtils.setOctet4(buffer, offset + len, getSSRC_CSRC());
40 | len += 4;
41 | for (SDESItem item : items) {
42 | len += item.generate(buffer, offset + len);
43 | }
44 | PacketUtils.setOctet1(buffer, offset + len + 1, SDESItem.END);
45 | int length = 0;
46 | PacketUtils.setOctet1(buffer, offset + len + 2, length);
47 |
48 | // bound to 32 bit word
49 | len += 2;
50 | len = PacketUtils.bound32(buffer, offset, len);
51 | return len;
52 | }
53 |
54 | public int parse(byte[] buffer, int offset, int length)
55 | throws PacketParseException {
56 | int len = 0;
57 | setSSRC_CSRC(PacketUtils.getOctet4(buffer, offset + len));
58 | len = len + 4;
59 | int counter = 0;
60 | items.clear();
61 | while (PacketUtils.getOctet1(buffer, offset + len + 1) != SDESItem.END) {
62 | SDESItem item = new SDESItem();
63 | len += item.parse(buffer, offset + len, length);
64 | addItem(item);
65 | if (counter > 255) {
66 | throw new PacketParseException("Too Much Items Parsed");
67 | }
68 | counter++;
69 | }
70 | // bound to 32 bit
71 | len += 2;
72 | len = PacketUtils.bound32(len);
73 | return len;
74 | }
75 |
76 | public long getSSRC_CSRC() {
77 | return SSRC_CSRC;
78 | }
79 |
80 | public void setSSRC_CSRC(long ssrc_csrc) {
81 | SSRC_CSRC = ssrc_csrc;
82 | }
83 |
84 | /**
85 | * @see java.lang.Object#toString()
86 | */
87 | public String toString() {
88 | return new ToStringBuilder(this).append("items", this.items).append(
89 | "SSRC_CSRC", this.SSRC_CSRC).toString();
90 | }
91 |
92 | /**
93 | * @see java.lang.Object#equals(Object)
94 | */
95 | public boolean equals(Object object) {
96 | if (!(object instanceof SDESChunk)) {
97 | return false;
98 | }
99 | SDESChunk rhs = (SDESChunk) object;
100 | return new EqualsBuilder().append(this.items, rhs.items).append(
101 | this.SSRC_CSRC, rhs.SSRC_CSRC).isEquals();
102 | }
103 |
104 | /**
105 | * @see java.lang.Object#hashCode()
106 | */
107 | public int hashCode() {
108 | return new HashCodeBuilder(-572145375, -537819921).append(this.items)
109 | .append(this.SSRC_CSRC).toHashCode();
110 | }
111 |
112 | }

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