EMMA Coverage Report (generated Fri Feb 14 08:28:31 UTC 2014)
[all classes][org.qedeq.base.io]

COVERAGE SUMMARY FOR SOURCE FILE [SourcePosition.java]

nameclass, %method, %block, %line, %
SourcePosition.java100% (1/1)100% (7/7)100% (65/65)100% (13/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SourcePosition100% (1/1)100% (7/7)100% (65/65)100% (13/13)
<static initializer> 100% (1/1)100% (7/7)100% (1/1)
SourcePosition (int, int): void 100% (1/1)100% (9/9)100% (4/4)
equals (Object): boolean 100% (1/1)100% (22/22)100% (4/4)
getColumn (): int 100% (1/1)100% (3/3)100% (1/1)
getRow (): int 100% (1/1)100% (3/3)100% (1/1)
hashCode (): int 100% (1/1)100% (8/8)100% (1/1)
toString (): String 100% (1/1)100% (13/13)100% (1/1)

1/* This file is part of the project "Hilbert II" - http://www.qedeq.org
2 *
3 * Copyright 2000-2014,  Michael Meyling <mime@qedeq.org>.
4 *
5 * "Hilbert II" is free software; you can redistribute
6 * it and/or modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15 
16package org.qedeq.base.io;
17 
18import java.io.Serializable;
19 
20/**
21 * Describes a file position within a text file.
22 *
23 * @author  Michael Meyling
24 */
25public final class SourcePosition implements Serializable {
26 
27    /** Begin of file. */
28    public static final SourcePosition BEGIN = new SourcePosition(1, 1);
29 
30    /** Line number, starting with 1. */
31    private int row;
32 
33    /** Column number, starting with 1. */
34    private int column;
35 
36    /**
37     * Constructs source position object.
38     *
39     * @param   row     Line number, starting with 1.
40     * @param   column  Column number, starting with 1.
41     */
42    public SourcePosition(final int row, final int column) {
43        this.row = row;
44        this.column = column;
45    }
46 
47    /**
48     * Get line number, starting with 1.
49     *
50     * @return  Line number.
51     */
52    public final int getRow() {
53        return row;
54    }
55 
56    /**
57     * Get column number, starting with 1.
58     *
59     * @return  column number
60     */
61    public final int getColumn() {
62        return column;
63    }
64 
65    public final int hashCode() {
66        return getRow() ^ (getColumn() * 13);
67    }
68 
69    public final boolean equals(final Object obj) {
70        if (!(obj instanceof SourcePosition)) {
71            return false;
72        }
73        final SourcePosition other = (SourcePosition) obj;
74        return (getRow() == other.getRow())
75            && (getColumn() == other.getColumn());
76    }
77 
78    public final String toString() {
79        return getRow() + ":" + getColumn();
80    }
81 
82}

[all classes][org.qedeq.base.io]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov