|
|||||||||||||||||||
| This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Location.java | 100% | 86,7% | 83,3% | 87% |
|
||||||||||||||
| 1 |
/* |
|
| 2 |
* JBind |
|
| 3 |
* |
|
| 4 |
* Copyright (c) by Stefan Wachter. All rights reserved. |
|
| 5 |
* |
|
| 6 |
* Usage, modification, and redistribution is subject to license terms that are |
|
| 7 |
* available at 'http://www.jbind.org'. The JBind license is like the |
|
| 8 |
* 'Apache Software License V 1.1'. |
|
| 9 |
*/ |
|
| 10 |
package org.jbind.xml.base; |
|
| 11 |
|
|
| 12 |
import java.net.MalformedURLException; |
|
| 13 |
import java.net.URL; |
|
| 14 |
|
|
| 15 |
import org.jbind.base.UnexpectedException; |
|
| 16 |
import org.jbind.util.other.StrBuffer; |
|
| 17 |
|
|
| 18 |
public class Location extends ResourceIdentifier implements ILocation {
|
|
| 19 |
|
|
| 20 | 15373 |
private static URL toUrl(String aString) {
|
| 21 | 15373 |
URL res = null; |
| 22 | 15373 |
if (null != aString) {
|
| 23 | 15266 |
try {
|
| 24 | 15266 |
res = new URL(aString); |
| 25 |
} catch (MalformedURLException e) {
|
|
| 26 | 0 |
throw new UnexpectedException(e); |
| 27 |
} |
|
| 28 |
} |
|
| 29 | 15373 |
return res; |
| 30 |
} |
|
| 31 |
|
|
| 32 |
private int myLine; |
|
| 33 |
private int myColumn; |
|
| 34 |
|
|
| 35 | 15373 |
public Location(String aSystemId, String aPublicId, int aLine, int aColumn) {
|
| 36 | 15373 |
super(toUrl(aSystemId), aPublicId); |
| 37 | 15373 |
myLine = aLine; |
| 38 | 15373 |
myColumn = aColumn; |
| 39 |
} |
|
| 40 |
|
|
| 41 | 0 |
public int getColumnNumber() {
|
| 42 | 0 |
return myColumn; |
| 43 |
} |
|
| 44 |
|
|
| 45 | 64 |
public int getLineNumber() {
|
| 46 | 64 |
return myLine; |
| 47 |
} |
|
| 48 |
|
|
| 49 | 43 |
public ILocation getLocation() {
|
| 50 | 43 |
return this; |
| 51 |
} |
|
| 52 |
|
|
| 53 | 461 |
public String toString() {
|
| 54 | 461 |
StrBuffer sb = new StrBuffer(super.toString()); |
| 55 | 461 |
sb.append("[").append(myLine).append(":").append(myColumn).append("]");
|
| 56 | 461 |
return sb.toString(); |
| 57 |
} |
|
| 58 |
|
|
| 59 |
} |
|
| 60 |
|
|
||||||||||