KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > jimple > toolkits > pointer > representations > GeneralConstObject


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 Feng Qian
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 /**
21  * A general constant object represents one of following environment objects:
22  * ClassLoader, Process, Thread, ...
23  * Such environment constants are distinguished by name and managed by
24  * Environment.
25  *
26  * @author Feng Qian
27  */

28
29 package soot.jimple.toolkits.pointer.representations;
30
31 import soot.*;
32
33 public class GeneralConstObject extends ConstantObject {
34
35
36   /* what's the soot class */
37   private Type type;
38   private String JavaDoc name;
39   private int id;
40
41   public GeneralConstObject(Type t, String JavaDoc n){
42     this.type = t;
43     this.name = n;
44     this.id = G.v().GeneralConstObject_counter++;
45   }
46   
47   public Type getType() {
48     return type;
49   }
50   
51   public String JavaDoc toString() {
52     return name;
53   }
54
55   public int hashCode(){
56     return this.id;
57   }
58
59   public boolean equals(Object JavaDoc other){
60     return this == other;
61   }
62 }
63
Popular Tags