KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > polyglot > ext > param > types > PClass_c


1 package polyglot.ext.param.types;
2
3 import polyglot.types.*;
4 import polyglot.types.Package;
5 import polyglot.util.*;
6
7 import polyglot.ext.jl.types.*;
8
9 import java.util.*;
10
11 /**
12  * A base implementation for parametric classes.
13  * This class is a wrapper around
14  * a ClassType that associates formal parameters with the class.
15  * formals can be any type object.
16  */

17 public abstract class PClass_c extends TypeObject_c implements PClass {
18     protected PClass_c() { }
19
20     public PClass_c(TypeSystem ts) {
21         this(ts, null);
22     }
23
24     public PClass_c(TypeSystem ts, Position pos) {
25     super(ts, pos);
26     }
27
28     /////////////////////////////////////////////////////////////////////////
29
// Implement PClass
30

31     public ClassType instantiate(Position pos, List actuals)
32         throws SemanticException
33     {
34     ParamTypeSystem pts = (ParamTypeSystem) typeSystem();
35         return pts.instantiate(pos, this, actuals);
36     }
37     
38     
39     /////////////////////////////////////////////////////////////////////////
40
// Implement TypeObject
41

42     public boolean isCanonical() {
43         if (!clazz().isCanonical()) {
44             return false;
45         }
46      
47         for (Iterator i = formals().iterator(); i.hasNext(); ) {
48             Param p = (Param) i.next();
49             if (!p.isCanonical()) {
50                 return false;
51             }
52         }
53         
54         return true;
55     }
56
57     
58     /////////////////////////////////////////////////////////////////////////
59
// Implement Named
60

61     public String JavaDoc name() {
62         return clazz().name();
63     }
64
65     public String JavaDoc fullName() {
66         return clazz().fullName();
67     }
68
69     
70     /////////////////////////////////////////////////////////////////////////
71
// Implement Importable
72

73     public Package JavaDoc package_() {
74         return clazz().package_();
75     }
76     
77 }
78
Popular Tags