KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > polyglot > ext > jl > types > ConstructorInstance_c


1 package polyglot.ext.jl.types;
2
3 import polyglot.types.*;
4 import polyglot.util.*;
5 import java.util.*;
6
7 /**
8  * A <code>ConstructorInstance</code> contains type information for a
9  * constructor.
10  */

11 public class ConstructorInstance_c extends ProcedureInstance_c
12                                 implements ConstructorInstance
13 {
14     /** Used for deserializing types. */
15     protected ConstructorInstance_c() { }
16
17     public ConstructorInstance_c(TypeSystem ts, Position pos,
18                              ClassType container,
19                  Flags flags, List formalTypes, List excTypes) {
20         super(ts, pos, container, flags, formalTypes, excTypes);
21     }
22
23     public ConstructorInstance flags(Flags flags) {
24         if (!flags.equals(this.flags)) {
25             ConstructorInstance_c n = (ConstructorInstance_c) copy();
26             n.flags = flags;
27             return n;
28         }
29         return this;
30     }
31
32     public ConstructorInstance formalTypes(List l) {
33         if (!CollectionUtil.equals(this.formalTypes, l)) {
34             ConstructorInstance_c n = (ConstructorInstance_c) copy();
35             n.formalTypes = new ArrayList(l);
36             return n;
37         }
38         return this;
39     }
40
41     public ConstructorInstance throwTypes(List l) {
42         if (!CollectionUtil.equals(this.excTypes, l)) {
43             ConstructorInstance_c n = (ConstructorInstance_c) copy();
44             n.excTypes = new ArrayList(l);
45             return n;
46         }
47         return this;
48     }
49
50     public ConstructorInstance container(ClassType container) {
51         if (this.container != container) {
52             ConstructorInstance_c n = (ConstructorInstance_c) copy();
53             n.container = container;
54             return n;
55         }
56         return this;
57     }
58
59     public String JavaDoc toString() {
60     return designator() + " " + flags.translate() + signature();
61     }
62     
63     public String JavaDoc signature() {
64         return container + "(" + TypeSystem_c.listToString(formalTypes) + ")";
65     }
66
67     public String JavaDoc designator() {
68         return "constructor";
69     }
70
71     public boolean equalsImpl(TypeObject o) {
72         if (! (o instanceof ConstructorInstance) ) return false;
73         return super.equalsImpl(o);
74     }
75
76     public boolean isCanonical() {
77     return container.isCanonical()
78         && listIsCanonical(formalTypes)
79         && listIsCanonical(excTypes);
80     }
81 }
82
Popular Tags