Line | Hits | Source |
---|---|---|
1 | package net.sf.tourviewer.lib.ciclo; | |
2 | ||
3 | ||
4 | public class DataBlock { | |
5 | ||
6 | private int altitudeDelta; | |
7 | private int pulseDelta; | |
8 | private int distanceDelta; | |
9 | ||
10 | 125052 | public DataBlock(int value) { |
11 | // high -> low | |
12 | ||
13 | // pulse (4) | |
14 | 125052 | if ((value & 0x8000) != 0) |
15 | 896 | pulseDelta = (((value & 0x7000) >> 12) - 8) * 2; |
16 | else | |
17 | 124156 | pulseDelta = ((value & 0x7000) >> 12) * 2; |
18 | ||
19 | // altitude (6) | |
20 | 125052 | if ((value & 0x0800) != 0) { |
21 | 35914 | altitudeDelta = -32 + ((value & 0x07C0) >> 6); |
22 | 35914 | if (altitudeDelta < -16) |
23 | 310 | altitudeDelta = -16 + ((altitudeDelta + 16) * 7); |
24 | } else { | |
25 | 89138 | altitudeDelta = (value & 0x07C0) >> 6; |
26 | 89138 | if (altitudeDelta > 16) |
27 | 72 | altitudeDelta = 16 + ((altitudeDelta - 16) * 7); |
28 | } | |
29 | ||
30 | // distance (6) | |
31 | 125052 | distanceDelta = value & 0x003F; |
32 | 125052 | } |
33 | ||
34 | @Override | |
35 | public String toString() | |
36 | { | |
37 | 0 | return String.format("[P%3d,A%5d,D%2d]", pulseDelta, altitudeDelta, distanceDelta); |
38 | } | |
39 | ||
40 | ||
41 | public int getAltitudeDelta() | |
42 | { | |
43 | 0 | return altitudeDelta; |
44 | } | |
45 | ||
46 | ||
47 | public int getDistanceDelta() | |
48 | { | |
49 | 0 | return distanceDelta; |
50 | } | |
51 | ||
52 | ||
53 | public int getPulseDelta() | |
54 | { | |
55 | 0 | return pulseDelta; |
56 | } | |
57 | ||
58 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |