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

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

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
LMVPacket.java | 0% (0/1) | 0% (0/11) | 0% (0/144) | 0% (0/29)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class LMVPacket | 0% (0/1) | 0% (0/11) | 0% (0/144) | 0% (0/29)
<static initializer> |  | 0% (0/1) | 0% (0/8) | 0% (0/1)
LMVPacket (): void |  | 0% (0/1) | 0% (0/4) | 0% (0/2)
generate (byte [], int): int |  | 0% (0/1) | 0% (0/16) | 0% (0/3)
generateRestLMV (byte [], int): int |  | 0% (0/1) | 0% (0/36) | 0% (0/5)
getLMSidVector (): long |  | 0% (0/1) | 0% (0/3) | 0% (0/1)
getLMSseqNumber (): long |  | 0% (0/1) | 0% (0/3) | 0% (0/1)
parse (byte [], int, int): int |  | 0% (0/1) | 0% (0/16) | 0% (0/3)
parseRestLMV (byte [], int, int): int |  | 0% (0/1) | 0% (0/16) | 0% (0/3)
setLMSidVector (long): void |  | 0% (0/1) | 0% (0/4) | 0% (0/2)
setLMSseqNumber (long): void |  | 0% (0/1) | 0% (0/4) | 0% (0/2)
toString (): String |  | 0% (0/1) | 0% (0/34) | 0% (0/6)

1 | package cz.vutbr.feec.packets.ttp;
2 |
3 | import cz.vutbr.feec.packets.PacketGenerateException;
4 | import cz.vutbr.feec.packets.PacketParseException;
5 | import cz.vutbr.feec.packets.PacketUtils;
6 | import org.apache.commons.lang.builder.ToStringBuilder;
7 |
8 | public class LMVPacket extends GeneralTTPHeader {
9 |
10 | private long LMSseqNumber;
11 | private long LMSidVector;
12 |
13 | public LMVPacket() {
14 | super(4);
15 | }
16 | /**
17 | * Generate buffer of values in LMV header. <i>This method generates
18 | * specific size of bytes into the buffer.</i>
19 | * @param resultArray - memory bytes for generating buffer
20 | * @param startPos - starting position in resultArray
21 | */
22 | @Override
23 | public int generate(byte[] resultArray, int startPos)
24 | throws PacketGenerateException {
25 |
26 | int length = super.generate(resultArray, startPos);
27 | length += generateRestLMV(resultArray, startPos + length);
28 |
29 | return length;
30 | }
31 |
32 | private int generateRestLMV(byte[] buffer, int offset) {
33 |
34 | assert PacketUtils.checkSize(this.getLMSseqNumber(), 32);
35 | assert PacketUtils.checkSize(this.getLMSidVector(), 32);
36 |
37 | //adding LMS sequence number
38 | PacketUtils.setOctet4(buffer, offset, this.getLMSseqNumber());
39 | //adding LMS ID vector
40 | PacketUtils.setOctet4(buffer, offset +4, this.getLMSidVector());
41 |
42 | // zbytek hlavicky zabere celkem 64 bitu
43 | return 2*4;
44 | }
45 | /**
46 | * Parsing LMV header values from buffer. <i>This method takes specific
47 | * number of bytes from buffer and parse them into LMV header values. </i>
48 | * @param resultArray - memory bytes for parsing the values
49 | * @param startPos - starting position in resultArray
50 | * @param length - length of header
51 | */
52 | @Override
53 | public int parse(byte[] resultArray, int startPos, int length)
54 | throws PacketParseException {
55 | int len = super.parse(resultArray, startPos, length);
56 | len += this.parseRestLMV(resultArray, startPos, length);
57 | return len;
58 | }
59 |
60 |
61 | private int parseRestLMV(byte[] resultArray, int startPos, int length) throws PacketParseException{
62 | this.setLMSseqNumber(PacketUtils.getOctet4(resultArray, 4 + startPos));
63 | this.setLMSidVector(PacketUtils.getOctet4(resultArray, 8 + startPos));
64 | return 4;
65 | }
66 |
67 | public long getLMSseqNumber() {
68 | return LMSseqNumber;
69 | }
70 |
71 | public void setLMSseqNumber(long vseqNumber) {
72 | LMSseqNumber = vseqNumber;
73 | }
74 |
75 | public long getLMSidVector() {
76 | return LMSidVector;
77 | }
78 |
79 | public void setLMSidVector(long vidVector) {
80 | LMSidVector = vidVector;
81 | }
82 | /**
83 | * @see java.lang.Object#toString()
84 | */
85 | public String toString() {
86 | return new ToStringBuilder(this).append("version", this.getVersion())
87 | .append("padding", this.getPadding()).append("packetType",
88 | this.getPacketType()).append("LMSseqNumber",
89 | this.LMSseqNumber).append("LMSidVector",
90 | this.LMSidVector).append("length", this.getLength())
91 | .append("feedbackTreeId", this.getFeedbackTreeId()).toString();
92 | }
93 | }

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