Line | Hits | Source |
---|---|---|
1 | package net.sf.tourviewer.ciclo; | |
2 | ||
3 | ||
4 | public class DataRecord { | |
5 | ||
6 | private int altitudeDelta; | |
7 | private int pulseDelta; | |
8 | private int distanceDelta; | |
9 | ||
10 | 0 | public DataRecord(int value) { |
11 | // high -> low | |
12 | ||
13 | // pulse (4) | |
14 | 0 | if ((value & 0x8000) != 0) |
15 | 0 | pulseDelta = (-16 + ((value & 0x7000) >> 12)) * 2; |
16 | else | |
17 | 0 | pulseDelta = ((value & 0x7000) >> 12) * 2; |
18 | ||
19 | // altitude (6) | |
20 | 0 | if ((value & 0x0800) != 0) { |
21 | 0 | altitudeDelta = -32 + ((value & 0x07C0) >> 6); |
22 | 0 | if (altitudeDelta < -16) |
23 | 0 | altitudeDelta = -16 + ((altitudeDelta + 16) * 7); |
24 | } else { | |
25 | 0 | altitudeDelta = (value & 0x07C0) >> 6; |
26 | 0 | if (altitudeDelta > 16) |
27 | 0 | altitudeDelta = 16 + ((altitudeDelta - 16) * 7); |
28 | } | |
29 | ||
30 | // distance (6) | |
31 | 0 | distanceDelta = value & 0x003F; |
32 | 0 | } |
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. |