1 58 59 package org.oddjob.arooa; 60 61 import java.io.Serializable ; 62 63 import org.xml.sax.Locator ; 64 65 72 public class Location implements Serializable { 73 74 75 private String fileName; 76 77 private int lineNumber; 78 79 private int columnNumber; 80 81 82 public static final Location UNKNOWN_LOCATION = new Location(); 83 84 87 private Location() { 88 this(null, 0, 0); 89 } 90 91 99 public Location(String fileName) { 100 this(fileName, 0, 0); 101 } 102 103 111 public Location(Locator loc) { 112 this(loc.getSystemId(), loc.getLineNumber(), loc.getColumnNumber()); 113 } 114 115 127 public Location(String fileName, int lineNumber, int columnNumber) { 128 this.fileName = fileName; 129 this.lineNumber = lineNumber; 130 this.columnNumber = columnNumber; 131 } 132 133 136 public String getFileName() { 137 return fileName; 138 } 139 140 143 public int getLineNumber() { 144 return lineNumber; 145 } 146 147 157 public String toString() { 158 StringBuffer buf = new StringBuffer (); 159 160 if (fileName != null) { 161 buf.append(fileName); 162 163 if (lineNumber != 0) { 164 buf.append(":"); 165 buf.append(lineNumber); 166 } 167 168 buf.append(": "); 169 } 170 171 return buf.toString(); 172 } 173 174 } 175 | Popular Tags |