Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

TipoClasseGeneric.java

Go to the documentation of this file.
00001 package plp.orientadaObjetos1.util;
00002 
00003 import plp.orientadaObjetos1.excecao.declaracao.ClasseNaoDeclaradaException;
00004 import plp.orientadaObjetos1.expressao.leftExpression.Id;
00005 import plp.orientadaObjetos1.memoria.AmbienteCompilacao;
00006 
00007 public class TipoClasseGeneric extends TipoClasse {
00008 
00012     private Tipo tipoGeneric;
00013 
00014     public TipoClasseGeneric(Id tipoClasse, Tipo tipoGeneric) {
00015         super(tipoClasse);
00016         this.tipoGeneric = tipoGeneric;
00017     }
00018 
00019     public boolean eValido(AmbienteCompilacao ambiente)
00020             throws ClasseNaoDeclaradaException {
00021         boolean resposta = false;
00022         Id idTipoClasse = super.getTipo();
00023         boolean respostaDefClasse = ambiente.getDefClasse( idTipoClasse) != null;
00024         
00025         Id idTipoGeneric = this.tipoGeneric.getTipo();
00026         try {
00027             resposta = respostaDefClasse && ambiente.getGeneric( idTipoGeneric) != null;            
00028         } catch (ClasseNaoDeclaradaException e) {
00029             resposta = respostaDefClasse && ambiente.getDefClasse( idTipoGeneric) != null;            
00030         }
00031         return resposta;
00032     }
00033 
00040     public boolean equals(Object obj) {
00041         boolean resposta = false;
00042         if (obj instanceof TipoClasseGeneric) {
00043 
00044             TipoClasseGeneric tcg = (TipoClasseGeneric) obj;
00045             resposta = tcg.getTipo().equals(this.getTipo())
00046                     && tcg.getTipoGeneric().equals(this.tipoGeneric);
00047         }
00048         return resposta;
00049     }
00050 
00051     public Tipo getTipoGeneric() {
00052         return this.tipoGeneric;
00053     }
00054 
00060     public String toString() {
00061         return this.getTipo() + "<" + this.tipoGeneric.toString() + ">";
00062     }
00063 
00064 }

Generated on Mon Aug 8 20:20:48 2005 for Linguagem OO1 - Generics by  doxygen 1.4.4