KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > tagkit > SourceLnPosTag


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2004 Jennifer Lhotak
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 package soot.tagkit;
21
22 public class SourceLnPosTag implements Tag {
23
24     private int startLn;
25     private int endLn;
26     private int startPos;
27     private int endPos;
28     
29     public SourceLnPosTag(int sline, int eline, int spos, int epos){
30         startLn = sline;
31         endLn = eline;
32         startPos = spos;
33         endPos = epos;
34     }
35
36     public int startLn(){
37         return startLn;
38     }
39
40     public int endLn(){
41         return endLn;
42     }
43
44     public int startPos(){
45         return startPos;
46     }
47
48     public int endPos(){
49         return endPos;
50     }
51
52     public String JavaDoc getName(){
53         return "SourceLnPosTag";
54     }
55
56     public byte[] getValue() {
57         byte[] v = new byte[2];
58         v[0] = (byte)(startLn/256);
59         v[1] = (byte)(startLn%256);
60         return v;
61     }
62
63     public String JavaDoc toString(){
64         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
65         sb.append("Source Line Pos Tag: ");
66         sb.append("sline: ");
67         sb.append(startLn);
68         sb.append(" eline: ");
69         sb.append(endLn);
70         sb.append(" spos: ");
71         sb.append(startPos);
72         sb.append(" epos: ");
73         sb.append(endPos);
74         return sb.toString();
75     }
76 }
77
Popular Tags