KickJava   Java API By Example, From Geeks To Geeks.

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


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