KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > TIR > Impl > ExprDefaultImpl


1 /* $Id: ExprDefaultImpl.java,v 1.2 2004/05/20 14:23:52 bures Exp $ */
2 package SOFA.SOFAnode.Made.TIR.Impl;
3 import java.io.IOException JavaDoc;
4 import java.rmi.RemoteException JavaDoc;
5 import java.rmi.server.UnicastRemoteObject JavaDoc;
6
7 import SOFA.SOFAnode.Made.TIR.Container;
8 import SOFA.SOFAnode.Made.TIR.DefinitionKind;
9 import SOFA.SOFAnode.Made.TIR.ExprDefault;
10 import SOFA.SOFAnode.Made.TIR.ExprOperDef;
11 import SOFA.SOFAnode.Made.TIR.ExprOperKind;
12 import SOFA.SOFAnode.Made.TIR.Repository;
13 import SOFA.SOFAnode.Made.TIR.StateKind;
14 import SOFA.SOFAnode.Made.TIR.TIRExceptCalculate;
15 import SOFA.SOFAnode.Made.TIR.TIRExceptCommit;
16
17 public class ExprDefaultImpl extends UnicastRemoteObject JavaDoc implements ExprDefault, TIRImplObject {
18   ExprOperKindImpl eok;
19   DefinitionKindImpl defKindImpl;
20   StateKindImpl stKindImpl;
21
22   public ExprDefaultImpl(int state) throws RemoteException JavaDoc {
23     eok = new ExprOperKindImpl(ExprOperKind.eok_default);
24     defKindImpl = new DefinitionKindImpl(DefinitionKind.dk_Expression);
25     stKindImpl = new StateKindImpl(state);
26   }
27
28   /* from interface TIRObject */
29   public DefinitionKind get_def_kind() throws RemoteException JavaDoc {
30     return (DefinitionKind) defKindImpl;
31   }
32
33   /* from interface TIRObject */
34   public StateKind get_state() throws RemoteException JavaDoc {
35     return (StateKind) stKindImpl;
36   }
37
38   public ExprOperKind get_eok_kind() throws RemoteException JavaDoc {
39     return (ExprOperKind) eok;
40   }
41   
42   public ExprOperDef calculate() throws RemoteException JavaDoc, TIRExceptCalculate {
43     throw new TIRExceptCalculate("Can't calculate default.");
44   }
45
46   public void save(Storage st) throws RemoteException JavaDoc, TIRExceptStorage {
47     try {
48       st.curOutFile.writeInt(eok.value());
49     } catch (IOException JavaDoc e) {
50       throw new TIRExceptStorage("Can't write in directory "+st.current+".");
51     }
52   }
53   
54   public void load(Storage st) throws RemoteException JavaDoc, TIRExceptStorage {}
55
56   public void postLoad(RepositoryImpl r) throws RemoteException JavaDoc, TIRExceptStorage {}
57
58   public boolean isNew() {
59     return (stKindImpl.value()==StateKind.sk_work);
60   }
61
62   public void canCommit() throws RemoteException JavaDoc, TIRExceptCommit {}
63
64   public void doCommit(Container in, Repository rep) throws RemoteException JavaDoc {
65     if (stKindImpl.value()==StateKind.sk_work)
66       stKindImpl.toNormal();
67   }
68
69   public void doAbort(long workId) throws RemoteException JavaDoc {}
70 }
71
Popular Tags