home *** CD-ROM | disk | FTP | other *** search
- package sun.tools.java;
-
- public final class ClassDeclaration implements Constants {
- int status;
- Type type;
- ClassDefinition definition;
-
- public ClassDeclaration(Identifier var1) {
- this.type = Type.tClass(var1);
- }
-
- public int getStatus() {
- return this.status;
- }
-
- public Identifier getName() {
- return this.type.getClassName();
- }
-
- public Type getType() {
- return this.type;
- }
-
- public boolean isDefined() {
- switch (this.status) {
- case 2:
- case 4:
- case 5:
- case 7:
- return true;
- case 3:
- case 6:
- default:
- return false;
- }
- }
-
- public ClassDefinition getClassDefinition() {
- return this.definition;
- }
-
- public ClassDefinition getClassDefinition(Environment var1) throws ClassNotFound {
- while(true) {
- switch (this.status) {
- case 0:
- case 1:
- case 3:
- var1.loadDefinition(this);
- break;
- case 2:
- case 4:
- this.definition.basicCheck(var1);
- return this.definition;
- case 5:
- case 7:
- return this.definition;
- case 6:
- default:
- throw new ClassNotFound(this.getName());
- }
- }
- }
-
- public void setDefinition(ClassDefinition var1, int var2) {
- this.definition = var1;
- this.status = var2;
- if (var1 != null && !this.getName().equals(var1.getName())) {
- throw new CompilerError("invalid class defintion: " + this + ", " + var1);
- }
- }
-
- public boolean equals(Object var1) {
- return var1 != null && var1 instanceof ClassDeclaration ? this.type.equals(((ClassDeclaration)var1).type) : false;
- }
-
- public String toString() {
- String var1 = this.getName().toString();
- String var2 = "type ";
- String var3 = this.getName().isInner() ? "nested " : "";
- if (this.getClassDefinition() != null) {
- if (this.getClassDefinition().isInterface()) {
- var2 = "interface ";
- } else {
- var2 = "class ";
- }
-
- if (!this.getClassDefinition().isTopLevel()) {
- var3 = "inner ";
- if (this.getClassDefinition().isLocal()) {
- var3 = "local ";
- if (!this.getClassDefinition().isAnonymous()) {
- var1 = this.getClassDefinition().getLocalName() + " (" + var1 + ")";
- }
- }
- }
- }
-
- return var3 + var2 + var1;
- }
- }
-