KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > CDL > CompArray


1 /* $Id: CompArray.java,v 1.2 2004/05/20 14:23:51 bures Exp $ */
2 package SOFA.SOFAnode.Made.CDL;
3 import java.rmi.RemoteException JavaDoc;
4
5 import SOFA.SOFAnode.Made.TIR.CDLRepository;
6 import SOFA.SOFAnode.Made.TIR.CDLType;
7 import SOFA.SOFAnode.Made.TIR.TIRExceptCreate;
8
9 class CompArray extends CompObjectIm implements CompType {
10   public CompExprOper length;
11   public CompType type;
12
13   public CompArray(CompType t, CompExprOper e) {
14     super(ObjectsKind.o_Array);
15     type = t;
16     length = e;
17   }
18
19   public void checkConsist(EnumList props, CompRepository rep) throws CDLExceptCheck, CDLExceptLock, CDLExceptRemote {
20     if (!CompExprOper.testPropInExpr(props, length.nameProp(rep)))
21       throw new CDLExceptCheck("Unknown property");
22     type.checkConsist(props,rep);
23   }
24
25   public CDLType toNormal(CDLRepository newRep) throws CDLExceptRemote, CDLExceptToNormal, CDLExceptLock {
26     try {
27       return newRep.create_array(length.toNormal(newRep), type.toNormal(newRep));
28     } catch (RemoteException JavaDoc e) {
29       throw new CDLExceptRemote("Remote exception occured: "+e.getMessage());
30     } catch (TIRExceptCreate e) {
31       throw new CDLExceptToNormal("Can't get primitve type\n"+e.getMessage());
32     }
33   }
34 }
35
Popular Tags