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

COVERAGE SUMMARY FOR SOURCE FILE [GroupAndAvgPktSizeBlock.java]

nameclass, %method, %block, %line, %
GroupAndAvgPktSizeBlock.java0%   (0/1)0%   (0/5)0%   (0/125)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class GroupAndAvgPktSizeBlock0%   (0/1)0%   (0/5)0%   (0/125)0%   (0/19)
<static initializer> 0%   (0/1)0%   (0/8)0%   (0/1)
GroupAndAvgPktSizeBlock (): void 0%   (0/1)0%   (0/9)0%   (0/3)
generate (byte [], int): int 0%   (0/1)0%   (0/53)0%   (0/7)
parse (byte [], int, int): int 0%   (0/1)0%   (0/41)0%   (0/7)
toString (): String 0%   (0/1)0%   (0/14)0%   (0/2)

1package cz.vutbr.feec.packets.rsi;
2 
3import cz.vutbr.feec.packets.PacketGenerateException;
4import cz.vutbr.feec.packets.PacketParseException;
5import cz.vutbr.feec.packets.PacketUtils;
6import org.apache.commons.lang.builder.ToStringBuilder;
7 
8public class GroupAndAvgPktSizeBlock extends SubReportBlock {
9        public int avgPacketSize = -1;
10        public long receiverGroupSize = -1;
11        
12        public int parse(byte[] array, int offset, int packetLength) throws PacketParseException {
13                if(packetLength < 4*2) {
14                        throw new PacketParseException("packet is too short!");
15                }
16                // SBRT + Length
17                super.parse(array, offset, packetLength);
18                assert this.getType() == groupAndAvgPktSize;
19                // Receiver group size
20                this.receiverGroupSize = PacketUtils.getOctet2(array, offset+2);
21                // Jitter
22                this.receiverGroupSize = PacketUtils.getOctet4(array, offset+4);
23                
24                return 4*2;
25        }
26        
27        public int generate(byte[] array, int offset) throws PacketGenerateException {
28                assert this.getType() == groupAndAvgPktSize;
29                assert this.avgPacketSize != -1;
30                assert this.receiverGroupSize != -1;
31                
32                // SBRT + length
33                super.generate(array, offset);
34                // AVG packet size
35                PacketUtils.setOctet2(array, offset+2, avgPacketSize);
36                // avgPacketSize
37                PacketUtils.setOctet4(array, offset+4, avgPacketSize);
38                return 4*2;
39        }
40 
41        /**
42         * @see java.lang.Object#toString()
43         */
44        public String toString() {
45                return new ToStringBuilder(this).append("type", this.getType()).append(
46                                "length", this.length).toString();
47        }
48        
49}

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