EMMA Coverage Report (generated Sun Mar 01 22:06:14 CET 2015)
[all classes][org.h2.index]

COVERAGE SUMMARY FOR SOURCE FILE [RangeCursor.java]

nameclass, %method, %block, %line, %
RangeCursor.java100% (1/1)50%  (3/6)87%  (75/86)76%  (13/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RangeCursor100% (1/1)50%  (3/6)87%  (75/86)76%  (13/17)
RangeCursor (long, long): void 0%   (0/1)0%   (0/6)0%   (0/2)
get (): Row 0%   (0/1)0%   (0/3)0%   (0/1)
previous (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
RangeCursor (long, long, long): void 100% (1/1)100% (15/15)100% (6/6)
getSearchRow (): SearchRow 100% (1/1)100% (3/3)100% (1/1)
next (): boolean 100% (1/1)100% (57/57)100% (6/6)

1/*
2 * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (http://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6package org.h2.index;
7 
8import org.h2.message.DbException;
9import org.h2.result.Row;
10import org.h2.result.SearchRow;
11import org.h2.value.Value;
12import org.h2.value.ValueLong;
13 
14/**
15 * The cursor implementation for the range index.
16 */
17class RangeCursor implements Cursor {
18 
19    private boolean beforeFirst;
20    private long current;
21    private Row currentRow;
22    private final long start, end, step;
23 
24    RangeCursor(long start, long end) {
25        this(start, end, 1);
26    }
27 
28    RangeCursor(long start, long end, long step) {
29        this.start = start;
30        this.end = end;
31        this.step = step;
32        beforeFirst = true;
33    }
34 
35    @Override
36    public Row get() {
37        return currentRow;
38    }
39 
40    @Override
41    public SearchRow getSearchRow() {
42        return currentRow;
43    }
44 
45    @Override
46    public boolean next() {
47        if (beforeFirst) {
48            beforeFirst = false;
49            current = start;
50        } else {
51            current += step;
52        }
53        currentRow = new Row(new Value[]{ValueLong.get(current)}, 1);
54        return step > 0 ? current <= end : current >= end;
55    }
56 
57    @Override
58    public boolean previous() {
59        throw DbException.throwInternalError();
60    }
61 
62}

[all classes][org.h2.index]
EMMA 2.0.5312 (C) Vladimir Roubtsov