EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.sensorframework.storage.lists]

COVERAGE SUMMARY FOR SOURCE FILE [DoubleSerialiser.java]

nameclass, %method, %block, %line, %
DoubleSerialiser.java100% (1/1)100% (4/4)100% (114/114)100% (20/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DoubleSerialiser100% (1/1)100% (4/4)100% (114/114)100% (20/20)
DoubleSerialiser (): void 100% (1/1)100% (3/3)100% (1/1)
deserialise (byte []): Double [] 100% (1/1)100% (63/63)100% (10/10)
getElementLength (): long 100% (1/1)100% (2/2)100% (1/1)
serialise (Object [], int): byte [] 100% (1/1)100% (46/46)100% (8/8)

1package de.uka.ipd.sdq.sensorframework.storage.lists;
2 
3/**
4 * A serialiser to serialise doubles
5 * @author Steffen Becker
6 */
7public class DoubleSerialiser implements ISerialiser<Double> {
8 
9        public long getElementLength() {
10                return 8;
11        }
12        
13        public byte[] serialise(Object[] objects, int count){
14                byte[] block = new byte[(int)(count*getElementLength())];
15                int blockPos = 0;
16                for (int j = 0; j < count; j++){
17                        long l = Double.doubleToRawLongBits((Double)objects[j]);
18                        for (int i = 0; i < 8; i++) {
19                                block[blockPos++] = (byte)(l & 0xff);
20                                l = l >> 8;
21                        }
22                }
23                return block;
24        }
25 
26        public Double[] deserialise(byte[] bytes){
27                Double[] doubles = new Double[(int)(bytes.length / getElementLength())];
28                int blockPos = 0;
29                for (int j = 0; j<doubles.length; j++){
30                        long l = 0;
31                        for (int i = 7; i >=0; i--) {
32                                l = l << 8;
33                                l |= bytes[blockPos+i] < 0 ? 256 + bytes[blockPos+i] : bytes[blockPos+i];
34                        }
35                        blockPos += 8;
36                        doubles[j] = Double.longBitsToDouble(l);
37                }
38                return doubles;
39        }
40        
41}

[all classes][de.uka.ipd.sdq.sensorframework.storage.lists]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov