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

COVERAGE SUMMARY FOR SOURCE FILE [ScanCursor.java]

nameclass, %method, %block, %line, %
ScanCursor.java100% (1/1)0%   (0/5)0%   (0/107)0%   (0/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ScanCursor100% (1/1)0%   (0/5)0%   (0/107)0%   (0/26)
ScanCursor (Session, ScanIndex, boolean): void 0%   (0/1)0%   (0/21)0%   (0/8)
get (): Row 0%   (0/1)0%   (0/3)0%   (0/1)
getSearchRow (): SearchRow 0%   (0/1)0%   (0/3)0%   (0/1)
next (): boolean 0%   (0/1)0%   (0/78)0%   (0/15)
previous (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)

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 java.util.Iterator;
9import org.h2.engine.Session;
10import org.h2.message.DbException;
11import org.h2.result.Row;
12import org.h2.result.SearchRow;
13 
14/**
15 * The cursor implementation for the scan index.
16 */
17public class ScanCursor implements Cursor {
18    private final ScanIndex scan;
19    private Row row;
20    private final Session session;
21    private final boolean multiVersion;
22    private Iterator<Row> delta;
23 
24    ScanCursor(Session session, ScanIndex scan, boolean multiVersion) {
25        this.session = session;
26        this.scan = scan;
27        this.multiVersion = multiVersion;
28        if (multiVersion) {
29            delta = scan.getDelta();
30        }
31        row = null;
32    }
33 
34    @Override
35    public Row get() {
36        return row;
37    }
38 
39    @Override
40    public SearchRow getSearchRow() {
41        return row;
42    }
43 
44    @Override
45    public boolean next() {
46        if (multiVersion) {
47            while (true) {
48                if (delta != null) {
49                    if (!delta.hasNext()) {
50                        delta = null;
51                        row = null;
52                        continue;
53                    }
54                    row = delta.next();
55                    if (!row.isDeleted() || row.getSessionId() == session.getId()) {
56                        continue;
57                    }
58                } else {
59                    row = scan.getNextRow(row);
60                    if (row != null && row.getSessionId() != 0 &&
61                            row.getSessionId() != session.getId()) {
62                        continue;
63                    }
64                }
65                break;
66            }
67            return row != null;
68        }
69        row = scan.getNextRow(row);
70        return row != null;
71    }
72 
73    @Override
74    public boolean previous() {
75        throw DbException.throwInternalError();
76    }
77 
78}

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