rgradisc@1027
|
1 |
/*
|
rgradisc@1027
|
2 |
* Created on Oct 20, 2003
|
rgradisc@1027
|
3 |
*/
|
rgradisc@1027
|
4 |
package isac.bridge;
|
rgradisc@1027
|
5 |
|
wneuper@1976
|
6 |
import isac.util.CalcChanged;
|
rgradisc@1088
|
7 |
import isac.util.Formalization;
|
wneuper@2106
|
8 |
import isac.util.formulae.Assumptions;
|
wneuper@2051
|
9 |
import isac.util.formulae.CalcFormula;
|
wneuper@2526
|
10 |
import isac.util.formulae.KEStoreID;
|
wneuper@2526
|
11 |
import isac.util.formulae.Match;
|
wneuper@1989
|
12 |
import isac.util.formulae.Position;
|
wneuper@2526
|
13 |
import isac.util.formulae.ProblemID;
|
rgradisc@1311
|
14 |
import isac.util.interfaces.ICalcElement;
|
rgradisc@1311
|
15 |
import isac.util.interfaces.ICalcIterator;
|
rgradisc@1311
|
16 |
import isac.util.tactics.Tactic;
|
rgradisc@1035
|
17 |
|
rgradisc@1035
|
18 |
import java.io.Serializable;
|
rgradisc@1035
|
19 |
import java.rmi.Naming;
|
rgradisc@1035
|
20 |
import java.rmi.RemoteException;
|
rgradisc@1191
|
21 |
import java.util.HashMap;
|
rgradisc@1191
|
22 |
import java.util.Map;
|
rgradisc@1198
|
23 |
import java.util.Vector;
|
rgradisc@1035
|
24 |
|
wneuper@1863
|
25 |
import org.apache.log4j.Logger;
|
wneuper@1863
|
26 |
|
rgradisc@1027
|
27 |
/**
|
wneuper@2065
|
28 |
* Class MathEngine: This class is called by the Dialog and communicates with
|
wneuper@2065
|
29 |
* the Bridge via RMI. It also delegates the methods of the CalcTree and the
|
wneuper@2065
|
30 |
* CalcIterator to the Bridge.
|
wneuper@2065
|
31 |
*
|
rgradisc@1027
|
32 |
* @author rgradisc
|
rgradisc@1027
|
33 |
*/
|
rgradisc@1035
|
34 |
public class MathEngine implements Serializable {
|
rgradisc@1027
|
35 |
|
mlang@2450
|
36 |
private static MathEngine singleton_;
|
rgradisc@1036
|
37 |
|
mlang@2450
|
38 |
private IBridgeRMI bridge_rmi_;
|
rgradisc@1635
|
39 |
|
mlang@2450
|
40 |
// Stores the calc_trees_ after call of startSpecifying //WN00827
|
mlang@2450
|
41 |
// startCalculation
|
mlang@2450
|
42 |
// and hands them out to the dialog after startSolving//WN00827 ???
|
mlang@2450
|
43 |
private Map calc_trees_;
|
rgradisc@1191
|
44 |
|
mlang@2544
|
45 |
static Logger logger_ = Logger.getLogger(MathEngine.class.getName());
|
wneuper@1863
|
46 |
|
mlang@2450
|
47 |
// This is a Singleton Class: A private constructor is needed
|
mlang@2450
|
48 |
private MathEngine(String hostName) {
|
mlang@2544
|
49 |
logger_.debug("MathEngine(" + hostName + ")");
|
mlang@2450
|
50 |
try {
|
mlang@2450
|
51 |
//connect to bridge
|
mlang@2450
|
52 |
bridge_rmi_ = (IBridgeRMI) Naming.lookup("//" + hostName
|
mlang@2450
|
53 |
+ "/BridgeRMI");
|
mlang@2450
|
54 |
System.out.println("MathEngine Constr: connected to Bridge: "
|
mlang@2450
|
55 |
+ bridge_rmi_.toString());
|
mlang@2450
|
56 |
if (bridge_rmi_ == null)
|
wneuper@2526
|
57 |
System.out
|
wneuper@2526
|
58 |
.println("Error occured: The Bridge could not be found!");
|
mlang@2450
|
59 |
} catch (Exception e) {
|
mlang@2450
|
60 |
System.out
|
mlang@2450
|
61 |
.println("Could not connect to Bridge via RMI\n"
|
mlang@2450
|
62 |
+ "Please make sure that the Bridge is running and connected");
|
mlang@2450
|
63 |
e.printStackTrace();
|
mlang@2450
|
64 |
}
|
mlang@2450
|
65 |
calc_trees_ = new HashMap();
|
mlang@2450
|
66 |
}
|
rgradisc@1035
|
67 |
|
mlang@2450
|
68 |
/*
|
mlang@2450
|
69 |
* FIXME.WN040924 just to make the old bridge continue work
|
mlang@2450
|
70 |
*/
|
mlang@2450
|
71 |
protected IBridgeRMI getBridgeRMI() {
|
mlang@2450
|
72 |
return bridge_rmi_;
|
mlang@2450
|
73 |
}
|
rgradisc@1048
|
74 |
|
mlang@2450
|
75 |
/**
|
mlang@2450
|
76 |
* Initialize the MathEngine
|
mlang@2450
|
77 |
*
|
mlang@2450
|
78 |
* @param hostName:
|
mlang@2450
|
79 |
* Host name on which the Bridge is running
|
mlang@2450
|
80 |
*/
|
mlang@2450
|
81 |
public static void init(String hostName) {
|
mlang@2544
|
82 |
logger_.fatal(" DG->BR: init(" + hostName + ")");
|
mlang@2450
|
83 |
if (singleton_ == null) {
|
mlang@2450
|
84 |
singleton_ = new MathEngine(hostName);
|
mlang@2450
|
85 |
}
|
mlang@2450
|
86 |
}
|
rgradisc@1036
|
87 |
|
mlang@2450
|
88 |
public static MathEngine getMathEngine() {
|
mlang@2544
|
89 |
logger_.fatal(" DG<>BR: getMathEngine()");
|
mlang@2450
|
90 |
return singleton_;
|
mlang@2450
|
91 |
}
|
rgradisc@1586
|
92 |
|
mlang@2450
|
93 |
/**
|
mlang@2450
|
94 |
* Start a new calculation
|
mlang@2450
|
95 |
*
|
mlang@2450
|
96 |
* @param f
|
mlang@2450
|
97 |
* Formalization of the new calculation, from expl
|
mlang@2450
|
98 |
* @return CalcHead: empty for startSpecifying
|
mlang@2450
|
99 |
* @throws RemoteException
|
mlang@2450
|
100 |
* WN040924 ???
|
mlang@2450
|
101 |
*
|
mlang@2450
|
102 |
* int id = calc_head_.getCalcTreeID();//WN040922 TODO simplify CalcHead
|
mlang@2450
|
103 |
* CalcTree calcTree = (CalcTree) calc_trees_.get(new
|
mlang@2450
|
104 |
* Integer(id));//WN040922 TODO simplify
|
mlang@2450
|
105 |
*/
|
mlang@2450
|
106 |
public CalcTree startCalculation(Formalization f) {
|
mlang@2544
|
107 |
logger_.fatal(" DG->BR: startCalculation(" + f.toSMLString() + ")");
|
mlang@2450
|
108 |
CalcTree calcTree = null;//WN
|
mlang@2450
|
109 |
try {
|
mlang@2450
|
110 |
int id = bridge_rmi_.startCalculation(f);
|
mlang@2450
|
111 |
calcTree = new CalcTree(this, id);
|
mlang@2450
|
112 |
calc_trees_.put(new Integer(id), calcTree);
|
rgradisc@1166
|
113 |
|
mlang@2450
|
114 |
ICalcIterator hotSpot = calcTree.iterator();
|
mlang@2450
|
115 |
calcTree.setHotSpot(hotSpot); //first iterator marks the hotSpot
|
mlang@2450
|
116 |
//hotSpot.moveRoot();
|
mlang@2450
|
117 |
int i = 111;
|
mlang@2450
|
118 |
} catch (RemoteException e) {
|
mlang@2450
|
119 |
e.printStackTrace();
|
mlang@2450
|
120 |
}
|
mlang@2544
|
121 |
logger_.fatal(" DG<-BR: startCalculation <- calcTree=" + calcTree);
|
mlang@2450
|
122 |
return calcTree;
|
mlang@2450
|
123 |
}
|
rgradisc@1623
|
124 |
|
mlang@2450
|
125 |
/*
|
mlang@2450
|
126 |
* boolean autoCalculate(int id, int scope, int nSteps) throws
|
mlang@2450
|
127 |
* RemoteException { logger.debug("autoCalculate: id="+id+",
|
mlang@2450
|
128 |
* scope="+scope+", nSteps="+nSteps); return bridge_rmi_.autoCalculate(id,
|
mlang@2450
|
129 |
* scope, nSteps); }
|
mlang@2450
|
130 |
*/
|
rgradisc@1635
|
131 |
|
mlang@2450
|
132 |
/**
|
mlang@2450
|
133 |
* @see IToCalc#startSolving(), copied to CalcTree
|
mlang@2450
|
134 |
*
|
mlang@2450
|
135 |
* public void startSolving(CalcHead calc_head_) throws Exception {
|
mlang@2450
|
136 |
* logger.debug("startSolving: calc_head_="+calc_head_); int id =
|
mlang@2450
|
137 |
* calc_head_.getCalcTreeID();//WN040922 TODO simplify CalcHead CalcTree
|
mlang@2450
|
138 |
* calcTree = (CalcTree) calc_trees_.get(new Integer(id));//WN040922 TODO
|
mlang@2450
|
139 |
* simplify
|
mlang@2450
|
140 |
*
|
wneuper@2526
|
141 |
* if (calc_head_.getCalcHeadStatus() != CalcHead.MODEL_ITEM_CORRECT) {
|
wneuper@2526
|
142 |
* throw new Exception("Startsolving with incorrect CalcHead"); } Tactic t =
|
mlang@2450
|
143 |
* calcTree.fetchProposedTactic(); if (t.getName().compareTo("Apply_Method") !=
|
mlang@2450
|
144 |
* 0) { throw new Exception("Startsolving fetches " + t.getName()); } //Next
|
mlang@2450
|
145 |
* Tactic must always be Apply_Method calcTree.setNextTactic(t); //return
|
mlang@2450
|
146 |
* calcTree; }
|
mlang@2450
|
147 |
*/
|
rgradisc@1191
|
148 |
|
mlang@2450
|
149 |
/**
|
mlang@2450
|
150 |
* @see IToCalc public void modifyCalcHead(CalcHead calc_head_) {
|
mlang@2450
|
151 |
* logger.debug("modifyCalcHead: calc_head_="+calc_head_); CalcHead
|
mlang@2450
|
152 |
* newCalcHead = null; try { newCalcHead =
|
mlang@2450
|
153 |
* bridge_rmi_.modifyCalcHead(calc_head_);
|
mlang@2450
|
154 |
* calc_head_.fillValuesfrom(newCalcHead); } catch (RemoteException e) {
|
mlang@2450
|
155 |
* e.printStackTrace(); } }
|
mlang@2450
|
156 |
*/
|
rgradisc@1191
|
157 |
|
mlang@2450
|
158 |
/*
|
mlang@2450
|
159 |
* @see IToCalc public void completeCalcHead(CalcHead calc_head_) {
|
mlang@2450
|
160 |
* logger.debug("completeCalcHead: calc_head_="+calc_head_); CalcHead
|
mlang@2450
|
161 |
* newCalcHead = null; try { //WN040924 newCalcHead =
|
mlang@2450
|
162 |
* bridge_rmi_.completeCalcHead(calc_head_);
|
mlang@2450
|
163 |
* bridge_rmi_.completeCalcHead(calc_head_); //WN040924
|
mlang@2450
|
164 |
* calc_head_.fillValuesfrom(newCalcHead); } catch (RemoteException e) {
|
mlang@2450
|
165 |
* e.printStackTrace(); } }
|
mlang@2450
|
166 |
*/
|
rgradisc@1035
|
167 |
|
mlang@2450
|
168 |
/*
|
mlang@2450
|
169 |
* @see IToCalc public void completeCalcHead(CalcHead calc_head_, int
|
mlang@2450
|
170 |
* completeItem) { CalcHead newCalcHead; try { //WN040924 newCalcHead =
|
mlang@2450
|
171 |
* bridge_rmi_.completeCalcHead(calc_head_, completeItem);
|
mlang@2450
|
172 |
* bridge_rmi_.completeCalcHead(calc_head_, completeItem); //WN040924
|
mlang@2450
|
173 |
* calc_head_.fillValuesfrom(newCalcHead); //TODO: Remove the following
|
mlang@2450
|
174 |
* line!! calc_head_.setCalcHeadStatus(CalcHead.MODEL_ITEM_CORRECT); }
|
mlang@2450
|
175 |
* catch (RemoteException e) { e.printStackTrace(); } }
|
mlang@2450
|
176 |
*/
|
rgradisc@1035
|
177 |
|
mlang@2450
|
178 |
// /**
|
mlang@2450
|
179 |
// * Refine a given problem for this CalcTree
|
mlang@2450
|
180 |
// *
|
mlang@2450
|
181 |
// * @param problemID
|
mlang@2450
|
182 |
// * @return CalcHead, if the operation was successful, else null
|
mlang@2450
|
183 |
// */
|
wneuper@2526
|
184 |
// public void try_refine_(CalcHead calc_head_, CalcHeadCompoundID
|
wneuper@2526
|
185 |
// problemID)
|
mlang@2450
|
186 |
// throws NotInSpecificationPhaseException {
|
mlang@2450
|
187 |
// CalcHead newCalcHead = null;
|
mlang@2450
|
188 |
// try {
|
mlang@2450
|
189 |
// //WN040924 newCalcHead =
|
mlang@2450
|
190 |
// // bridge_rmi_.try_refine_(calc_head_.getCalcTreeID(), problemID);
|
mlang@2450
|
191 |
// bridge_rmi_.try_refine_(calc_head_.getCalcTreeID(), problemID);
|
mlang@2450
|
192 |
// if (newCalcHead == null) {
|
mlang@2450
|
193 |
// throw new NotInSpecificationPhaseException();
|
mlang@2450
|
194 |
// }
|
mlang@2450
|
195 |
// calc_head_.fillValuesfrom(newCalcHead);
|
mlang@2450
|
196 |
// } catch (RemoteException e) {
|
mlang@2450
|
197 |
//
|
mlang@2450
|
198 |
// e.printStackTrace();
|
mlang@2450
|
199 |
// }
|
mlang@2450
|
200 |
// }
|
mlang@2450
|
201 |
//WN050610 transferred toCalcTree
|
mlang@2450
|
202 |
// /**
|
mlang@2450
|
203 |
// * Match a given problem for this CalcTree
|
mlang@2450
|
204 |
// *
|
mlang@2450
|
205 |
// * @param problemID
|
mlang@2450
|
206 |
// * @return CalcHead, if the operation was successful, else null
|
mlang@2450
|
207 |
// */
|
mlang@2450
|
208 |
// public void try_match_(CalcHead calc_head_, CalcHeadCompoundID problemID)
|
mlang@2450
|
209 |
// throws NotInSpecificationPhaseException {
|
mlang@2450
|
210 |
// CalcHead newCalcHead = null;
|
mlang@2450
|
211 |
// try {
|
mlang@2450
|
212 |
// //WN040924 newCalcHead =
|
mlang@2450
|
213 |
// // bridge_rmi_.try_match_(calc_head_.getCalcTreeID(), problemID);
|
mlang@2450
|
214 |
// bridge_rmi_.try_match_(calc_head_.getCalcTreeID(), problemID);
|
mlang@2450
|
215 |
// if (newCalcHead == null) {
|
mlang@2450
|
216 |
// throw new NotInSpecificationPhaseException();
|
mlang@2450
|
217 |
// }
|
mlang@2450
|
218 |
// calc_head_.fillValuesfrom(newCalcHead);
|
mlang@2450
|
219 |
// } catch (RemoteException e) {
|
mlang@2450
|
220 |
//
|
mlang@2450
|
221 |
// e.printStackTrace();
|
mlang@2450
|
222 |
// }
|
mlang@2450
|
223 |
// }
|
mlang@2450
|
224 |
// Delegated methods from CalcTree/Iterator
|
mlang@2450
|
225 |
int setNextTactic(int id, Tactic tactic) throws RemoteException {
|
mlang@2450
|
226 |
return bridge_rmi_.setNextTactic(id, tactic);
|
mlang@2450
|
227 |
}
|
rgradisc@1035
|
228 |
|
mlang@2450
|
229 |
Tactic fetchProposedTactic(int id) throws RemoteException {
|
mlang@2450
|
230 |
return bridge_rmi_.fetchProposedTactic(id);
|
mlang@2450
|
231 |
}
|
rgradisc@1035
|
232 |
|
mlang@2450
|
233 |
CalcChanged autoCalculate(int id, int scope, int nSteps)
|
mlang@2450
|
234 |
throws RemoteException {
|
mlang@2544
|
235 |
logger_.debug("autoCalculate: id=" + id + ", scope=" + scope
|
mlang@2450
|
236 |
+ ", nSteps=" + nSteps);
|
mlang@2450
|
237 |
return bridge_rmi_.autoCalculate(id, scope, nSteps);
|
mlang@2450
|
238 |
}
|
rgradisc@1035
|
239 |
|
mlang@2450
|
240 |
CalcChanged replaceFormula(int id, CalcFormula f) throws RemoteException {
|
mlang@2450
|
241 |
return bridge_rmi_.replaceFormula(id, f);
|
mlang@2450
|
242 |
}
|
wneuper@1997
|
243 |
|
mlang@2450
|
244 |
CalcChanged appendFormula(int id, CalcFormula f) throws RemoteException {
|
mlang@2450
|
245 |
return bridge_rmi_.appendFormula(id, f);
|
mlang@2450
|
246 |
}
|
wneuper@2002
|
247 |
|
mlang@2450
|
248 |
CalcChanged intermediateSteps(int id, ICalcIterator ci)
|
mlang@2450
|
249 |
throws RemoteException {
|
mlang@2450
|
250 |
return bridge_rmi_.intermediateSteps(id, ci);
|
mlang@2450
|
251 |
}
|
rgradisc@1035
|
252 |
|
mlang@2450
|
253 |
Vector getElementsFromTo(int id, ICalcIterator iterator_from,
|
mlang@2450
|
254 |
ICalcIterator iterator_to, Integer level,
|
mlang@2450
|
255 |
boolean result_includes_tactics) throws RemoteException {
|
mlang@2450
|
256 |
return bridge_rmi_.getElementsFromTo(id, iterator_from, iterator_to,
|
mlang@2450
|
257 |
level, result_includes_tactics);
|
mlang@2450
|
258 |
}
|
rgradisc@1035
|
259 |
|
mlang@2450
|
260 |
Position moveActiveFormula(int calcTreeID, Position p)
|
mlang@2450
|
261 |
throws RemoteException {
|
mlang@2450
|
262 |
return bridge_rmi_.moveActiveFormula(calcTreeID, p);
|
mlang@2450
|
263 |
}
|
wneuper@2082
|
264 |
|
mlang@2450
|
265 |
int iterator(int id) throws RemoteException {
|
mlang@2544
|
266 |
logger_.debug("iterator: id=" + id);
|
mlang@2450
|
267 |
return bridge_rmi_.iterator(id);
|
mlang@2450
|
268 |
}
|
rgradisc@1035
|
269 |
|
mlang@2450
|
270 |
Position moveRoot(int calcTreeID, int iteratorID) throws RemoteException {
|
mlang@2544
|
271 |
logger_.debug("moveRoot: calcTreeID=" + calcTreeID + ", iteratorID="
|
mlang@2450
|
272 |
+ iteratorID);
|
mlang@2450
|
273 |
return bridge_rmi_.moveRoot(calcTreeID, iteratorID);
|
mlang@2450
|
274 |
}
|
rgradisc@1035
|
275 |
|
mlang@2450
|
276 |
Position moveUp(int calcTreeID, int iteratorID, Position p)
|
mlang@2450
|
277 |
throws RemoteException {
|
mlang@2450
|
278 |
return bridge_rmi_.moveUp(calcTreeID, iteratorID, p);
|
mlang@2450
|
279 |
}
|
rgradisc@1035
|
280 |
|
mlang@2450
|
281 |
Position moveDown(int calcTreeID, int iteratorID, Position p)
|
mlang@2450
|
282 |
throws RemoteException {
|
mlang@2544
|
283 |
logger_.debug("moveDown: calcTreeID=" + calcTreeID + ", sml_pos_=" + p);
|
mlang@2450
|
284 |
return bridge_rmi_.moveDown(calcTreeID, iteratorID, p);
|
mlang@2450
|
285 |
}
|
rgradisc@1035
|
286 |
|
mlang@2450
|
287 |
Position moveLevelUp(int calcTreeID, int iteratorID, Position p)
|
mlang@2450
|
288 |
throws RemoteException {
|
mlang@2450
|
289 |
return bridge_rmi_.moveLevelUp(calcTreeID, iteratorID, p);
|
mlang@2450
|
290 |
}
|
wneuper@1989
|
291 |
|
mlang@2450
|
292 |
Position moveLevelDown(int calcTreeID, int iteratorID, Position p)
|
mlang@2450
|
293 |
throws RemoteException {
|
mlang@2450
|
294 |
return bridge_rmi_.moveLevelDown(calcTreeID, iteratorID, p);
|
mlang@2450
|
295 |
}
|
rgradisc@1035
|
296 |
|
mlang@2450
|
297 |
Position moveCalcHead(int calcTreeID, int iteratorID, Position p)
|
mlang@2450
|
298 |
throws RemoteException {
|
mlang@2450
|
299 |
return bridge_rmi_.moveCalcHead(calcTreeID, iteratorID, p);
|
mlang@2450
|
300 |
}
|
rgradisc@1035
|
301 |
|
mlang@2450
|
302 |
boolean moveTactic(int calcTreeID, int iteratorID) throws RemoteException {
|
mlang@2450
|
303 |
return bridge_rmi_.moveTactic(calcTreeID, iteratorID);
|
mlang@2450
|
304 |
}
|
rgradisc@1304
|
305 |
|
mlang@2450
|
306 |
boolean moveFormula(int calcTreeID, int iteratorID) throws RemoteException {
|
mlang@2450
|
307 |
return bridge_rmi_.moveFormula(calcTreeID, iteratorID);
|
mlang@2450
|
308 |
}
|
rgradisc@1304
|
309 |
|
mlang@2450
|
310 |
ICalcElement getElement(int calcTreeID, Position p) throws RemoteException {
|
mlang@2450
|
311 |
return bridge_rmi_.getElement(calcTreeID, p);
|
mlang@2450
|
312 |
}
|
rgradisc@1198
|
313 |
|
mlang@2450
|
314 |
/**
|
mlang@2450
|
315 |
* Destruct a calcTree: Gives the memory occupied by this calcTree free
|
mlang@2450
|
316 |
* again. Call this method when the calcTree is no longer needed. This
|
mlang@2450
|
317 |
* method is irreversible.
|
mlang@2450
|
318 |
*
|
mlang@2450
|
319 |
* @param calcTreeID
|
mlang@2450
|
320 |
* id of the calcTree to be destructed
|
mlang@2450
|
321 |
*/
|
mlang@2450
|
322 |
public boolean destruct(int calcTreeID) throws RemoteException {
|
mlang@2450
|
323 |
return bridge_rmi_.destruct(calcTreeID);
|
mlang@2450
|
324 |
}
|
wneuper@2065
|
325 |
|
mlang@2450
|
326 |
/**
|
mlang@2450
|
327 |
* Save a calcTree
|
mlang@2450
|
328 |
*
|
mlang@2450
|
329 |
* @param calcTreeID
|
mlang@2450
|
330 |
* id of the calcTree to be saved
|
mlang@2450
|
331 |
* @return a vector containing strings, representing the status of the
|
mlang@2450
|
332 |
* calcTree
|
mlang@2450
|
333 |
*/
|
mlang@2450
|
334 |
public Vector saveCalcTree(int calcTreeID) {
|
mlang@2450
|
335 |
try {
|
mlang@2450
|
336 |
return bridge_rmi_.saveCalcTree(calcTreeID);
|
mlang@2450
|
337 |
} catch (RemoteException e) {
|
mlang@2450
|
338 |
e.printStackTrace();
|
mlang@2450
|
339 |
}
|
mlang@2450
|
340 |
return null;
|
mlang@2450
|
341 |
}
|
wneuper@2065
|
342 |
|
mlang@2450
|
343 |
/**
|
mlang@2450
|
344 |
* Load a previously stored calcTree
|
mlang@2450
|
345 |
*
|
mlang@2450
|
346 |
* @param v
|
mlang@2450
|
347 |
* Vector: the return value of saveCalcTree
|
mlang@2450
|
348 |
* @return a calcTree reference
|
mlang@2450
|
349 |
*/
|
mlang@2450
|
350 |
public CalcTree loadCalcTree(Vector v) {
|
mlang@2450
|
351 |
try {
|
mlang@2450
|
352 |
int id = bridge_rmi_.loadCalcTree(v);
|
mlang@2450
|
353 |
CalcTree calcTree = new CalcTree(this, id);
|
mlang@2450
|
354 |
calc_trees_.put(new Integer(id), calcTree);
|
mlang@2450
|
355 |
ICalcIterator hotSpot = calcTree.iterator();
|
mlang@2450
|
356 |
// may be not first iterator (not hotspot)
|
mlang@2450
|
357 |
((CalcIterator) hotSpot).makeHotSpot();
|
mlang@2450
|
358 |
// make sure it is a hotspot iterator
|
mlang@2450
|
359 |
calcTree.setHotSpot(hotSpot);
|
mlang@2450
|
360 |
hotSpot.moveRoot();
|
mlang@2450
|
361 |
return calcTree;
|
mlang@2450
|
362 |
} catch (RemoteException e) {
|
mlang@2450
|
363 |
e.printStackTrace();
|
mlang@2450
|
364 |
}
|
mlang@2450
|
365 |
return null;
|
mlang@2450
|
366 |
}
|
wneuper@2065
|
367 |
|
mlang@2450
|
368 |
/**
|
mlang@2450
|
369 |
* @see isac.util.interfaces.ICalcIterator#getTactic()
|
mlang@2450
|
370 |
*/
|
mlang@2450
|
371 |
public Tactic getTactic(int id, Position pos) throws RemoteException {
|
mlang@2450
|
372 |
return bridge_rmi_.getTactic(id, pos);
|
mlang@2450
|
373 |
}
|
wneuper@2065
|
374 |
|
mlang@2450
|
375 |
public Vector getApplicableTactics(int calcTreeID, int scope, Position pos)
|
mlang@2450
|
376 |
throws RemoteException {
|
mlang@2450
|
377 |
return bridge_rmi_.getAppliableTactics(calcTreeID, scope, pos);
|
mlang@2450
|
378 |
}
|
wneuper@2106
|
379 |
|
mlang@2450
|
380 |
/**
|
mlang@2450
|
381 |
* @see isac.util.interfaces.ICalcIterator#getAssumptions()
|
mlang@2450
|
382 |
*/
|
mlang@2450
|
383 |
public Assumptions getAssumptions(int id, Position pos)
|
mlang@2450
|
384 |
throws RemoteException {
|
mlang@2450
|
385 |
return bridge_rmi_.getAssumptions(id, pos);
|
mlang@2450
|
386 |
}
|
wneuper@2106
|
387 |
|
mlang@2450
|
388 |
/**
|
mlang@2450
|
389 |
* @see isac.util.interfaces.ICalcIterator#getAssumptions()
|
mlang@2450
|
390 |
*/
|
mlang@2450
|
391 |
public Assumptions getAccumulatedAssumptions(int id, Position pos)
|
mlang@2450
|
392 |
throws RemoteException {
|
mlang@2450
|
393 |
return bridge_rmi_.getAccumulatedAssumptions(id, pos);
|
mlang@2450
|
394 |
}
|
wneuper@2106
|
395 |
|
wneuper@2526
|
396 |
/**
|
wneuper@2526
|
397 |
* @see isac.util.interfaces.ICalcIterator#tryMatchProblem
|
wneuper@2526
|
398 |
*/
|
wneuper@2526
|
399 |
public Match tryMatchProblem(int calcTreeID, ProblemID pblID)
|
wneuper@2526
|
400 |
throws RemoteException {
|
wneuper@2526
|
401 |
return bridge_rmi_.tryMatchProblem(calcTreeID, pblID);
|
wneuper@2526
|
402 |
}
|
wneuper@2526
|
403 |
|
wneuper@2526
|
404 |
/**
|
wneuper@2526
|
405 |
* @see isac.util.interfaces.ICalcIterator#tryRefineProblem
|
wneuper@2526
|
406 |
*/
|
wneuper@2526
|
407 |
public Match tryRefineProblem(int calcTreeID, ProblemID pblID)
|
wneuper@2526
|
408 |
throws RemoteException {
|
wneuper@2526
|
409 |
return bridge_rmi_.tryRefineProblem(calcTreeID, pblID);
|
wneuper@2526
|
410 |
}
|
wneuper@2526
|
411 |
|
wneuper@2526
|
412 |
/**
|
wneuper@2526
|
413 |
* @see isac.util.interfaces.ICalcIterator#tryMatchMethod
|
wneuper@2526
|
414 |
*/
|
wneuper@2526
|
415 |
public Match tryMatchMethod(int calcTreeID, KEStoreID pblID)
|
wneuper@2526
|
416 |
throws RemoteException {
|
wneuper@2526
|
417 |
return bridge_rmi_.tryMatchMethod(calcTreeID, pblID);
|
wneuper@2526
|
418 |
}
|
wneuper@2526
|
419 |
|
wneuper@2526
|
420 |
/**
|
wneuper@2526
|
421 |
* @see isac.util.interfaces.ICalcIterator#tryRefineMethod
|
wneuper@2526
|
422 |
*/
|
wneuper@2526
|
423 |
public Match tryRefineMethod(int calcTreeID, KEStoreID pblID)
|
wneuper@2526
|
424 |
throws RemoteException {
|
wneuper@2526
|
425 |
return bridge_rmi_.tryRefineMethod(calcTreeID, pblID);
|
wneuper@2526
|
426 |
}
|
wneuper@2065
|
427 |
} |