Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../img/srcFileCovDistChart6.png 69% of files have more coverage
9   94   7   1,8
6   33   0,78   5
5     1,4  
1    
 
  SourceArea       Line # 30 9 7 60% 0.6
 
  (27)
 
1    /* $Id: SourceArea.java,v 1.4 2008/05/15 21:27:48 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, Michael Meyling <mime@qedeq.org>.
6    *
7    * "Hilbert II" is free software; you can redistribute
8    * it and/or modify it under the terms of the GNU General Public
9    * License as published by the Free Software Foundation; either
10    * version 2 of the License, or (at your option) any later version.
11    *
12    * This program is distributed in the hope that it will be useful,
13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15    * GNU General Public License for more details.
16    */
17   
18    package org.qedeq.kernel.common;
19   
20    import java.io.Serializable;
21    import java.net.URL;
22   
23   
24    /**
25    * Describes an area of an URL contents.
26    *
27    * @version $Revision: 1.4 $
28    * @author Michael Meyling
29    */
 
30    public final class SourceArea implements Serializable {
31   
32    /** Address of input, for identifying source. */
33    private final URL address;
34   
35    /** Start position. */
36    private final SourcePosition startPosition;
37   
38    /** End position. Might be <code>null</code>. */
39    private final SourcePosition endPosition;
40   
41    /**
42    * Constructs file position object.
43    *
44    * @param address For identifying source.
45    * @param startPosition Start position. Must not be <code>null</code>.
46    * @param endPosition Start position. Must not be <code>null</code>.
47    */
 
48  154 toggle public SourceArea(final URL address, final SourcePosition startPosition,
49    final SourcePosition endPosition) {
50  154 this.address = address;
51  154 if (startPosition == null || endPosition == null) {
52  0 throw new NullPointerException();
53    }
54  154 this.startPosition = startPosition;
55  154 this.endPosition = endPosition;
56    }
57   
58    /**
59    * Get address (or something to identify it) of input source.
60    *
61    * @return address of input source
62    */
 
63  176 toggle public final URL getAddress() {
64  176 return this.address;
65    }
66   
67    /**
68    * Get start position.
69    *
70    * @return Start position.
71    */
 
72  442 toggle public final SourcePosition getStartPosition() {
73  442 return startPosition;
74    }
75   
76    /**
77    * Get end position.
78    *
79    * @return End position.
80    */
 
81  38 toggle public final SourcePosition getEndPosition() {
82  38 return endPosition;
83    }
84   
85   
 
86  0 toggle public final String toString() {
87  0 return getAddress()
88  0 + (getStartPosition() != null ? ":" + getStartPosition().getLine() + ":"
89    + getStartPosition().getColumn() : "")
90  0 + (getEndPosition() != null ? ":" + getEndPosition().getLine() + ":"
91    + getEndPosition().getColumn() : "");
92    }
93   
94    }