Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
10   82   7   1.67
2   31   0.7   6
6     1.17  
1    
 
  SourcePosition       Line # 25 10 7 100% 1.0
 
  (54)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, 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   
16    package org.qedeq.base.io;
17   
18    import java.io.Serializable;
19   
20    /**
21    * Describes a file position within a text file.
22    *
23    * @author Michael Meyling
24    */
 
25    public 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  140149 toggle public SourcePosition(final int row, final int column) {
43  140149 this.row = row;
44  140149 this.column = column;
45    }
46   
47    /**
48    * Get line number, starting with 1.
49    *
50    * @return Line number.
51    */
 
52  54951 toggle public final int getRow() {
53  54951 return row;
54    }
55   
56    /**
57    * Get column number, starting with 1.
58    *
59    * @return column number
60    */
 
61  1743 toggle public final int getColumn() {
62  1743 return column;
63    }
64   
 
65  120 toggle public final int hashCode() {
66  120 return getRow() ^ (getColumn() * 13);
67    }
68   
 
69  26870 toggle public final boolean equals(final Object obj) {
70  26870 if (!(obj instanceof SourcePosition)) {
71  2 return false;
72    }
73  26868 final SourcePosition other = (SourcePosition) obj;
74  26868 return (getRow() == other.getRow())
75    && (getColumn() == other.getColumn());
76    }
77   
 
78  30 toggle public final String toString() {
79  30 return getRow() + ":" + getColumn();
80    }
81   
82    }