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

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

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
FTCPacket.java | 0% (0/1) | 0% (0/13) | 0% (0/185) | 0% (0/37)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class FTCPacket | 0% (0/1) | 0% (0/13) | 0% (0/185) | 0% (0/37)
<static initializer> |  | 0% (0/1) | 0% (0/8) | 0% (0/1)
FTCPacket (): void |  | 0% (0/1) | 0% (0/4) | 0% (0/2)
generate (byte [], int): int |  | 0% (0/1) | 0% (0/16) | 0% (0/3)
generateRestFTC (byte [], int): int |  | 0% (0/1) | 0% (0/58) | 0% (0/7)
getActivationStatus (): int |  | 0% (0/1) | 0% (0/3) | 0% (0/1)
getFeedbackTargetPort (): long |  | 0% (0/1) | 0% (0/3) | 0% (0/1)
getReservedEnd (): int |  | 0% (0/1) | 0% (0/3) | 0% (0/1)
parse (byte [], int, int): int |  | 0% (0/1) | 0% (0/16) | 0% (0/3)
parseRestFTC (byte [], int, int): int |  | 0% (0/1) | 0% (0/24) | 0% (0/4)
setActivationStatus (int): void |  | 0% (0/1) | 0% (0/4) | 0% (0/2)
setFeedbackTargetPort (long): void |  | 0% (0/1) | 0% (0/4) | 0% (0/2)
setReservedEnd (int): void |  | 0% (0/1) | 0% (0/4) | 0% (0/2)
toString (): String |  | 0% (0/1) | 0% (0/38) | 0% (0/8)

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 FTCPacket extends GeneralTTPHeader {
9 |
10 | private long feedbackTargetPort;
11 | private int activationStatus;
12 | private int reservedEnd;
13 |
14 | public FTCPacket() {
15 | super(3);
16 | }
17 | /**
18 | * Generate buffer of values in FTC header. <i>This method generates
19 | * specific size of bytes into the buffer.</i>
20 | * @param resultArray - memory bytes for generating buffer
21 | * @param startPos - starting position in resultArray
22 | */
23 | @Override
24 | public int generate(byte[] resultArray, int startPos)
25 | throws PacketGenerateException {
26 | int length = super.generate(resultArray, startPos);
27 | length += generateRestFTC(resultArray, startPos+length);
28 | return length;
29 | }
30 |
31 | private int generateRestFTC(byte[] buffer, int offset){
32 |
33 | assert PacketUtils.checkSize(this.getFeedbackTargetPort(), 16);
34 | assert PacketUtils.checkSize(this.getActivationStatus(), 8);
35 | assert PacketUtils.checkSize(this.getReservedEnd(), 8);
36 |
37 |
38 | //adding Feedback target port to buffer
39 |
40 | PacketUtils.setOctet2(buffer, offset, this.getFeedbackTargetPort());
41 | //adding Activation status
42 |
43 | PacketUtils.setOctet1(buffer, offset+2, this.getActivationStatus());
44 | //adding ReservedEnd
45 |
46 | PacketUtils.setOctet1(buffer, offset+3, this.getReservedEnd());
47 | // zbytek hlavicky zabere celkem 32 bitu
48 | return 4;
49 | }
50 | /**
51 | * Parsing FTC header values from buffer. <i>This method takes specific
52 | * number of bytes from buffer and parse them into FTC header values. </i>
53 | * @param resultArray - memory bytes for parsing the values
54 | * @param startPos - starting position in resultArray
55 | * @param length - length of header
56 | */
57 | @Override
58 | public int parse(byte[] resultArray, int startPos, int length)
59 | throws PacketParseException {
60 | int len = super.parse(resultArray, startPos, length);
61 | len += this.parseRestFTC(resultArray, startPos, length);
62 | return len;
63 | }
64 |
65 |
66 | private int parseRestFTC(byte[] resultArray, int startPos, int length) throws PacketParseException{
67 | this.setFeedbackTargetPort(PacketUtils.getOctet2(resultArray, 4+ startPos));
68 | this.setActivationStatus(PacketUtils.getOctet1(resultArray, 6 + startPos));
69 | this.setReservedEnd(PacketUtils.getOctet1(resultArray, 7 + startPos));
70 |
71 | return 4;
72 | }
73 |
74 | public long getFeedbackTargetPort() {
75 | return feedbackTargetPort;
76 | }
77 |
78 | public void setFeedbackTargetPort(long feedbackTargetPort) {
79 | this.feedbackTargetPort = feedbackTargetPort;
80 | }
81 |
82 | public int getActivationStatus() {
83 | return activationStatus;
84 | }
85 |
86 | public void setActivationStatus(int activationStatus) {
87 | this.activationStatus = activationStatus;
88 | }
89 |
90 | public int getReservedEnd() {
91 | return reservedEnd;
92 | }
93 |
94 | public void setReservedEnd(int reservedEnd) {
95 | this.reservedEnd = reservedEnd;
96 | }
97 | /**
98 | * @see java.lang.Object#toString()
99 | */
100 | public String toString() {
101 | return new ToStringBuilder(this).append("activationStatus",
102 | this.activationStatus).append("feedbackTargetPort",
103 | this.feedbackTargetPort).append("version", this.getVersion())
104 | .append("padding", this.getPadding()).append("reservedEnd",
105 | this.reservedEnd).append("packetType",
106 | this.getPacketType())
107 | .append("length", this.getLength()).append("feedbackTreeId",
108 | this.getFeedbackTreeId()).toString();
109 | }
110 |
111 | }

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