TipoClasse.java

Go to the documentation of this file.
00001 package plp.orientadaObjetos1.util;
00002 
00003 import plp.orientadaObjetos1.memoria.AmbienteCompilacaoOO1;
00004 import plp.orientadaObjetos1.excecao.declaracao.ClasseNaoDeclaradaException;
00005 import plp.orientadaObjetos1.expressao.leftExpression.Id;
00006 
00010 public class TipoClasse implements Tipo {
00011 
00015     private Id tipoClasse;
00016 
00020     public static final Id NULL = new Id("NULL");
00021 
00025     public static final Tipo TIPO_NULL = new TipoClasse(NULL);
00026 
00033      public TipoClasse(Id tipoClasse) {
00034         this.tipoClasse = tipoClasse;
00035      }
00036 
00037 
00043     public Id getTipo() {
00044         return tipoClasse;
00045     }
00046 
00047 
00055     public boolean eValido(AmbienteCompilacaoOO1 ambiente)
00056          throws ClasseNaoDeclaradaException {
00057         boolean resposta = false;
00058         try{
00059              resposta =  (tipoClasse == NULL) || (ambiente.getDefClasse(tipoClasse) != null);
00060          }
00061          catch(ClasseNaoDeclaradaException c){
00062               resposta = false;
00063          }
00064          return resposta;
00065     }
00066 
00073     public boolean equals(Object obj) {
00074         return (obj instanceof TipoClasse) &&
00075                ((TipoClasse)obj).tipoClasse.equals(this.tipoClasse);
00076     }
00081     public String toString() {
00082         return tipoClasse.toString();
00083     }
00084 }

Generated on Tue Sep 12 21:52:09 2006 for PLP by  doxygen 1.4.7