KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* $Id: CompSequence.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 CompSequence extends CompObjectIm implements CompType {
10   public CompExprOper bound;
11   public CompType type;
12
13   public CompSequence(CompType t, CompExprOper e) {
14     super(ObjectsKind.o_Sequence);
15     type = t;
16     bound = e;
17   }
18
19   public CompSequence(CompType t) {
20     super(ObjectsKind.o_Sequence);
21     type = t;
22     bound = new CompExprInteger(0L);
23   }
24
25   public void checkConsist(EnumList props, CompRepository rep) throws CDLExceptCheck, CDLExceptLock, CDLExceptRemote {
26     if (!CompExprOper.testPropInExpr(props, bound.nameProp(rep)))
27       throw new CDLExceptCheck("Unknown property");
28     type.checkConsist(props,rep);
29   }
30
31   public CDLType toNormal(CDLRepository newRep) throws CDLExceptRemote, CDLExceptToNormal, CDLExceptLock {
32     try {
33       return newRep.create_sequence(bound.toNormal(newRep), type.toNormal(newRep));
34     } catch (RemoteException JavaDoc e) {
35       throw new CDLExceptRemote("Remote exception occured: "+e.getMessage());
36     } catch (TIRExceptCreate e) {
37       throw new CDLExceptToNormal("Can't get primitve type\n"+e.getMessage());
38     }
39   }
40 }
41
Popular Tags