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

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

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
SenderReportPacket.java | 100% (1/1) | 76% (16/21) | 53% (214/404) | 56% (45,8/82)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class SenderReportPacket | 100% (1/1) | 76% (16/21) | 53% (214/404) | 56% (45,8/82)
equals (Object): boolean |  | 0% (0/1) | 0% (0/52) | 0% (0/11)
getNTP_timestamp_FULL (): long |  | 0% (0/1) | 0% (0/3) | 0% (0/1)
hashCode (): int |  | 0% (0/1) | 0% (0/31) | 0% (0/6)
setNTP_timestamp_FULL (long): void |  | 0% (0/1) | 0% (0/4) | 0% (0/2)
toString (): String |  | 0% (0/1) | 0% (0/54) | 0% (0/12)
generateRestSR (byte [], int): int |  | 100% (1/1) | 61% (69/114) | 73% (10,9/15)
<static initializer> |  | 100% (1/1) | 88% (7/8) | 87% (0,9/1)
SenderReportPacket (): void |  | 100% (1/1) | 100% (3/3) | 100% (1/1)
generate (byte [], int): int |  | 100% (1/1) | 100% (16/16) | 100% (3/3)
getNTP_timestamp_LSW (): long |  | 100% (1/1) | 100% (3/3) | 100% (1/1)
getNTP_timestamp_MSW (): long |  | 100% (1/1) | 100% (3/3) | 100% (1/1)
getRTP_timestamp (): long |  | 100% (1/1) | 100% (3/3) | 100% (1/1)
getSenderOctetCount (): long |  | 100% (1/1) | 100% (3/3) | 100% (1/1)
getSenderPacketCount (): long |  | 100% (1/1) | 100% (3/3) | 100% (1/1)
parse (byte [], int, int): int |  | 100% (1/1) | 100% (18/18) | 100% (3/3)
parseRestSR (byte [], int, int): int |  | 100% (1/1) | 100% (66/66) | 100% (13/13)
setNTP_timestamp_LSW (long): void |  | 100% (1/1) | 100% (4/4) | 100% (2/2)
setNTP_timestamp_MSW (long): void |  | 100% (1/1) | 100% (4/4) | 100% (2/2)
setRTP_timestamp (long): void |  | 100% (1/1) | 100% (4/4) | 100% (2/2)
setSenderOctetCount (long): void |  | 100% (1/1) | 100% (4/4) | 100% (2/2)
setSenderPacketCount (long): void |  | 100% (1/1) | 100% (4/4) | 100% (2/2)

