KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > asm > SourceLocation


1
2 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3  *
4  * This file is part of the IDE support for the AspectJ(tm)
5  * programming language; see http://aspectj.org
6  *
7  * The contents of this file are subject to the Mozilla Public License
8  * Version 1.1 (the "License"); you may not use this file except in
9  * compliance with the License. You may obtain a copy of the License at
10  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is AspectJ.
18  *
19  * The Initial Developer of the Original Code is Xerox Corporation. Portions
20  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
21  * All Rights Reserved.
22  *
23  * Contributor(s):
24  */

25
26 package org.aspectj.asm;
27
28 import java.io.*;
29
30 /**
31  * @author Mik Kersten
32  */

33 public class SourceLocation implements Serializable {
34     
35     private String JavaDoc sourceFilePath = null;
36     private String JavaDoc sourceFileName = null;
37     private int lineNumber = -1;
38     private int endLineNumber = -1;
39     private int columnNumber = 0;
40
41     /**
42      * @param sourceFilePath modified to '/' delimited path for cross-platform consistency
43      */

44     public SourceLocation(String JavaDoc sourceFilePath,
45                            int lineNumber,
46                            int columnNumber) {
47         this(sourceFilePath, lineNumber, lineNumber, columnNumber);
48     }
49     
50     /**
51      * @param sourceFilePath modified to '/' delimited path for cross-platform consistency
52      */

53     public SourceLocation(String JavaDoc sourceFilePath,
54                            int beginLineNumber,
55                            int endLineNumber,
56                            int beginColumnNumber) {
57         if (sourceFilePath != null) this.sourceFilePath = sourceFilePath.replace('\\', '/');
58         this.lineNumber = beginLineNumber;
59         this.endLineNumber = endLineNumber;
60         this.columnNumber = beginColumnNumber;
61         if (sourceFilePath != null) this.sourceFileName = new File(sourceFilePath).getName();
62     }
63
64     public int getColumnNumber() {
65         return columnNumber;
66     }
67
68     public int getLineNumber() {
69         return lineNumber;
70     }
71
72     public int getEndLineNumber() {
73         return endLineNumber;
74     }
75
76     public String JavaDoc getSourceFilePath() {
77         return sourceFilePath;
78     }
79     
80     public String JavaDoc getSourceFileName() {
81         return sourceFileName;
82     }
83     
84     public String JavaDoc toString() {
85         return sourceFilePath + ", begin line: " + lineNumber + ", end line:" + endLineNumber;
86     }
87 }
88
Popular Tags