KickJava   Java API By Example, From Geeks To Geeks.

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


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