KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* $Id: CompExprInteger.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.ExprOperDef;
7 import SOFA.SOFAnode.Made.TIR.Repository;
8 import SOFA.SOFAnode.Made.TIR.TIRExceptCreate;
9
10 class CompExprInteger extends CompExprOper {
11   public long value;
12   public CompExprInteger(long val) {
13     super(CompExprKind.e_int);
14     value = val;
15   }
16
17   public int type() { return CompExprKind.e_int; }
18
19   public boolean isProp() { return false; }
20
21   public EnumList nameProp(CompRepository rep) throws CDLExceptRemote, CDLExceptLock {
22     EnumList l = new EnumList();
23     return l;
24   }
25
26   public ExprOperDef toNormal(CDLRepository rep) throws CDLExceptToNormal, CDLExceptRemote, CDLExceptLock {
27     try {
28       return ((Repository) rep.get_containing_repository()).create_exprlonglong(value);
29     } catch (RemoteException JavaDoc e) {
30       throw new CDLExceptRemote("Remote exception occured: "+e.getMessage());
31     } catch (TIRExceptCreate ecr) {
32       throw new CDLExceptToNormal("Can't create expression");
33     }
34   }
35
36   /*public int isPositive() {
37     if (value >= 0) return value;
38     else return -2;
39   }*/

40
41   public String JavaDoc toString() {
42     return Long.toString(value);
43   }
44       
45 }
46
Popular Tags