EMMA Coverage Report (generated Mon Aug 23 17:21:34 CEST 2010)
[all classes][dmg.util]

COVERAGE SUMMARY FOR SOURCE FILE [TimebasedCounter.java]

nameclass, %method, %block, %line, %
TimebasedCounter.java100% (1/1)50%  (1/2)23%  (3/13)50%  (1/2)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TimebasedCounter100% (1/1)50%  (1/2)23%  (3/13)50%  (1/2)
next (): long 0%   (0/1)0%   (0/10)0%   (0/1)
TimebasedCounter (): void 100% (1/1)100% (3/3)100% (1/1)

1package dmg.util;
2 
3/**
4 * Utility class to generate a monotonically increasing sequence of
5 * values.
6 *
7 * Under the right conditions, this sequence has a high likelihood to
8 * also be monotonically increasing between restarts. This is the case
9 * when
10 *
11 * - Time goes forward.
12 *
13 * - The frequency at which values are generated between two restarts
14 *   A and B is lower than 1000 Hz.
15 *
16 * The main reason for using time as a component is to avoid having to
17 * maintain persistent state.
18 */
19public class TimebasedCounter
20{
21    private long _last;
22 
23    public synchronized long next()
24    {
25        return (_last = Math.max(_last + 1, System.currentTimeMillis()));
26    }
27}

[all classes][dmg.util]
EMMA 2.0.5312 (C) Vladimir Roubtsov