KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* $Id: CompExprProperty.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 CompExprProperty extends CompExprOper {
11   public String JavaDoc name;
12   
13   public CompExprProperty(String JavaDoc name) {
14     super(CompExprKind.e_property);
15     this.name = name;
16   }
17
18   public int type() { return CompExprKind.e_all; }
19   public boolean isProp() { return true; }
20
21   public EnumList nameProp(CompRepository rep) throws CDLExceptRemote, CDLExceptLock {
22     EnumList l = new EnumList();
23     l.addName(name);
24     return l;
25   }
26   
27   public int isPositive() {
28     return -1;
29   }
30
31   public ExprOperDef toNormal(CDLRepository rep) throws CDLExceptToNormal, CDLExceptRemote, CDLExceptLock {
32     try {
33       return ((Repository) rep.get_containing_repository()).create_exprproperty(name);
34     } catch (RemoteException JavaDoc e) {
35       throw new CDLExceptRemote("Remote exception occured: "+e.getMessage());
36     } catch (TIRExceptCreate ecr) {
37       throw new CDLExceptToNormal("Can't create expression");
38     }
39   }
40
41   public String JavaDoc toString() {
42     return "$"+name;
43   }
44 }
45
Popular Tags