KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* $Id: ExprUnsigLongImpl.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.ExprOperDef;
10 import SOFA.SOFAnode.Made.TIR.ExprOperKind;
11 import SOFA.SOFAnode.Made.TIR.ExprUnsigLong;
12 import SOFA.SOFAnode.Made.TIR.Repository;
13 import SOFA.SOFAnode.Made.TIR.StateKind;
14 import SOFA.SOFAnode.Made.TIR.TIRExceptCommit;
15
16 public class ExprUnsigLongImpl extends UnicastRemoteObject JavaDoc implements ExprUnsigLong, TIRImplObject {
17   int v;
18   ExprOperKindImpl eok;
19   DefinitionKindImpl defKindImpl;
20   StateKindImpl stKindImpl;
21
22   public ExprUnsigLongImpl(int value) throws RemoteException JavaDoc {
23     v = value;
24     eok = new ExprOperKindImpl(ExprOperKind.eok_unsiglong);
25     defKindImpl = new DefinitionKindImpl(DefinitionKind.dk_Expression);
26     stKindImpl = new StateKindImpl(StateKind.sk_work);
27   }
28
29   public ExprUnsigLongImpl() throws RemoteException JavaDoc {
30     v = 0;
31     eok = new ExprOperKindImpl(ExprOperKind.eok_unsiglong);
32     defKindImpl = new DefinitionKindImpl(DefinitionKind.dk_Expression);
33     stKindImpl = new StateKindImpl(StateKind.sk_normal);
34   }
35
36   /* from interface TIRObject */
37   public DefinitionKind get_def_kind() throws RemoteException JavaDoc {
38     return (DefinitionKind) defKindImpl;
39   }
40
41   /* from interface TIRObject */
42   public StateKind get_state() throws RemoteException JavaDoc {
43     return (StateKind) stKindImpl;
44   }
45   
46   public int value() throws RemoteException JavaDoc {
47     return v;
48   }
49
50   public void value(int value) {
51     v = value;
52   }
53
54   public ExprOperKind get_eok_kind() throws RemoteException JavaDoc {
55     return (ExprOperKind) eok;
56   }
57   
58   public ExprOperDef calculate() throws RemoteException JavaDoc {
59     return this; /* !!! ? */
60   }
61
62   public void save(Storage st) throws RemoteException JavaDoc, TIRExceptStorage {
63     try {
64       st.curOutFile.writeInt(eok.value());
65       st.curOutFile.writeInt(v);
66     } catch (IOException JavaDoc e) {
67       throw new TIRExceptStorage("Can't write in directory "+st.current+".");
68     }
69   }
70   
71   public void load(Storage st) throws RemoteException JavaDoc, TIRExceptStorage {
72     try {
73       v = st.curInFile.readInt();
74     } catch (IOException JavaDoc e) {
75       throw new TIRExceptStorage("Can't read in directory "+st.current+".");
76     }
77   }
78
79   public void postLoad(RepositoryImpl r) throws RemoteException JavaDoc, TIRExceptStorage {
80     ;
81   }
82
83   public boolean isNew() {
84     return (stKindImpl.value()==StateKind.sk_work);
85   }
86
87   public void canCommit() throws RemoteException JavaDoc, TIRExceptCommit {;}
88
89   public void doCommit(Container in, Repository rep) throws RemoteException JavaDoc {
90     if (stKindImpl.value()==StateKind.sk_work)
91       stKindImpl.toNormal();
92   }
93
94   public void doAbort(long workId) throws RemoteException JavaDoc {}
95 }
96
Popular Tags