KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > dava > internal > javaRep > DStaticFieldRef


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

20
21 package soot.dava.internal.javaRep;
22
23 import soot.*;
24 import soot.jimple.*;
25
26 public class DStaticFieldRef extends StaticFieldRef
27 {
28     private boolean supressDeclaringClass;
29
30     public void toString( UnitPrinter up ) {
31         if( !supressDeclaringClass ) {
32             up.type( fieldRef.declaringClass().getType() );
33             up.literal( "." );
34         }
35         up.fieldRef( fieldRef );
36     }
37
38     public DStaticFieldRef( SootFieldRef fieldRef, String JavaDoc myClassName)
39     {
40     super( fieldRef);
41     supressDeclaringClass = myClassName.equals( fieldRef.declaringClass().getName());
42     }
43
44     public DStaticFieldRef( SootFieldRef fieldRef, boolean supressDeclaringClass)
45     {
46     super( fieldRef);
47     this.supressDeclaringClass = supressDeclaringClass;
48     }
49
50     public Object JavaDoc clone()
51     {
52     return new DStaticFieldRef( fieldRef, supressDeclaringClass);
53     }
54 }
55
Popular Tags