1 | package cz.vutbr.feec.packets.rtcp;
2 |
3 | import org.apache.commons.lang.builder.ToStringBuilder;
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.EqualsBuilder;
9 | import org.apache.commons.lang.builder.HashCodeBuilder;
10 |
11 | /**
12 | * This class encapsulates all the necessary parameters of a Sender Report that
13 | * needs to be handed to the Application when a Sender Report is received. Note:
14 | * this class derives from RTCPPacket
15 | */
16 | public class SenderReportPacket extends ReportPacket {
17 |
18 | private long NTP_timestamp_MSW;
19 | private long NTP_timestamp_LSW;
20 | private long NTP_timestamp_FULL;
21 | private long RTP_timestamp;
22 | private long senderPacketCount;
23 | private long senderOctetCount;
24 |
25 | @Override
26 | public int generate(byte[] buffer, int offset)
27 | throws PacketGenerateException {
28 | int length = super.generate(buffer, offset);
29 | length += this.generateRestSR(buffer, offset+length);
30 | return length;
31 | }
32 |
33 | private int generateRestSR(byte[] buffer, int offset) throws PacketGenerateException{
34 | assert PacketUtils.checkSize(this.getNTP_timestamp_MSW(), 32);
35 | assert PacketUtils.checkSize(this.getNTP_timestamp_LSW(), 32);
36 | assert PacketUtils.checkSize(this.getRTP_timestamp(), 32);
37 | assert PacketUtils.checkSize(this.getSenderPacketCount(), 32);
38 | assert PacketUtils.checkSize(this.getSenderOctetCount(), 32);
39 |
40 | int len = 0;
41 | PacketUtils.setOctet4(buffer, offset, this.getNTP_timestamp_MSW());
42 | PacketUtils.setOctet4(buffer, offset+4, this.getNTP_timestamp_LSW());
43 | PacketUtils.setOctet4(buffer, offset+8, this.getRTP_timestamp());
44 | PacketUtils.setOctet4(buffer, offset+12, this.getSenderPacketCount());
45 | PacketUtils.setOctet4(buffer, offset+16, this.getSenderOctetCount());
46 | len += 5*4;
47 | for (ReportBlock block: reportBlockList){
48 | len += block.generate(buffer, offset+len);
49 | }
50 | return len;
51 | }
52 | @Override
53 | public int parse(byte[] buffer, int offset, int length)
54 | throws PacketParseException {
55 | int len = super.parse(buffer, offset, length);
56 | len += this.parseRestSR(buffer, offset+len, length);
57 | return len;
58 | }
59 | private int parseRestSR(byte[] buffer, int offset, int length) throws PacketParseException{
60 | int len = 0;
61 | this.setNTP_timestamp_MSW(PacketUtils.getOctet4(buffer, offset));
62 | this.setNTP_timestamp_LSW(PacketUtils.getOctet4(buffer, offset+4));
63 | this.setRTP_timestamp(PacketUtils.getOctet4(buffer, offset+8));
64 | this.setSenderPacketCount(PacketUtils.getOctet4(buffer, offset+12));
65 | this.setSenderOctetCount(PacketUtils.getOctet4(buffer, offset+16));
66 | len += 5*4;
67 | reportBlockList.clear();
68 | for (int i = 0; i < super.reportCount; i++) {
69 | ReportBlock block = new ReportBlock();
70 | len += block.parse(buffer, offset + len, length);
71 | addReportBlock(block);
72 | }
73 |
74 | return len;
75 | }
76 | public long getNTP_timestamp_MSW() {
77 | return NTP_timestamp_MSW;
78 | }
79 |
80 | public void setNTP_timestamp_MSW(long ntp_timestamp_msb) {
81 | NTP_timestamp_MSW = ntp_timestamp_msb;
82 | }
83 |
84 | public long getNTP_timestamp_LSW() {
85 | return NTP_timestamp_LSW;
86 | }
87 |
88 | public void setNTP_timestamp_LSW(long ntp_timestamp_lsb) {
89 | NTP_timestamp_LSW = ntp_timestamp_lsb;
90 | }
91 |
92 | public long getNTP_timestamp_FULL() {
93 | return NTP_timestamp_FULL;
94 | }
95 |
96 | public void setNTP_timestamp_FULL(long ntp_timestamp_full) {
97 | NTP_timestamp_FULL = ntp_timestamp_full;
98 | }
99 |
100 | public long getRTP_timestamp() {
101 | return RTP_timestamp;
102 | }
103 |
104 | public void setRTP_timestamp(long rtp_timestamp) {
105 | RTP_timestamp = rtp_timestamp;
106 | }
107 |
108 | public long getSenderPacketCount() {
109 | return senderPacketCount;
110 | }
111 |
112 | public void setSenderPacketCount(long sender_Packet_Count) {
113 | senderPacketCount = sender_Packet_Count;
114 | }
115 |
116 | public long getSenderOctetCount() {
117 | return senderOctetCount;
118 | }
119 |
120 | public void setSenderOctetCount(long sender_Octet_Count) {
121 | senderOctetCount = sender_Octet_Count;
122 | }
123 |
124 | /**
125 | * @see java.lang.Object#toString()
126 | */
127 | public String toString() {
128 | return new ToStringBuilder(this).append("padding", this.getPadding())
129 | .append("reportCount", this.getReportCount()).append(
130 | "NTP_timestamp_FULL", this.NTP_timestamp_FULL).append(
131 | "senderPacketCount", this.senderPacketCount).append(
132 | "SSRC", this.getSSRC()).append("NTP_timestamp_MSW",
133 | this.NTP_timestamp_MSW).append("version",
134 | this.getVersion()).append("NTP_timestamp_LSW",
135 | this.NTP_timestamp_LSW).append("RTP_timestamp",
136 | this.RTP_timestamp).append("payloadtype",
137 | this.getPayloadtype()).append("length",
138 | this.getLength()).append("senderOctetCount",
139 | this.senderOctetCount).toString();
140 | }
141 |
142 | /**
143 | * @see java.lang.Object#equals(Object)
144 | */
145 | public boolean equals(Object object) {
146 | if (!(object instanceof SenderReportPacket)) {
147 | return false;
148 | }
149 | SenderReportPacket rhs = (SenderReportPacket) object;
150 | return new EqualsBuilder().appendSuper(super.equals(object)).append(
151 | this.RTP_timestamp, rhs.RTP_timestamp).append(this.reportBlockList,
152 | rhs.reportBlockList).append(this.NTP_timestamp_FULL,
153 | rhs.NTP_timestamp_FULL).append(this.senderPacketCount,
154 | rhs.senderPacketCount).append(this.NTP_timestamp_MSW,
155 | rhs.NTP_timestamp_MSW).append(this.senderOctetCount,
156 | rhs.senderOctetCount).append(this.NTP_timestamp_LSW,
157 | rhs.NTP_timestamp_LSW).isEquals();
158 | }
159 |
160 | /**
161 | * @see java.lang.Object#hashCode()
162 | */
163 | public int hashCode() {
164 | return new HashCodeBuilder(-723683447, 145851681).appendSuper(
165 | super.hashCode()).append(this.RTP_timestamp).append(
166 | this.NTP_timestamp_FULL).append(this.senderPacketCount).append(
167 | this.NTP_timestamp_MSW).append(this.reportBlockList).append(
168 | this.senderOctetCount).append(this.NTP_timestamp_LSW)
169 | .toHashCode();
170 | }
171 | }

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