wneuper@2707
|
1 |
/**
|
rgradisc@988
|
2 |
* Created on Oct 13, 2003
|
wneuper@2707
|
3 |
* @author Richard Gradischnegg RG
|
rgradisc@988
|
4 |
*/
|
rgradisc@988
|
5 |
package isac.bridge;
|
rgradisc@988
|
6 |
|
wneuper@4792
|
7 |
import isac.bridge.xml.DataTypes;
|
wneuper@4792
|
8 |
import isac.bridge.xml.IntAssumptions;
|
wneuper@4792
|
9 |
import isac.bridge.xml.IntCalcHead;
|
wneuper@4792
|
10 |
import isac.bridge.xml.IntCEvent;
|
wneuper@4751
|
11 |
import isac.bridge.xml.IntFormHead;
|
wneuper@4750
|
12 |
import isac.bridge.xml.IntFormulas;
|
wneuper@4750
|
13 |
import isac.bridge.xml.IntIntCompound;
|
wneuper@4802
|
14 |
import isac.bridge.xml.IntContext;
|
wneuper@4750
|
15 |
import isac.bridge.xml.IntPosition;
|
wneuper@4792
|
16 |
import isac.bridge.xml.IntTactic;
|
wneuper@4792
|
17 |
import isac.bridge.xml.IntTacticErrPats;
|
wneuper@4792
|
18 |
import isac.bridge.xml.IntTactics;
|
wneuper@4750
|
19 |
import isac.bridge.xml.IsaToJava;
|
wneuper@4750
|
20 |
import isac.bridge.xml.JavaToIsa;
|
wneuper@2750
|
21 |
import isac.interfaces.ICalcElement;
|
wneuper@2750
|
22 |
import isac.interfaces.ICalcIterator;
|
wneuper@2750
|
23 |
import isac.interfaces.IToCalc;
|
rgradisc@1088
|
24 |
import isac.util.Formalization;
|
rgradisc@1134
|
25 |
import isac.util.ResponseWrapper;
|
wneuper@2100
|
26 |
import isac.util.formulae.Assumptions;
|
rgradisc@1311
|
27 |
import isac.util.formulae.CalcHead;
|
nsimic@3490
|
28 |
import isac.util.formulae.Context;
|
rkoenig@3592
|
29 |
import isac.util.formulae.ContextMethod;
|
rkoenig@3592
|
30 |
import isac.util.formulae.ContextProblem;
|
nsimic@3490
|
31 |
import isac.util.formulae.ContextTheory;
|
wneuper@3114
|
32 |
import isac.util.formulae.HierarchyKey;
|
wneuper@2051
|
33 |
import isac.util.formulae.CalcFormula;
|
wneuper@2523
|
34 |
import isac.util.formulae.Match;
|
wneuper@2838
|
35 |
import isac.util.formulae.MethodID;
|
wneuper@1861
|
36 |
import isac.util.formulae.Position;
|
wneuper@2524
|
37 |
import isac.util.formulae.ProblemID;
|
rgradisc@1306
|
38 |
import isac.util.parser.XMLParserDigest;
|
wneuper@4773
|
39 |
import isac.util.tactics.SimpleTactic;
|
rgradisc@1311
|
40 |
import isac.util.tactics.Tactic;
|
nsimic@3490
|
41 |
import isac.wsdialog.IContextProvider.ContextType;
|
walther@5239
|
42 |
import edu.tum.cs.isabelle.api.XML;
|
walther@5239
|
43 |
import edu.tum.cs.isabelle.japi.JSystem;
|
wneuper@4750
|
44 |
|
rgradisc@989
|
45 |
import java.io.BufferedReader;
|
rgradisc@989
|
46 |
import java.io.IOException;
|
rgradisc@989
|
47 |
import java.io.InputStreamReader;
|
rgradisc@989
|
48 |
import java.io.PrintWriter;
|
wneuper@4750
|
49 |
import java.math.BigInteger;
|
rgradisc@989
|
50 |
import java.net.MalformedURLException;
|
rgradisc@1019
|
51 |
import java.net.Socket;
|
rgradisc@989
|
52 |
import java.net.UnknownHostException;
|
rgradisc@988
|
53 |
import java.rmi.Naming;
|
rgradisc@988
|
54 |
import java.rmi.RMISecurityManager;
|
rgradisc@988
|
55 |
import java.rmi.RemoteException;
|
rgradisc@989
|
56 |
import java.rmi.registry.LocateRegistry;
|
rgradisc@988
|
57 |
import java.rmi.server.UnicastRemoteObject;
|
rgradisc@1196
|
58 |
import java.util.HashMap;
|
rgradisc@1191
|
59 |
import java.util.Iterator;
|
rgradisc@1196
|
60 |
import java.util.Map;
|
rgradisc@1198
|
61 |
import java.util.Set;
|
rgradisc@1191
|
62 |
import java.util.Vector;
|
wneuper@4770
|
63 |
|
wneuper@4767
|
64 |
import scala.math.BigInt;
|
rgradisc@988
|
65 |
|
wneuper@3881
|
66 |
import org.apache.log4j.Logger;
|
wneuper@3881
|
67 |
|
rgradisc@988
|
68 |
/**
|
wneuper@2736
|
69 |
* @author Richard Gradischnegg RG
|
wneuper@1976
|
70 |
*
|
wneuper@1989
|
71 |
* WN0422 here seems to be the key for simplifying the whole bridge.* drawbacks
|
wneuper@1989
|
72 |
* of the present implementation: # more complicated than necessary #
|
wneuper@1989
|
73 |
* JUnitTestCases require BridgeMain running # BridgeLogger cannot be made
|
wneuper@1989
|
74 |
* serializable, thus not accessible for writing by JUnitTestCases #
|
rgradisc@988
|
75 |
*/
|
a@5035
|
76 |
@SuppressWarnings("deprecation") // RMISecurityManager : RMI reform will come
|
rgradisc@988
|
77 |
public class BridgeRMI extends UnicastRemoteObject implements IBridgeRMI {
|
rgradisc@988
|
78 |
|
nsimic@3781
|
79 |
static final long serialVersionUID = -3047706038036289437L;
|
wneuper@3881
|
80 |
private static final Logger logger = Logger.getLogger(BridgeRMI.class.getName());
|
nsimic@3781
|
81 |
|
nsimic@3781
|
82 |
private BridgeMain bridge_;
|
rgradisc@1178
|
83 |
|
mlang@2448
|
84 |
private XMLParserDigest xml_parser_digest_;
|
rgradisc@1178
|
85 |
|
mlang@2448
|
86 |
// Socket used to communicate with bridge
|
mlang@2448
|
87 |
private Socket socket_ = null;
|
rgradisc@1178
|
88 |
|
mlang@2448
|
89 |
// Writer to write sml requests to the kernel
|
wneuper@4700
|
90 |
private PrintWriter out_ = null;
|
rgradisc@989
|
91 |
|
mlang@2448
|
92 |
// Reader to read sml response from kernel
|
wneuper@4700
|
93 |
private BufferedReader in_ = null;
|
rgradisc@1191
|
94 |
|
mlang@2448
|
95 |
private String host_;
|
rgradisc@1196
|
96 |
|
mlang@2448
|
97 |
private int rmiid_;
|
rgradisc@1191
|
98 |
|
mlang@2448
|
99 |
/**
|
mlang@2448
|
100 |
* Maps the Java calc(Tree)rmiID to the sml calc(Tree)rmiID. A mapping is
|
mlang@2448
|
101 |
* nescessary because these ids are not (nescessary) the same: For example
|
mlang@2448
|
102 |
* when restoring the kernel, the calcTree rmiID can change because of
|
mlang@2448
|
103 |
* already finished CalcTrees no longer existing and their CalcId assigned
|
mlang@2448
|
104 |
* to another CalcTree. key: Integer (javaCalcID) value: Integer (smlCalcID)
|
mlang@2448
|
105 |
*/
|
a@5052
|
106 |
private Map<Integer, Integer> java_calcid_to_smlcalcid_;
|
rgradisc@1252
|
107 |
|
mlang@2448
|
108 |
/**
|
mlang@2448
|
109 |
* This map stores user inputs which have already been answered by the
|
mlang@2448
|
110 |
* kernel and the response being sent back to the user. These inputs are
|
mlang@2448
|
111 |
* resent to the kernel in the case of a newstart of the kernel. key:
|
mlang@2448
|
112 |
* Integer (javaCalcID) value: Vector (containing input strings)
|
mlang@2448
|
113 |
*/
|
a@5002
|
114 |
private Map<Integer, Vector<String>> inputs_;
|
wneuper@4750
|
115 |
private JSystem connection_to_kernel_;
|
rgradisc@1252
|
116 |
|
mlang@2448
|
117 |
public BridgeRMI(BridgeMain bridge, String host, int port, String dtdPath)
|
mlang@2448
|
118 |
throws RemoteException {
|
wneuper@3881
|
119 |
if (logger.isDebugEnabled())
|
wneuper@3881
|
120 |
logger.debug("BridgeRMI obj.init: bridge=" + bridge + ", host=" + host
|
wneuper@3881
|
121 |
+ ", port=" + port + ", dtdPath=" + dtdPath);
|
mlang@2448
|
122 |
this.host_ = host;
|
mlang@2448
|
123 |
this.bridge_ = bridge;
|
wneuper@4750
|
124 |
this.connection_to_kernel_ = bridge.getConnectionToKernel();
|
mlang@2448
|
125 |
in_ = bridge.getSmlReader();
|
mlang@2448
|
126 |
try {
|
mlang@2448
|
127 |
socket_ = new Socket(host, port);
|
wneuper@4700
|
128 |
out_ = new PrintWriter(socket_.getOutputStream(), true);
|
wneuper@4700
|
129 |
in_ = new BufferedReader(new InputStreamReader(socket_
|
mlang@2448
|
130 |
.getInputStream()));
|
mlang@2448
|
131 |
} catch (UnknownHostException e) {
|
mlang@2448
|
132 |
System.out.println("Unknown host: " + host + "\n");
|
mlang@2448
|
133 |
} catch (IOException e) {
|
wneuper@4865
|
134 |
System.out.println("probably just a remainder of 'bridge-internal RMI'");
|
mlang@2448
|
135 |
}
|
mlang@2448
|
136 |
rmiBind();
|
mlang@2448
|
137 |
xml_parser_digest_ = new XMLParserDigest(dtdPath);
|
mlang@2448
|
138 |
//xml_parser_digest_.setValidating(true);
|
mlang@2448
|
139 |
//...all XML-data should be tested in
|
mlang@2448
|
140 |
//javatest.isac.util.parser.TestXMLParserDigest
|
a@4980
|
141 |
inputs_ = new HashMap<Integer, Vector<String>>();
|
a@5052
|
142 |
java_calcid_to_smlcalcid_ = new HashMap<>();
|
mlang@2448
|
143 |
}
|
rgradisc@1215
|
144 |
|
mlang@2448
|
145 |
/**
|
mlang@2448
|
146 |
* Buffers input sent to the sml-Kernel (for later possible restart)
|
mlang@2448
|
147 |
*
|
mlang@2448
|
148 |
* @param javaCalcID
|
mlang@2448
|
149 |
* calcTree this input belongs to
|
mlang@2448
|
150 |
* @param input
|
mlang@2448
|
151 |
* to be buffered
|
mlang@2448
|
152 |
*/
|
mlang@2448
|
153 |
public void bufferInput(int javaCalcID, String input) {
|
a@4971
|
154 |
Vector<String> v = (Vector<String>) inputs_.get(new Integer(javaCalcID));
|
mlang@2448
|
155 |
if (v == null) {
|
a@4971
|
156 |
v = new Vector<>();
|
mlang@2448
|
157 |
inputs_.put(new Integer(javaCalcID), v);
|
mlang@2448
|
158 |
}
|
mlang@2448
|
159 |
v.add(input);
|
mlang@2448
|
160 |
}
|
rgradisc@988
|
161 |
|
mlang@2448
|
162 |
// '@calcid@' is a placeholder for the CalcID
|
mlang@2448
|
163 |
// this method replaces it with a real CalcID
|
mlang@2448
|
164 |
private String insertCalcID(int id, String s) {
|
mlang@2448
|
165 |
return s.replaceAll("@calcid@", String.valueOf(id));
|
mlang@2448
|
166 |
}
|
rgradisc@988
|
167 |
|
mlang@2448
|
168 |
// return smallest integer which is not yet
|
mlang@2448
|
169 |
// used as a (java)CalcID
|
mlang@2448
|
170 |
private int smallestFreeCalcID() {
|
a@4989
|
171 |
Set<?> set = java_calcid_to_smlcalcid_.keySet();
|
mlang@2448
|
172 |
for (int i = 0; i < set.size(); i++) {
|
wneuper@2523
|
173 |
if (!set.contains(new Integer(i))) {
|
wneuper@2523
|
174 |
return i;
|
wneuper@2523
|
175 |
}
|
mlang@2448
|
176 |
}
|
mlang@2448
|
177 |
return set.size();
|
mlang@2448
|
178 |
}
|
rgradisc@988
|
179 |
|
mlang@2448
|
180 |
/*
|
mlang@2448
|
181 |
* Send a sml instruction to the kernel. restore == true, if the instruction
|
mlang@2448
|
182 |
* is resent after the kernel crashed
|
mlang@2448
|
183 |
*/
|
mlang@2448
|
184 |
private ResponseWrapper sendToKernel(String smlInstr, boolean restore) {
|
wneuper@3881
|
185 |
if (logger.isDebugEnabled())
|
wneuper@3881
|
186 |
logger.debug(" BR->KN: sendToKernel(" + smlInstr + ")");
|
mlang@2448
|
187 |
ResponseWrapper wrapper = null;
|
mlang@2448
|
188 |
//bridge.log(1,"---sendToKernel |
|
mlang@2448
|
189 |
//bridge.isRestoring=="+bridge.isRestoring());
|
mlang@2448
|
190 |
//bridge.log(1,"---sendToKernel | restoring=="+restore);
|
mlang@2448
|
191 |
if (!bridge_.isRestoring() || restore) {
|
mlang@2448
|
192 |
String xmlString = "";
|
rgradisc@1107
|
193 |
|
mlang@2448
|
194 |
out_.println(smlInstr);// send the sml Instruction to the sml Kernel
|
mlang@2448
|
195 |
try {
|
mlang@2448
|
196 |
xmlString = in_.readLine();//read the response from the kernel
|
wneuper@3881
|
197 |
if (logger.isInfoEnabled())
|
wneuper@3881
|
198 |
logger.info(" BR<-KN: sendToKernel <- xml= " + xmlString);
|
mlang@2448
|
199 |
} catch (IOException e) {
|
mlang@2448
|
200 |
bridge_.log(1, "BridgeRMI.interpretSKN: IOException");
|
mlang@2448
|
201 |
e.printStackTrace();
|
mlang@2448
|
202 |
}
|
mlang@2448
|
203 |
//if (!(restore) && bridge.isRestoring()) {
|
mlang@2448
|
204 |
// this.restoreExistingCalcTrees();
|
mlang@2448
|
205 |
//}
|
nsimic@3606
|
206 |
|
nsimic@3606
|
207 |
bridge_.log( 1, xmlString );
|
mlang@2448
|
208 |
wrapper = xml_parser_digest_.parse(xmlString);
|
mlang@2448
|
209 |
}
|
mlang@2448
|
210 |
return wrapper;
|
mlang@2448
|
211 |
}
|
rgradisc@1016
|
212 |
|
mlang@2448
|
213 |
/**
|
mlang@2448
|
214 |
* Send an instruction to the SML-Kernel and return the response
|
mlang@2448
|
215 |
*
|
mlang@2448
|
216 |
* @param smlInstr
|
mlang@2448
|
217 |
* Instruction
|
mlang@2448
|
218 |
* @return response from SML-Kernel
|
mlang@2448
|
219 |
*/
|
mlang@2448
|
220 |
private synchronized ResponseWrapper interpretSML(int javaCalcID,
|
mlang@2448
|
221 |
String instr, boolean restore) {
|
mlang@2448
|
222 |
int smlCalcID;
|
nsimic@3236
|
223 |
|
wneuper@4770
|
224 |
Integer smlCalcInteger = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
nsimic@3236
|
225 |
if( smlCalcInteger == null ) {
|
nsimic@3236
|
226 |
bridge_.log(1, "smlCalcInteger is null for javaCalcID : " + javaCalcID );
|
nsimic@3236
|
227 |
return null;
|
nsimic@3236
|
228 |
}
|
nsimic@3236
|
229 |
|
nsimic@3236
|
230 |
smlCalcID = smlCalcInteger.intValue();
|
mlang@2448
|
231 |
String smlInstr = insertCalcID(smlCalcID, instr);
|
mlang@2448
|
232 |
bridge_.log(1, "JavaCalcID " + javaCalcID + " == SmlCalcID "
|
mlang@2448
|
233 |
+ smlCalcID);
|
mlang@2448
|
234 |
bridge_.log(1, "sent to bridge: " + smlInstr);
|
kober@4047
|
235 |
ResponseWrapper wrapper = this.sendToKernel(smlInstr, restore);
|
wneuper@2523
|
236 |
if (!restore)
|
wneuper@2523
|
237 |
bufferInput(javaCalcID, smlInstr);
|
mlang@2448
|
238 |
return wrapper;
|
mlang@2448
|
239 |
}
|
rgradisc@1586
|
240 |
|
a@5035
|
241 |
private void rmiBind() {
|
wneuper@3881
|
242 |
if (logger.isDebugEnabled())
|
wneuper@3881
|
243 |
logger.debug("rmiBind");
|
mlang@2448
|
244 |
if (System.getSecurityManager() == null) {
|
mlang@2448
|
245 |
System.setSecurityManager(new RMISecurityManager());
|
mlang@2448
|
246 |
}
|
nsimic@3783
|
247 |
|
mlang@2448
|
248 |
String name = "//" + host_ + "/BridgeRMI";
|
mlang@2448
|
249 |
try {
|
mlang@2448
|
250 |
System.out.println("try to bind as " + name);
|
mlang@2448
|
251 |
Naming.rebind(name, this);
|
mlang@2448
|
252 |
System.out.println("Bridge RMI bound to " + name);
|
mlang@2448
|
253 |
} catch (java.rmi.ConnectException e) {
|
nsimic@3782
|
254 |
System.err.println("failed to contact as " + name + " (creating RMI-Server on localhost: 1099)");
|
nsimic@3782
|
255 |
try {
|
walther@5240
|
256 |
LocateRegistry.createRegistry(1097);
|
walther@5240
|
257 |
// LocateRegistry.createRegistry(1099);
|
nsimic@3782
|
258 |
} catch (java.rmi.RemoteException exc2) {
|
nsimic@3782
|
259 |
System.err.println("can not create registry: " + exc2.getMessage());
|
nsimic@3782
|
260 |
System.exit(1);
|
nsimic@3782
|
261 |
}
|
nsimic@3794
|
262 |
rmiBind();
|
mlang@2448
|
263 |
} catch (RemoteException e) {
|
nsimic@3783
|
264 |
System.err.println("RemoteException");
|
nsimic@3782
|
265 |
System.err.println(e.getMessage());
|
nsimic@3783
|
266 |
System.err.println(e.getCause().getMessage());
|
nsimic@3783
|
267 |
System.err.println(e.getCause().getClass());
|
nsimic@3782
|
268 |
e.printStackTrace();
|
nsimic@3782
|
269 |
System.exit(1);
|
nsimic@3782
|
270 |
|
mlang@2448
|
271 |
} catch (MalformedURLException e) {
|
nsimic@3782
|
272 |
System.err.println(e.getMessage());
|
nsimic@3782
|
273 |
e.printStackTrace();
|
nsimic@3782
|
274 |
System.exit(1);
|
nsimic@3782
|
275 |
|
nsimic@3782
|
276 |
} catch (Exception e) {
|
nsimic@3783
|
277 |
System.err.println("----------- Exception");
|
nsimic@3783
|
278 |
System.err.println(e.getClass().getName());
|
nsimic@3782
|
279 |
System.err.println(e.getMessage());
|
nsimic@3782
|
280 |
e.printStackTrace();
|
nsimic@3782
|
281 |
System.exit(1);
|
nsimic@3782
|
282 |
|
mlang@2448
|
283 |
}
|
mlang@2448
|
284 |
}
|
rgradisc@1016
|
285 |
|
wneuper@4762
|
286 |
/**
|
wneuper@4762
|
287 |
* Restore a saved calcTree.
|
wneuper@4762
|
288 |
*
|
wneuper@4762
|
289 |
* @param v
|
wneuper@4762
|
290 |
* Vector containing strings
|
wneuper@4762
|
291 |
* @return Java CalcTreeID (not SML-ID)
|
wneuper@4762
|
292 |
*/
|
wneuper@4762
|
293 |
public int loadCalcTree(Vector v) {
|
wneuper@4762
|
294 |
this.bridge_.log(1, "----------------begin loading------------");
|
wneuper@4762
|
295 |
int javaCalcID = smallestFreeCalcID();
|
wneuper@4762
|
296 |
this.bridge_.log(1, "-----smallest free = " + javaCalcID);
|
wneuper@4762
|
297 |
restoreToSML(javaCalcID, v);
|
wneuper@4762
|
298 |
this.bridge_.log(1, "----------------done loading-------------");
|
wneuper@4762
|
299 |
return javaCalcID;
|
wneuper@4762
|
300 |
}
|
rgradisc@1133
|
301 |
|
wneuper@4762
|
302 |
public int smlCalcIDtoJavaCalcID(int smlID) {
|
a@4984
|
303 |
Iterator<?> it = java_calcid_to_smlcalcid_.keySet().iterator();
|
wneuper@4762
|
304 |
while (it.hasNext()) {
|
wneuper@4762
|
305 |
Object key = it.next();
|
wneuper@4762
|
306 |
Integer value = (Integer) java_calcid_to_smlcalcid_.get(key);
|
wneuper@4762
|
307 |
if (value.intValue() == smlID) {
|
wneuper@4762
|
308 |
return ((Integer) key).intValue();
|
wneuper@4762
|
309 |
}
|
wneuper@4762
|
310 |
}
|
wneuper@4762
|
311 |
return -1;
|
wneuper@4762
|
312 |
}
|
wneuper@4762
|
313 |
|
a@4987
|
314 |
public Map<?, Vector<String>> getInputs() {
|
wneuper@4762
|
315 |
return inputs_;
|
wneuper@4762
|
316 |
}
|
wneuper@4762
|
317 |
|
wneuper@4762
|
318 |
public int getRmiID() {
|
wneuper@4762
|
319 |
return rmiid_;
|
wneuper@4762
|
320 |
}
|
wneuper@4762
|
321 |
|
wneuper@4762
|
322 |
public void setRmiID(int i) {
|
wneuper@4762
|
323 |
if (logger.isDebugEnabled())
|
wneuper@4762
|
324 |
logger.debug("setRmiID: i=" + i);
|
wneuper@4762
|
325 |
rmiid_ = i;
|
mlang@2448
|
326 |
}
|
rgradisc@1586
|
327 |
|
wneuper@2736
|
328 |
/**
|
wneuper@2736
|
329 |
* causes a CalcChanged event for the first line on the Worksheet
|
wneuper@2736
|
330 |
*
|
wneuper@2736
|
331 |
* @param id
|
wneuper@2736
|
332 |
* for the CalcTree (unused)
|
wneuper@2736
|
333 |
* @return CalcChanged with Iterators pointing at the root of the CalcTree
|
wneuper@2736
|
334 |
*/
|
wneuper@3881
|
335 |
public CChanged startCalculate(int id) {
|
wneuper@2736
|
336 |
Position p = new Position();
|
wneuper@2736
|
337 |
p.setKind("Pbl");// toSMLString --> ([],"Pbl")
|
wneuper@3881
|
338 |
CChanged cc = new CChanged();
|
wneuper@2736
|
339 |
cc.setLastUnchanged(p);
|
wneuper@2736
|
340 |
cc.setLastDeleted(p);
|
wneuper@2736
|
341 |
cc.setLastGenerated(p);
|
wneuper@2736
|
342 |
return cc;
|
wneuper@2736
|
343 |
}
|
wneuper@2736
|
344 |
|
wneuper@4783
|
345 |
/**
|
wneuper@4783
|
346 |
* Starts the specifying phase: fill the calcTree with the appropriate
|
wneuper@4783
|
347 |
* information. Once the calc_head_ is fully specified, the user can begin
|
wneuper@4783
|
348 |
* with the actual calculation.
|
wneuper@4783
|
349 |
*
|
wneuper@4783
|
350 |
* @param f
|
wneuper@4783
|
351 |
* Formalization for this calculation (empty if user starts a
|
wneuper@4783
|
352 |
* complete new calculation)
|
wneuper@4783
|
353 |
* @return javaCalcID
|
wneuper@4783
|
354 |
*/
|
wneuper@4783
|
355 |
public int getCalcTree(Formalization formalization) {
|
wneuper@4783
|
356 |
int return_val;
|
wneuper@4783
|
357 |
int javaCalcID = smallestFreeCalcID();
|
wneuper@4783
|
358 |
this.bridge_.log(1, "-----smallest free javaCalcID = " + javaCalcID);
|
a@4974
|
359 |
newCalculation(javaCalcID,
|
wneuper@4783
|
360 |
"CalcTree " + formalization.toSMLString() + ";", formalization, false);
|
wneuper@4783
|
361 |
return_val = javaCalcID;
|
wneuper@4783
|
362 |
return return_val;
|
wneuper@4783
|
363 |
}
|
wneuper@4783
|
364 |
|
wneuper@4762
|
365 |
/***********************************************************************
|
wneuper@4762
|
366 |
* Below are all the methods in structure Math_Engine : MATH_ENGINE
|
wneuper@4762
|
367 |
* listed in the same order as in the signature.
|
wneuper@4762
|
368 |
* The previous order still reflected original development;
|
wneuper@4762
|
369 |
* method names reflect the original struggle at the
|
wneuper@4762
|
370 |
* interface Java <--> Isabelle/Isac: different names are made explicit.
|
wneuper@4762
|
371 |
*/
|
wneuper@4762
|
372 |
|
wneuper@4762
|
373 |
/** MATH_ENGINE: val appendFormula : calcID -> cterm' -> XML.tree */
|
wneuper@4762
|
374 |
public CEvent appendFormula(int id, CalcFormula f) {
|
wneuper@4763
|
375 |
CEvent return_val = null;
|
wneuper@4770
|
376 |
int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(id));
|
wneuper@4812
|
377 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
378 |
//*TTY*/ResponseWrapper wrapper = null;
|
wneuper@4828
|
379 |
//*TTY*/wrapper = interpretSML(id, "appendFormula @calcid@ \"" + f.toSMLString() + "\";", false);
|
wneuper@4828
|
380 |
//*TTY*/if (wrapper == null) return null;
|
wneuper@4828
|
381 |
//*TTY*/return_val = (CEvent) wrapper.getResponse();
|
wneuper@4812
|
382 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
383 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "appendFormula " + sml_id + " \"" + f.toSMLString() + "\";");
|
wneuper@4828
|
384 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.append_form(new scala.math.BigInt(BigInteger.valueOf(sml_id)), f.getFormula());
|
wneuper@4828
|
385 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
386 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.APPEND_FORM, xml_in);
|
wneuper@4793
|
387 |
|
wneuper@4828
|
388 |
/*PIDE*/IntCEvent java_out = null;
|
wneuper@4828
|
389 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) java_out = IsaToJava.append_form_out(xml_out);
|
wneuper@4828
|
390 |
/*PIDE*/// else: no message handling by DialogGuide
|
wneuper@4828
|
391 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
392 |
/*PIDE*/return_val = java_out.getCEvent();
|
wneuper@4784
|
393 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
394 |
return return_val;
|
wneuper@4762
|
395 |
}
|
wneuper@4762
|
396 |
|
wneuper@4762
|
397 |
/** MATH_ENGINE: val autoCalculate : calcID -> auto -> XML.tree */
|
wneuper@4762
|
398 |
public CEvent autoCalculate(int id, int scope, int steps) {
|
wneuper@4762
|
399 |
if (logger.isDebugEnabled())
|
wneuper@4762
|
400 |
logger.debug("BridgeRMI#autoCalculate: id=" + id + ", scope" + scope + ", steps" + steps);
|
a@4974
|
401 |
CEvent return_val = null;
|
wneuper@4770
|
402 |
int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(id));
|
wneuper@4762
|
403 |
String log_str;
|
wneuper@4812
|
404 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
405 |
//*TTY*/if ((scope == 3) && (steps == 0)) { //scope ==3 means IToCalc.SCOPE_CALCHEAD:
|
wneuper@4828
|
406 |
//*TTY*/ wrapper = interpretSML(id, "autoCalculate @calcid@ CompleteCalcHead;", false);
|
wneuper@4828
|
407 |
//*TTY*/} else if ((scope == IToCalc.SCOPE_CALCULATION) && (steps == 0)) {
|
wneuper@4828
|
408 |
//*TTY*/ wrapper = interpretSML(id, "autoCalculate @calcid@ CompleteCalc;", false);
|
wneuper@4828
|
409 |
//*TTY*/} else if ((scope == IToCalc.SCOPE_MODEL) && (steps == 0)) {
|
wneuper@4828
|
410 |
//*TTY*/ wrapper = interpretSML(id, "autoCalculate @calcid@ CompleteModel;", false);
|
wneuper@4828
|
411 |
//*TTY*/} else if ((scope == IToCalc.SCOPE_SUBCALCULATION) && (steps == 0)) {
|
wneuper@4828
|
412 |
//*TTY*/ wrapper = interpretSML(id, "autoCalculate @calcid@ CompleteToSubpbl;", false);
|
wneuper@4828
|
413 |
//*TTY*/} else if ((scope == IToCalc.SCOPE_SUBPROBLEM) && (steps == 0)) {
|
wneuper@4828
|
414 |
//*TTY*/ wrapper = interpretSML(id, "autoCalculate @calcid@ CompleteSubpbl;", false);
|
wneuper@4828
|
415 |
//*TTY*/} else { //FIXXXME040624: steps do not regard the scope
|
wneuper@4828
|
416 |
//*TTY*/ wrapper = interpretSML(id, "autoCalculate @calcid@ (Step " + steps + ");", false);
|
wneuper@4828
|
417 |
//*TTY*/}
|
wneuper@4828
|
418 |
//*TTY*/if (wrapper == null) return_val = null;
|
wneuper@4828
|
419 |
//*TTY*/return_val = (CEvent) wrapper.getResponse();
|
wneuper@4762
|
420 |
//-----------------------------------------------------------------------------
|
wneuper@4828
|
421 |
/*PIDE*/String scope_str;
|
wneuper@4828
|
422 |
/*PIDE*/if ((scope == 3) && (steps == 0)) { //scope ==3 means IToCalc.SCOPE_CALCHEAD:
|
wneuper@4828
|
423 |
/*PIDE*/ scope_str = "CompleteCalcHead"; //FIXXXME.WN040624 steps == 0 hides mismatch in specifications
|
wneuper@4828
|
424 |
/*PIDE*/} else if ((scope == IToCalc.SCOPE_CALCULATION) && (steps == 0)) {
|
wneuper@4828
|
425 |
/*PIDE*/ scope_str = "CompleteCalc";
|
wneuper@4828
|
426 |
/*PIDE*/} else if ((scope == IToCalc.SCOPE_MODEL) && (steps == 0)) {
|
wneuper@4828
|
427 |
/*PIDE*/ scope_str = "CompleteModel";
|
wneuper@4828
|
428 |
/*PIDE*/} else if ((scope == IToCalc.SCOPE_SUBCALCULATION) && (steps == 0)) {
|
wneuper@4828
|
429 |
/*PIDE*/ scope_str = "CompleteToSubpbl";
|
wneuper@4828
|
430 |
/*PIDE*/} else if ((scope == IToCalc.SCOPE_SUBPROBLEM) && (steps == 0)) {
|
wneuper@4828
|
431 |
/*PIDE*/ scope_str = "CompleteSubpbl";
|
wneuper@4828
|
432 |
/*PIDE*/} else { //FIXXXME040624: steps do not regard the scope
|
wneuper@4828
|
433 |
/*PIDE*/ scope_str = "Step"; // steps > 0 according to impl.in "isabelle tty"
|
wneuper@4828
|
434 |
/*PIDE*/}
|
wneuper@4828
|
435 |
/*PIDE*/if (steps == 0) log_str = scope_str; else log_str = "(Step " + steps + ")";
|
wneuper@4828
|
436 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "autoCalculate " + sml_id + " " + log_str + ";");
|
wneuper@4769
|
437 |
|
wneuper@4828
|
438 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.auto_calculate(new scala.math.BigInt(BigInteger.valueOf(sml_id)),
|
wneuper@4828
|
439 |
/*PIDE*/ scope_str, new scala.math.BigInt(BigInteger.valueOf(steps)));
|
wneuper@4828
|
440 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
441 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.AUTO_CALC, xml_in);
|
wneuper@4784
|
442 |
|
wneuper@4828
|
443 |
/*PIDE*/IntCEvent java_out = null;
|
wneuper@4828
|
444 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
445 |
/*PIDE*/ java_out = IsaToJava.auto_calc_out(xml_out);
|
wneuper@4828
|
446 |
/*PIDE*/ return_val = java_out.getCEvent();
|
wneuper@4828
|
447 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
448 |
/*PIDE*/} else
|
wneuper@4842
|
449 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4762
|
450 |
/*---------------------------------------------------------------------------*/
|
wneuper@4762
|
451 |
return return_val;
|
wneuper@4762
|
452 |
}
|
wneuper@4762
|
453 |
|
wneuper@4762
|
454 |
/** MATH_ENGINE: val applyTactic : calcID -> pos' -> tac -> XML.tree
|
wneuper@4763
|
455 |
* not implemented in Math_Engine.
|
wneuper@4763
|
456 |
* compare setNextTactic. */
|
wneuper@4762
|
457 |
|
wneuper@2838
|
458 |
/**
|
wneuper@4762
|
459 |
* Starts a new calculation in the sml-Kernel: i.e. a new CalcTree with the
|
wneuper@4762
|
460 |
* initial hot_spot_
|
wneuper@4762
|
461 |
*
|
wneuper@4762
|
462 |
* @param instr
|
wneuper@4762
|
463 |
* "CalcTree" + Formalization in string Representation
|
wneuper@4762
|
464 |
* @param fmz
|
wneuper@4762
|
465 |
* @return sml_calcid //WN150817 why return SML(?!) calcid to Java(?!)
|
wneuper@4762
|
466 |
*
|
wneuper@4762
|
467 |
* MATH_ENGINE: val CalcTree : fmz list -> XML.tree
|
mlang@2448
|
468 |
*/
|
wneuper@4762
|
469 |
private synchronized int newCalculation(int javaCalcID, String instr,
|
wneuper@4762
|
470 |
Formalization fmz, boolean restore) {
|
wneuper@4762
|
471 |
|
wneuper@4762
|
472 |
if (logger.isDebugEnabled())
|
wneuper@4762
|
473 |
logger.debug("newCalculation: javaCalcID=" + javaCalcID + ", instr" + instr + ", restore=" + restore);
|
wneuper@4762
|
474 |
int sml_calcid;
|
wneuper@4762
|
475 |
int return_val;
|
wneuper@4812
|
476 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
477 |
//*TTY*/bridge_.log(1, "new calculation: " + instr);
|
wneuper@4828
|
478 |
//*TTY*/ResponseWrapper wrapper = sendToKernel(instr, restore);
|
wneuper@4828
|
479 |
//*TTY*/if (wrapper == null) return -1;
|
wneuper@4828
|
480 |
//*TTY*/sml_calcid = wrapper.getCalcID();
|
wneuper@4828
|
481 |
//*TTY*/sendToKernel("Iterator " + sml_calcid + ";", restore);//WN041209 no
|
wneuper@4828
|
482 |
//*TTY*/sendToKernel("moveActiveRoot " + sml_calcid + ";", restore);//WN041209
|
wneuper@4828
|
483 |
//*TTY*/if (!restore) bufferInput(javaCalcID, instr);
|
wneuper@4812
|
484 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
485 |
/*PIDE*/bridge_.log(1, "-->ISA: " + instr);
|
wneuper@4892
|
486 |
/*PIDE*/bridge_.log(1, "-->ISA: " + DataTypes.xml_of_Formalization(fmz));
|
wneuper@4848
|
487 |
/*PIDE*/XML.Tree CALC_TREE_out = connection_to_kernel_.invoke(IsacOperations.CALC_TREE,
|
wneuper@4828
|
488 |
/*PIDE*/ DataTypes.xml_of_Formalization(fmz));
|
wneuper@4828
|
489 |
/*PIDE*/bridge_.log(1, "<--ISA: " + CALC_TREE_out);
|
wneuper@4828
|
490 |
/*PIDE*/sml_calcid = (IsaToJava.calc_tree_out(CALC_TREE_out)).intValue();
|
wneuper@4812
|
491 |
|
wneuper@4828
|
492 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "Iterator " + sml_calcid + ";");
|
wneuper@4848
|
493 |
/*PIDE*/XML.Tree ITERATOR_out = connection_to_kernel_.invoke(IsacOperations.ITERATOR,
|
wneuper@4828
|
494 |
/*PIDE*/ new scala.math.BigInt(BigInteger.valueOf(sml_calcid)));
|
wneuper@4828
|
495 |
/*PIDE*/IntIntCompound int_int = IsaToJava.iterator_out(ITERATOR_out);
|
wneuper@4828
|
496 |
/*PIDE*/sml_calcid = int_int.getCalcId().intValue();
|
a@4974
|
497 |
int_int.getUserId().intValue();
|
wneuper@4828
|
498 |
/*PIDE*/bridge_.log(1, "<--ISA: " + ITERATOR_out);
|
wneuper@4812
|
499 |
|
wneuper@4828
|
500 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveActiveRoot " + sml_calcid + ";");
|
wneuper@4848
|
501 |
/*PIDE*/XML.Tree MOVE_ACTIVE_ROOT_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ACTIVE_ROOT,
|
wneuper@4828
|
502 |
/*PIDE*/ new scala.math.BigInt(BigInteger.valueOf(sml_calcid)));
|
wneuper@4828
|
503 |
/*PIDE*/IntPosition calcid_pos = IsaToJava.move_active_root_out(MOVE_ACTIVE_ROOT_out);
|
wneuper@4828
|
504 |
/*PIDE*/return_val = calcid_pos.getCalcId();
|
a@4974
|
505 |
calcid_pos.getPosition();
|
wneuper@4828
|
506 |
/*PIDE*/bridge_.log(1, "<--ISA: " + MOVE_ACTIVE_ROOT_out);
|
wneuper@4762
|
507 |
/*---------------------------------------------------------------------------*/
|
wneuper@4762
|
508 |
java_calcid_to_smlcalcid_.put(new Integer(javaCalcID), new Integer(sml_calcid));
|
wneuper@4762
|
509 |
return_val = sml_calcid; //WN150808 SML_caldid --> JAVA frontend ?!?
|
wneuper@4762
|
510 |
return return_val;
|
wneuper@4762
|
511 |
}
|
wneuper@4762
|
512 |
|
wneuper@4762
|
513 |
/** MATH_ENGINE: val checkContext : calcID -> pos' -> guh -> XML.tree */
|
wneuper@4767
|
514 |
public Context checkContext(int javaCalcID, Context context, Position pos) throws RemoteException {
|
wneuper@4763
|
515 |
Context return_val = null;
|
wneuper@4812
|
516 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
517 |
//*TTY*/ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4828
|
518 |
//*TTY*/ "checkContext @calcid@ " + pos.toSMLString() + " \"" + context.getKEStoreKey().toString() + "\";", false);
|
wneuper@4828
|
519 |
//*TTY*/if(wrapper == null) return null;
|
wneuper@4828
|
520 |
//*TTY*/return_val = (Context) wrapper.getResponse();
|
wneuper@4812
|
521 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
522 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
523 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "checkContext " + sml_id + " " + pos.toSMLString() + " \"" + context.getKEStoreKey().toString() + "\";");
|
wneuper@4767
|
524 |
|
wneuper@4828
|
525 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.check_ctxt(new scala.math.BigInt(BigInteger.valueOf(sml_id)),
|
wneuper@4828
|
526 |
/*PIDE*/ pos, context.getKEStoreKey().toString() + "\"");
|
wneuper@4828
|
527 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
528 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.CHECK_CTXT, xml_in);
|
wneuper@4793
|
529 |
|
wneuper@4828
|
530 |
/*PIDE*/ContextTheory java_out = null;
|
wneuper@4828
|
531 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
532 |
/*PIDE*/ java_out = IsaToJava.check_ctxt_out(xml_out);
|
wneuper@4828
|
533 |
/*PIDE*/ return_val = java_out;
|
wneuper@4828
|
534 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
535 |
/*PIDE*/} else
|
wneuper@4842
|
536 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
537 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
538 |
return return_val;
|
wneuper@4762
|
539 |
}
|
wneuper@4762
|
540 |
|
wneuper@4762
|
541 |
/** MATH_ENGINE: val DEconstrCalcTree : calcID -> XML.tree */
|
wneuper@4762
|
542 |
public boolean destruct(int javaCalcID) {
|
wneuper@4762
|
543 |
boolean return_val;
|
wneuper@4812
|
544 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
545 |
//*TTY*/ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4828
|
546 |
//*TTY*/ "DEconstrCalcTree @calcid@;", false);
|
wneuper@4828
|
547 |
//*TTY*/if (wrapper == null) { return_val = false; }
|
wneuper@4828
|
548 |
//*TTY*/inputs_.remove(new Integer(javaCalcID));
|
wneuper@4828
|
549 |
//*TTY*/return_val = true;
|
wneuper@4812
|
550 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
551 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
552 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "DEconstrCalcTree " + sml_id);
|
wneuper@4848
|
553 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.DEL_CALC,
|
wneuper@4828
|
554 |
/*PIDE*/ new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4793
|
555 |
|
a@4974
|
556 |
IsaToJava.del_calc_out(xml_out);
|
wneuper@4828
|
557 |
/*PIDE*/return_val = true;
|
wneuper@4828
|
558 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4762
|
559 |
/*---------------------------------------------------------------------------*/
|
wneuper@4762
|
560 |
java_calcid_to_smlcalcid_.remove(new Integer(javaCalcID));
|
wneuper@4762
|
561 |
return return_val;
|
wneuper@4762
|
562 |
}
|
wneuper@4762
|
563 |
|
wneuper@4762
|
564 |
/** MATH_ENGINE: val fetchApplicableTactics : calcID -> int -> pos' -> XML.tree */
|
wneuper@4825
|
565 |
public Vector<Tactic> getAppliableTactics(int id, int scope, Position pos) {
|
wneuper@4825
|
566 |
Vector<Tactic> return_val = null;
|
wneuper@4812
|
567 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
568 |
//*TTY*/ResponseWrapper wrapper = interpretSML(id,
|
wneuper@4828
|
569 |
//*TTY*/ "fetchApplicableTactics @calcid@ " + scope + pos.toSMLString() + ";", false);
|
wneuper@4828
|
570 |
//*TTY*/if (wrapper == null) return null;
|
wneuper@4828
|
571 |
//*TTY*/TacticsContainer tc = (TacticsContainer) wrapper.getResponse();
|
wneuper@4828
|
572 |
//*TTY*/if( tc == null ) return null;
|
wneuper@4828
|
573 |
//*TTY*/return_val = tc.getTactics();
|
wneuper@4812
|
574 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
575 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(id));
|
wneuper@4828
|
576 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "fetchApplicableTactics " + sml_id + " " + scope + pos.toSMLString() + ";");
|
wneuper@4764
|
577 |
|
wneuper@4828
|
578 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.fetch_applicable_tacs(new scala.math.BigInt(BigInteger.valueOf(sml_id)),
|
wneuper@4828
|
579 |
/*PIDE*/ new scala.math.BigInt(BigInteger.valueOf(scope)), pos);
|
wneuper@4828
|
580 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
581 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.FETCH_APPL_TACS, xml_in);
|
wneuper@4810
|
582 |
|
wneuper@4828
|
583 |
/*PIDE*/IntTactics java_out = null;
|
wneuper@4828
|
584 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
585 |
/*PIDE*/ java_out = IsaToJava.fetch_applicable_tacs_out(xml_out);
|
wneuper@4828
|
586 |
/*PIDE*/ return_val = java_out.getTactics();
|
wneuper@4828
|
587 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
588 |
/*PIDE*/} else
|
wneuper@4842
|
589 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
590 |
/*---------------------------------------------------------------------------*/
|
wneuper@4812
|
591 |
return return_val;
|
wneuper@4762
|
592 |
}
|
wneuper@4762
|
593 |
|
wneuper@4762
|
594 |
/** MATH_ENGINE: val fetchProposedTactic : calcID -> XML.tree */
|
wneuper@4762
|
595 |
public Tactic fetchProposedTactic(int id) {
|
wneuper@4763
|
596 |
Tactic return_val = null;
|
wneuper@4812
|
597 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
598 |
//*TTY*/ResponseWrapper wrapper = interpretSML(id, "fetchProposedTactic @calcid@;", false);
|
wneuper@4828
|
599 |
//*TTY*/if (wrapper == null) { return null; }
|
wneuper@4828
|
600 |
//*TTY*/return_val = (Tactic) wrapper.getResponse();
|
wneuper@4812
|
601 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
602 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(id));
|
wneuper@4828
|
603 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "fetchProposedTactic " + sml_id + ";");
|
wneuper@4764
|
604 |
|
wneuper@4828
|
605 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.fetch_proposed_tac(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
606 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
607 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.FETCH_PROP_TAC, xml_in);
|
wneuper@4770
|
608 |
|
wneuper@4828
|
609 |
/*PIDE*/IntTacticErrPats java_out = null;
|
wneuper@4828
|
610 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
611 |
/*PIDE*/ java_out = IsaToJava.fetch_proposed_tac_out(xml_out);
|
wneuper@4828
|
612 |
/*PIDE*/ return_val = java_out.getTactic();
|
wneuper@4828
|
613 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
614 |
/*PIDE*/} else
|
wneuper@4842
|
615 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
616 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
617 |
return return_val;
|
wneuper@4762
|
618 |
}
|
wneuper@4762
|
619 |
|
wneuper@4762
|
620 |
/** MATH_ENGINE: val findFillpatterns : calcID -> errpatID -> XML.tree
|
wneuper@4762
|
621 |
* only implemented in Math_Engine */
|
wneuper@4762
|
622 |
|
wneuper@4762
|
623 |
/**
|
wneuper@4762
|
624 |
* @see isac.bridge.IBridgeRMI#getAccumulatedAssumptions(int,
|
wneuper@4762
|
625 |
* isac.util.formulae.Position)
|
wneuper@4762
|
626 |
*
|
wneuper@4762
|
627 |
* ** MATH_ENGINE: val getAccumulatedAsms : calcID -> pos' -> XML.tree
|
wneuper@4762
|
628 |
*/
|
wneuper@4762
|
629 |
public Assumptions getAccumulatedAssumptions(int calcTreeID, Position pos) throws RemoteException {
|
wneuper@4763
|
630 |
Assumptions return_val = null;
|
wneuper@4812
|
631 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
632 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calcTreeID,
|
wneuper@4828
|
633 |
//*TTY*/ "getAccumulatedAsms @calcid@ " + pos.toSMLString() + ";", false);
|
wneuper@4828
|
634 |
//*TTY*/return_val = (Assumptions) wrapper.getResponse();
|
wneuper@4812
|
635 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
636 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calcTreeID));
|
wneuper@4828
|
637 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "getAccumulatedAsms " + sml_id + " " + pos.toSMLString() + ";");
|
wneuper@4764
|
638 |
|
wneuper@4828
|
639 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.get_accumulated_asms(new scala.math.BigInt(BigInteger.valueOf(sml_id)), pos);
|
wneuper@4828
|
640 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
641 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.GET_ACC_ASMS, xml_in);
|
wneuper@4770
|
642 |
|
wneuper@4828
|
643 |
/*PIDE*/IntAssumptions java_out = null;
|
wneuper@4828
|
644 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
645 |
/*PIDE*/ java_out = IsaToJava.get_accumulated_asms_out(xml_out);
|
wneuper@4828
|
646 |
/*PIDE*/ return_val = java_out.getAssumptions();
|
wneuper@4828
|
647 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
648 |
/*PIDE*/} else
|
wneuper@4842
|
649 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
650 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
651 |
return return_val;
|
wneuper@4762
|
652 |
}
|
wneuper@4762
|
653 |
|
wneuper@4762
|
654 |
/** MATH_ENGINE: val getActiveFormula : calcID -> XML.tree */
|
wneuper@4762
|
655 |
public Position getActiveFormula(int javaCalcID) {
|
wneuper@4763
|
656 |
Position return_val = null;
|
wneuper@4812
|
657 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
658 |
//*TTY*/ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4828
|
659 |
//*TTY*/ "getActiveFormula @calcid@ ;", false);
|
wneuper@4828
|
660 |
//*TTY*/return_val = moveSuccess(wrapper);
|
wneuper@4812
|
661 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
662 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
663 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "getActiveFormula " + sml_id + " ;");
|
wneuper@4764
|
664 |
|
wneuper@4828
|
665 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.get_active_form(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
666 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
667 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.GET_ACTIVE_FORM, xml_in);
|
wneuper@4784
|
668 |
|
wneuper@4828
|
669 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
670 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
671 |
/*PIDE*/ java_out = IsaToJava.get_active_form_out(xml_out);
|
wneuper@4828
|
672 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
673 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
674 |
/*PIDE*/} else
|
wneuper@4842
|
675 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
676 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
677 |
return return_val;
|
wneuper@2838
|
678 |
}
|
rgradisc@1618
|
679 |
|
wneuper@2543
|
680 |
/**
|
wneuper@4762
|
681 |
* @see isac.bridge.IBridgeRMI#getAssumption(int, int)
|
wneuper@4762
|
682 |
*
|
wneuper@4762
|
683 |
* MATH_ENGINE: val getAssumptions : calcID -> pos' -> XML.tree
|
wneuper@2838
|
684 |
*/
|
wneuper@4762
|
685 |
public Assumptions getAssumptions(int calcTreeID, Position pos) throws RemoteException {
|
wneuper@4763
|
686 |
Assumptions return_val = null;
|
wneuper@4812
|
687 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
688 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calcTreeID,
|
wneuper@4828
|
689 |
//*TTY*/ "getAssumptions @calcid@ " + pos.toSMLString() + ";", false);
|
wneuper@4828
|
690 |
//*TTY*/return_val = (Assumptions) wrapper.getResponse();
|
wneuper@4812
|
691 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
692 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calcTreeID));
|
wneuper@4828
|
693 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "getAssumptions " + sml_id + " " + pos.toSMLString() + ";");
|
wneuper@4764
|
694 |
|
wneuper@4828
|
695 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.get_asms(new scala.math.BigInt(BigInteger.valueOf(sml_id)), pos);
|
wneuper@4828
|
696 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
697 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.GET_ASMS, xml_in);
|
wneuper@4784
|
698 |
|
wneuper@4828
|
699 |
/*PIDE*/IntAssumptions java_out = null;
|
wneuper@4828
|
700 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
701 |
/*PIDE*/ java_out = IsaToJava.get_asms_out(xml_out);
|
wneuper@4828
|
702 |
/*PIDE*/ return_val = java_out.getAssumptions();
|
wneuper@4828
|
703 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
704 |
/*PIDE*/} else
|
wneuper@4842
|
705 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
706 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
707 |
return return_val;
|
wneuper@4762
|
708 |
}
|
wneuper@4762
|
709 |
|
wneuper@4762
|
710 |
/** MATH_ENGINE: val getFormulaeFromTo : calcID -> pos' -> pos' -> int -> bool -> XML.tree */
|
a@4971
|
711 |
public Vector<CalcFormula> getFormulaeFromTo(int id, ICalcIterator iterator_from,
|
wneuper@4762
|
712 |
ICalcIterator iterator_to, Integer level, boolean result_includes_tactics) {
|
wneuper@4816
|
713 |
XML.Tree xml_in = null;
|
a@4974
|
714 |
Vector<CalcFormula> return_val = null;
|
wneuper@4812
|
715 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
716 |
//*TTY*/try { wrapper = interpretSML(id, "getFormulaeFromTo @calcid@ "
|
wneuper@4828
|
717 |
//*TTY*/ + iterator_from.toSMLString() + " " + iterator_to.toSMLString()
|
wneuper@4828
|
718 |
//*TTY*/ + " " + level + " " + result_includes_tactics + ";", false);
|
wneuper@4828
|
719 |
//*TTY*/} catch (RemoteException e) { e.printStackTrace(); }
|
wneuper@4828
|
720 |
//*TTY*/if (wrapper == null) return null;
|
wneuper@4828
|
721 |
//*TTY*/FormHeadsContainer con = (FormHeadsContainer) wrapper.getResponse();
|
wneuper@4828
|
722 |
//*TTY*/if (con != null) return_val = con.getElements();
|
wneuper@4828
|
723 |
//*TTY*/else return_val = null;
|
wneuper@4812
|
724 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
725 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(id));
|
wneuper@4828
|
726 |
/*PIDE*/try {
|
wneuper@4828
|
727 |
/*PIDE*/ bridge_.log(1, "-->ISA: " + "getFormulaeFromTo " + sml_id + " "
|
wneuper@4828
|
728 |
/*PIDE*/ + iterator_from.toSMLString() + " " + iterator_to.toSMLString()
|
wneuper@4828
|
729 |
/*PIDE*/ + " " + level + " " + result_includes_tactics + ";");
|
wneuper@4828
|
730 |
/*PIDE*/} catch (RemoteException e2) { e2.printStackTrace(); }
|
wneuper@4770
|
731 |
|
wneuper@4828
|
732 |
/*PIDE*/try {
|
wneuper@4828
|
733 |
/*PIDE*/ xml_in = JavaToIsa.get_formulae(new scala.math.BigInt(BigInteger.valueOf(sml_id)),
|
wneuper@4828
|
734 |
/*PIDE*/ iterator_from.getPosition(), iterator_to.getPosition(),
|
wneuper@4828
|
735 |
/*PIDE*/ new scala.math.BigInt(BigInteger.valueOf(level)), result_includes_tactics);
|
wneuper@4828
|
736 |
/*PIDE*/} catch (RemoteException e1) { e1.printStackTrace(); }
|
wneuper@4828
|
737 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
738 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.GET_FORMULAE, xml_in);
|
wneuper@4770
|
739 |
|
wneuper@4828
|
740 |
/*PIDE*/IntFormulas java_out = null;
|
wneuper@4828
|
741 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
742 |
/*PIDE*/ java_out = IsaToJava.get_formulae_out(xml_out);
|
wneuper@4828
|
743 |
/*PIDE*/ return_val = java_out.getCalcFormulas();
|
wneuper@4828
|
744 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
745 |
/*PIDE*/} else
|
wneuper@4842
|
746 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4762
|
747 |
/*---------------------------------------------------------------------------*/
|
wneuper@4762
|
748 |
return return_val;
|
wneuper@4762
|
749 |
}
|
wneuper@4762
|
750 |
|
wneuper@4762
|
751 |
/*
|
wneuper@4762
|
752 |
* @see isac.bridge.IBridgeRMI#getTactic(int, int)
|
wneuper@4762
|
753 |
*
|
wneuper@4762
|
754 |
* MATH_ENGINE: val getTactic : calcID -> pos' -> XML.tree
|
wneuper@4762
|
755 |
*/
|
wneuper@4762
|
756 |
public Tactic getTactic(int calcTreeID, Position pos) throws RemoteException {
|
wneuper@4763
|
757 |
Tactic return_val = null;
|
wneuper@4812
|
758 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
759 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calcTreeID,
|
wneuper@4828
|
760 |
//*TTY*/ "getTactic @calcid@ " + pos.toSMLString() + ";", false);
|
wneuper@4828
|
761 |
//*TTY*/return_val = (Tactic) wrapper.getResponse();
|
wneuper@4812
|
762 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
763 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calcTreeID));
|
wneuper@4828
|
764 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "getTactic " + sml_id + " " + pos.toSMLString() + ";");
|
wneuper@4764
|
765 |
|
wneuper@4828
|
766 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.get_tac(new scala.math.BigInt(BigInteger.valueOf(sml_id)), pos);
|
wneuper@4828
|
767 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
768 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.GET_TAC, xml_in);
|
wneuper@4784
|
769 |
|
wneuper@4828
|
770 |
/*PIDE*/IntTactic java_out = null;
|
wneuper@4828
|
771 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
772 |
/*PIDE*/ java_out = IsaToJava.get_tac_out(xml_out);
|
wneuper@4828
|
773 |
/*PIDE*/ return_val = java_out.getTactic();
|
wneuper@4828
|
774 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
775 |
/*PIDE*/} else
|
wneuper@4842
|
776 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
777 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
778 |
return return_val;
|
wneuper@4762
|
779 |
}
|
wneuper@4762
|
780 |
|
wneuper@4814
|
781 |
/** MATH_ENGINE: val initContext : calcID -> ketype -> pos' -> XML.tree
|
wneuper@4814
|
782 |
*
|
wneuper@4814
|
783 |
* This method is implemented in Isabelle/Isac, but seems to never have been completed in Java.
|
wneuper@4814
|
784 |
* See isac.bridge.TestContext#testContext.
|
wneuper@4814
|
785 |
*/
|
wneuper@4770
|
786 |
public Context initContext(int javaCalcID, ContextType type, Position pos) throws RemoteException {
|
wneuper@4820
|
787 |
Context return_val = null;
|
wneuper@4812
|
788 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
789 |
//*TTY*/ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4828
|
790 |
//*TTY*/ "initContext @calcid@ " + type.toSMLString() + " " + pos.toSMLString() + ";", false);
|
wneuper@4828
|
791 |
//*TTY*/if(wrapper == null) return null;
|
wneuper@4828
|
792 |
//*TTY*/return_val = (Context) wrapper.getResponse();
|
wneuper@4812
|
793 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
794 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
795 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "initContext " + sml_id + " " + type.toSMLString() + " " + pos.toSMLString() + ";");
|
wneuper@4764
|
796 |
|
wneuper@4828
|
797 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.init_ctxt(new scala.math.BigInt(BigInteger.valueOf(sml_id)), type, pos);
|
wneuper@4828
|
798 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
799 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.INIT_CTXT, xml_in);
|
wneuper@4770
|
800 |
|
wneuper@4828
|
801 |
/*PIDE*/Context java_out = null; // front-end later distinguishes ContextTheory, ContextProblem, ..
|
wneuper@4828
|
802 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
803 |
/*PIDE*/ java_out = (Context) IsaToJava.init_ctxt_out(xml_out);
|
wneuper@4828
|
804 |
/*PIDE*/ return_val = java_out;
|
wneuper@4828
|
805 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
806 |
/*PIDE*/} else
|
wneuper@4842
|
807 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
808 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
809 |
return return_val;
|
wneuper@4762
|
810 |
}
|
wneuper@4762
|
811 |
|
wneuper@4762
|
812 |
/** MATH_ENGINE: val inputFillFormula: calcID -> string -> XML.tree
|
wneuper@4762
|
813 |
* only implemented in Math_Engine */
|
wneuper@4762
|
814 |
|
wneuper@4762
|
815 |
/** MATH_ENGINE: val interSteps : calcID -> pos' -> XML.tree */
|
wneuper@4762
|
816 |
public CEvent intermediateSteps(int id, ICalcIterator ci) {
|
wneuper@4763
|
817 |
CEvent return_val = null;
|
wneuper@4812
|
818 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
819 |
//*TTY*/ResponseWrapper wrapper = null;
|
wneuper@4828
|
820 |
//*TTY*/try {
|
wneuper@4828
|
821 |
//*TTY*/ wrapper = interpretSML(id, "interSteps @calcid@ " + ci.toSMLString() + ";", false);
|
wneuper@4828
|
822 |
//*TTY*/} catch (RemoteException e) { e.printStackTrace(); }
|
wneuper@4828
|
823 |
//*TTY*/if (wrapper == null) return null;
|
wneuper@4828
|
824 |
//*TTY*/return_val = (CEvent) wrapper.getResponse();
|
wneuper@4812
|
825 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
826 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(id));
|
wneuper@4828
|
827 |
/*PIDE*/XML.Tree xml_in = null;
|
wneuper@4828
|
828 |
/*PIDE*/try {
|
wneuper@4828
|
829 |
/*PIDE*/ bridge_.log(1, "-->ISA: " + "interSteps " + sml_id + " " + ci.toSMLString() + ";");
|
wneuper@4828
|
830 |
/*PIDE*/} catch (RemoteException e1) { e1.printStackTrace(); }
|
wneuper@4765
|
831 |
|
wneuper@4828
|
832 |
/*PIDE*/try {
|
wneuper@4828
|
833 |
/*PIDE*/ xml_in = JavaToIsa.inter_steps(new scala.math.BigInt(BigInteger.valueOf(sml_id)), ci.getPosition());
|
wneuper@4828
|
834 |
/*PIDE*/} catch (Exception e1) { e1.printStackTrace();}
|
wneuper@4828
|
835 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
836 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.INTER_STEPS, xml_in);
|
wneuper@4804
|
837 |
|
wneuper@4828
|
838 |
/*PIDE*/IntCEvent java_out = null;
|
wneuper@4828
|
839 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
840 |
/*PIDE*/ java_out = IsaToJava.inter_steps_out(xml_out);
|
wneuper@4828
|
841 |
/*PIDE*/ return_val = java_out.getCEvent();
|
wneuper@4828
|
842 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
843 |
/*PIDE*/} else
|
wneuper@4842
|
844 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
845 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
846 |
return return_val;
|
wneuper@4762
|
847 |
}
|
wneuper@4762
|
848 |
|
wneuper@4762
|
849 |
/** MATH_ENGINE: val Iterator : calcID -> XML.tree */
|
wneuper@4762
|
850 |
public int iterator(int id) {
|
wneuper@4762
|
851 |
if (logger.isDebugEnabled())
|
wneuper@4762
|
852 |
logger.debug("iterator: id=" + id);
|
wneuper@4814
|
853 |
int return_val = 4711;
|
wneuper@4812
|
854 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
855 |
//*TTY*/if (id == 1) {
|
wneuper@4828
|
856 |
//*TTY*/ ResponseWrapper wrapper = interpretSML(id, "Iterator @calcid@;", false);
|
wneuper@4828
|
857 |
//*TTY*/ if (wrapper == null) return_val = -1;
|
wneuper@4828
|
858 |
//*TTY*/ else return_val = Integer.parseInt(((CalcHeadSimpleID) wrapper .getResponse()).getID());
|
wneuper@4828
|
859 |
//*TTY*/} else return_val = 4711;//TODO.WN041208 drop CalcIterator.iteratorID_
|
wneuper@4812
|
860 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
861 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(id));
|
wneuper@4828
|
862 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "Iterator " + sml_id + ";");
|
wneuper@4764
|
863 |
|
wneuper@4828
|
864 |
/*PIDE*/BigInt xml_in = new scala.math.BigInt(BigInteger.valueOf(sml_id));
|
wneuper@4828
|
865 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
866 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.ITERATOR, xml_in);
|
wneuper@4770
|
867 |
|
wneuper@4828
|
868 |
/*PIDE*/IntIntCompound java_out = null;
|
wneuper@4828
|
869 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
870 |
/*PIDE*/ java_out = IsaToJava.iterator_out(xml_out);
|
wneuper@4828
|
871 |
/*PIDE*/ return_val = java_out.getCalcId().intValue();
|
wneuper@4828
|
872 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
873 |
/*PIDE*/} else
|
wneuper@4842
|
874 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
875 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
876 |
return return_val;
|
wneuper@4762
|
877 |
}
|
wneuper@4762
|
878 |
|
wneuper@4762
|
879 |
/**
|
wneuper@4762
|
880 |
* @see isac.interfaces.IToCalc#modelProblem()
|
wneuper@4762
|
881 |
*
|
wneuper@4762
|
882 |
* MATH_ENGINE: val modelProblem : calcID -> XML.tree
|
wneuper@4762
|
883 |
*/
|
wneuper@4762
|
884 |
public CalcHead modelProblem(int calc_tree_id) throws RemoteException {
|
wneuper@4763
|
885 |
CalcHead return_val = null;
|
wneuper@4812
|
886 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
887 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calc_tree_id, "modelProblem @calcid@;", false);
|
wneuper@4828
|
888 |
//*TTY*/return_val = (CalcHead) wrapper.getResponse();
|
wneuper@4812
|
889 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
890 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calc_tree_id));
|
wneuper@4828
|
891 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "modelProblem " + sml_id + ";");
|
wneuper@4764
|
892 |
|
wneuper@4828
|
893 |
/*PIDE*/BigInt xml_in = new scala.math.BigInt(BigInteger.valueOf(sml_id));
|
wneuper@4828
|
894 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
895 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.MODEL_PBL, xml_in);
|
wneuper@4770
|
896 |
|
wneuper@4828
|
897 |
/*PIDE*/IntCalcHead java_out = null;
|
wneuper@4828
|
898 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
899 |
/*PIDE*/ java_out = IsaToJava.modify_calchead_out(xml_out);
|
wneuper@4828
|
900 |
/*PIDE*/ return_val = java_out.getCalcHead();
|
wneuper@4828
|
901 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
902 |
/*PIDE*/} else
|
wneuper@4842
|
903 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
904 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
905 |
return return_val;
|
wneuper@2838
|
906 |
}
|
wneuper@4770
|
907 |
|
wneuper@2838
|
908 |
/**
|
wneuper@2838
|
909 |
* @see isac.interfaces.IToCalc#checkCalcHead(isac.util.formulae.CalcHead)
|
wneuper@4762
|
910 |
*
|
wneuper@4762
|
911 |
* MATH_ENGINE: val modifyCalcHead : calcID -> icalhd -> XML.tree
|
wneuper@2838
|
912 |
*/
|
wneuper@4762
|
913 |
public CalcHead checkCalcHead(int calc_tree_id, CalcHead calchead) throws RemoteException {
|
wneuper@4763
|
914 |
CalcHead return_val = null;
|
wneuper@4812
|
915 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
916 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
917 |
//*TTY*/ "modifyCalcHead @calcid@ " + calchead.toSMLString() + ";", false);
|
wneuper@4828
|
918 |
//*TTY*/return_val = (CalcHead) wrapper.getResponse();
|
wneuper@4812
|
919 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
920 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calc_tree_id));
|
wneuper@4828
|
921 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "modelProblem " + sml_id + ";");
|
wneuper@4764
|
922 |
|
wneuper@4828
|
923 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.modify_calchead(new scala.math.BigInt(BigInteger.valueOf(sml_id)), calchead);
|
wneuper@4828
|
924 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
925 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.MODIFY_CALCHEAD, xml_in);
|
wneuper@4770
|
926 |
|
wneuper@4828
|
927 |
/*PIDE*/IntCalcHead java_out = null;
|
wneuper@4828
|
928 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
929 |
/*PIDE*/ java_out = IsaToJava.modify_calchead_out(xml_out);
|
wneuper@4828
|
930 |
/*PIDE*/ return_val = java_out.getCalcHead();
|
wneuper@4828
|
931 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
932 |
/*PIDE*/} else
|
wneuper@4842
|
933 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
934 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
935 |
return return_val;
|
wneuper@4762
|
936 |
}
|
wneuper@4762
|
937 |
|
wneuper@4762
|
938 |
/** MATH_ENGINE: val moveActiveCalcHead : calcID -> XML.tree */
|
wneuper@4762
|
939 |
public Position moveCalcHead(int javaCalcID, int iteratorID, Position p) {
|
wneuper@4797
|
940 |
Position return_val = null;
|
wneuper@4812
|
941 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
942 |
//*TTY*/ResponseWrapper wrapper = null;
|
wneuper@4828
|
943 |
//*TTY*/if (iteratorID == 1)
|
wneuper@4828
|
944 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveActiveCalcHead @calcid@" + ";", false);
|
wneuper@4828
|
945 |
//*TTY*/else
|
wneuper@4828
|
946 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveCalcHead @calcid@ " + " " + p.toSMLString() + ";", false);
|
wneuper@4828
|
947 |
//*TTY*/return_val = moveSuccess(wrapper);
|
wneuper@4812
|
948 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
949 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
950 |
/*PIDE*/XML.Tree xml_in = null;
|
wneuper@4828
|
951 |
/*PIDE*/XML.Tree xml_out = null;
|
wneuper@4784
|
952 |
|
wneuper@4828
|
953 |
/*PIDE*/if (iteratorID == 1) {
|
wneuper@4828
|
954 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveActiveCalcHead " + sml_id + "" + ";");
|
wneuper@4828
|
955 |
/*PIDE*/xml_in = JavaToIsa.move_active_calchead(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
956 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
957 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ACTIVE_FORM, xml_in);
|
wneuper@4796
|
958 |
|
wneuper@4828
|
959 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
960 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
961 |
/*PIDE*/ java_out = IsaToJava.move_active_calchead_out(xml_out);
|
wneuper@4828
|
962 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
963 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
964 |
/*PIDE*/} else
|
wneuper@4842
|
965 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4796
|
966 |
|
wneuper@4828
|
967 |
/*PIDE*/} else {
|
wneuper@4796
|
968 |
|
wneuper@4828
|
969 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveCalcHead " + sml_id + " " + " " + p.toSMLString() + ";");
|
wneuper@4828
|
970 |
/*PIDE*/xml_in = JavaToIsa.move_calchead(new scala.math.BigInt(BigInteger.valueOf(sml_id)), null);
|
wneuper@4828
|
971 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
972 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ACTIVE_FORM, xml_in);
|
wneuper@4770
|
973 |
|
wneuper@4828
|
974 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
975 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
976 |
/*PIDE*/ java_out = IsaToJava.move_calchead_out(xml_out);
|
wneuper@4828
|
977 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
978 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
979 |
/*PIDE*/} else
|
wneuper@4842
|
980 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4828
|
981 |
/*PIDE*/}
|
wneuper@4812
|
982 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
983 |
return return_val;
|
wneuper@4762
|
984 |
}
|
wneuper@4762
|
985 |
|
wneuper@4762
|
986 |
/** MATH_ENGINE: val moveActiveDown : calcID -> XML.tree */
|
wneuper@4762
|
987 |
public Position moveDown(int javaCalcID, int iteratorID, Position p) {
|
wneuper@4762
|
988 |
if (logger.isDebugEnabled())
|
wneuper@4762
|
989 |
logger.debug("moveDown: javaCalcID=" + javaCalcID + ", sml_pos=" + p.toSMLString());
|
wneuper@4796
|
990 |
Position return_val = null;
|
wneuper@4812
|
991 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
992 |
//*TTY*/ResponseWrapper wrapper = null;
|
wneuper@4828
|
993 |
//*TTY*/if (iteratorID == 1)
|
wneuper@4828
|
994 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveActiveDown @calcid@" + ";", false);
|
wneuper@4828
|
995 |
//*TTY*/else
|
wneuper@4828
|
996 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveDown @calcid@ " + p.toSMLString() + ";", false);
|
wneuper@4828
|
997 |
//*TTY*/return_val = moveSuccess(wrapper);
|
wneuper@4812
|
998 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
999 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
1000 |
/*PIDE*/XML.Tree xml_in = null;
|
wneuper@4828
|
1001 |
/*PIDE*/XML.Tree xml_out = null;
|
wneuper@4796
|
1002 |
|
wneuper@4828
|
1003 |
/*PIDE*/if (iteratorID == 1) {
|
wneuper@4828
|
1004 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveActiveDown " + sml_id + "" + ";");
|
wneuper@4828
|
1005 |
/*PIDE*/xml_in = JavaToIsa.move_active_down(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
1006 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1007 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ACTIVE_DOWN, xml_in);
|
wneuper@4770
|
1008 |
|
wneuper@4828
|
1009 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1010 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1011 |
/*PIDE*/ java_out = IsaToJava.move_active_down_out(xml_out);
|
wneuper@4828
|
1012 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1013 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1014 |
/*PIDE*/} else
|
wneuper@4842
|
1015 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4796
|
1016 |
|
wneuper@4828
|
1017 |
/*PIDE*/} else {
|
wneuper@4796
|
1018 |
|
wneuper@4828
|
1019 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveDown " + sml_id + " " + p.toSMLString() + ";");
|
wneuper@4828
|
1020 |
/*PIDE*/xml_in = JavaToIsa.move_down(new scala.math.BigInt(BigInteger.valueOf(sml_id)), p);
|
wneuper@4828
|
1021 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1022 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_DOWN, xml_in);
|
wneuper@4770
|
1023 |
|
wneuper@4828
|
1024 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1025 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1026 |
/*PIDE*/ java_out = IsaToJava.move_down_out(xml_out);
|
wneuper@4828
|
1027 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1028 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1029 |
/*PIDE*/} else
|
wneuper@4842
|
1030 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4828
|
1031 |
/*PIDE*/}
|
wneuper@4812
|
1032 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1033 |
return return_val;
|
wneuper@4762
|
1034 |
}
|
wneuper@4762
|
1035 |
|
wneuper@4762
|
1036 |
/**
|
wneuper@4762
|
1037 |
* returns Position for uniformity with move*; not required elsewhere
|
wneuper@4762
|
1038 |
*
|
wneuper@4762
|
1039 |
* MATH_ENGINE: val moveActiveFormula : calcID -> pos' -> XML.tree
|
wneuper@4762
|
1040 |
*/
|
wneuper@4762
|
1041 |
public Position moveActiveFormula(int javaCalcID, Position p) {
|
wneuper@4762
|
1042 |
if (logger.isDebugEnabled())
|
wneuper@4762
|
1043 |
logger.debug("moveDown: javaCalcID=" + javaCalcID + ", sml_pos=" + p.toSMLString());
|
wneuper@4763
|
1044 |
Position return_val = null;
|
wneuper@4812
|
1045 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1046 |
//*TTY*/ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4828
|
1047 |
//*TTY*/ "moveActiveFormula @calcid@ " + p.toSMLString() + ";", false);
|
wneuper@4828
|
1048 |
//*TTY*/return_val = moveSuccess(wrapper);
|
wneuper@4812
|
1049 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1050 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
1051 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveActiveFormula " + sml_id + " " + p.toSMLString() + ";");
|
wneuper@4764
|
1052 |
|
wneuper@4828
|
1053 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.move_active_form(new scala.math.BigInt(BigInteger.valueOf(sml_id)), p);
|
wneuper@4828
|
1054 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1055 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ACTIVE_FORM, xml_in);
|
wneuper@4770
|
1056 |
|
wneuper@4828
|
1057 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1058 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1059 |
/*PIDE*/ java_out = IsaToJava.move_active_form_out(xml_out);
|
wneuper@4828
|
1060 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1061 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1062 |
/*PIDE*/} else
|
wneuper@4842
|
1063 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
1064 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1065 |
return return_val;
|
wneuper@4762
|
1066 |
}
|
wneuper@4762
|
1067 |
|
wneuper@4762
|
1068 |
/** MATH_ENGINE: val moveActiveLevelDown : calcID -> XML.tree */
|
wneuper@4762
|
1069 |
public Position moveLevelDown(int javaCalcID, int iteratorID, Position p) {
|
wneuper@4763
|
1070 |
Position return_val = null;
|
wneuper@4812
|
1071 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1072 |
//*TTY*/ResponseWrapper wrapper = null;
|
wneuper@4828
|
1073 |
//*TTY*/if (iteratorID == 1)
|
wneuper@4828
|
1074 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveActiveLevelDown @calcid@" + ";", false);
|
wneuper@4828
|
1075 |
//*TTY*/else
|
wneuper@4828
|
1076 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveLevelDown @calcid@ " + " " + p.toSMLString() + ";", false);
|
wneuper@4828
|
1077 |
//*TTY*/return_val = moveSuccess(wrapper);
|
wneuper@4812
|
1078 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1079 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
1080 |
/*PIDE*/XML.Tree xml_in = null;
|
wneuper@4828
|
1081 |
/*PIDE*/XML.Tree xml_out = null;
|
wneuper@4797
|
1082 |
|
wneuper@4828
|
1083 |
/*PIDE*/if (iteratorID == 1) {
|
wneuper@4828
|
1084 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveActiveLevelDown " + sml_id + "" + ";");
|
wneuper@4828
|
1085 |
/*PIDE*/xml_in = JavaToIsa.move_active_levdown(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
1086 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1087 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ACTIVE_LEVDN, xml_in);
|
wneuper@4770
|
1088 |
|
wneuper@4828
|
1089 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1090 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1091 |
/*PIDE*/ java_out = IsaToJava.move_active_levdown_out(xml_out);
|
wneuper@4828
|
1092 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1093 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1094 |
/*PIDE*/} else
|
wneuper@4842
|
1095 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4797
|
1096 |
|
wneuper@4828
|
1097 |
/*PIDE*/} else {
|
wneuper@4797
|
1098 |
|
wneuper@4828
|
1099 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveLevelDown " + sml_id + " " + " " + p.toSMLString() + ";");
|
wneuper@4828
|
1100 |
/*PIDE*/xml_in = JavaToIsa.move_levdn(new scala.math.BigInt(BigInteger.valueOf(sml_id)), p);
|
wneuper@4828
|
1101 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1102 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_LEVDN, xml_in);
|
wneuper@4797
|
1103 |
|
wneuper@4828
|
1104 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1105 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1106 |
/*PIDE*/ java_out = IsaToJava.move_levdn_out(xml_out);
|
wneuper@4828
|
1107 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1108 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1109 |
/*PIDE*/} else
|
wneuper@4842
|
1110 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4828
|
1111 |
/*PIDE*/}
|
wneuper@4812
|
1112 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1113 |
return return_val;
|
wneuper@4762
|
1114 |
}
|
wneuper@4762
|
1115 |
|
wneuper@4762
|
1116 |
/** MATH_ENGINE: val moveActiveLevelUp : calcID -> XML.tree */
|
wneuper@4762
|
1117 |
public Position moveLevelUp(int javaCalcID, int iteratorID, Position p) {
|
wneuper@4763
|
1118 |
Position return_val = null;
|
wneuper@4812
|
1119 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1120 |
//*TTY*/ResponseWrapper wrapper = null;
|
wneuper@4828
|
1121 |
//*TTY*/if (iteratorID == 1)
|
wneuper@4828
|
1122 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveActiveLevelUp @calcid@" + ";", false);
|
wneuper@4828
|
1123 |
//*TTY*/else
|
wneuper@4828
|
1124 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveLevelUp @calcid@ " + p.toSMLString() + ";", false);
|
wneuper@4828
|
1125 |
//*TTY*/return_val = moveSuccess(wrapper);
|
wneuper@4812
|
1126 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1127 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
1128 |
/*PIDE*/XML.Tree xml_in = null;
|
wneuper@4828
|
1129 |
/*PIDE*/XML.Tree xml_out = null;
|
wneuper@4797
|
1130 |
|
wneuper@4828
|
1131 |
/*PIDE*/if (iteratorID == 1) {
|
wneuper@4828
|
1132 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveActiveLevelUp " + sml_id + "" + ";");
|
wneuper@4828
|
1133 |
/*PIDE*/xml_in = JavaToIsa.move_active_levup(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
1134 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1135 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ACTIVE_LEVUP, xml_in);
|
wneuper@4848
|
1136 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ACTIVE_FORM, xml_in);
|
wneuper@4770
|
1137 |
|
wneuper@4828
|
1138 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1139 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1140 |
/*PIDE*/ java_out = IsaToJava.move_active_levup_out(xml_out);
|
wneuper@4828
|
1141 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1142 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1143 |
/*PIDE*/} else
|
wneuper@4842
|
1144 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4797
|
1145 |
|
wneuper@4828
|
1146 |
/*PIDE*/} else {
|
wneuper@4797
|
1147 |
|
wneuper@4828
|
1148 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveLevelUp " + sml_id + " " + p.toSMLString() + ";");
|
wneuper@4828
|
1149 |
/*PIDE*/xml_in = JavaToIsa.move_levup(new scala.math.BigInt(BigInteger.valueOf(sml_id)), p);
|
wneuper@4828
|
1150 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1151 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_LEVUP, xml_in);
|
wneuper@4770
|
1152 |
|
wneuper@4828
|
1153 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1154 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1155 |
/*PIDE*/ java_out = IsaToJava.move_levup_out(xml_out);
|
wneuper@4828
|
1156 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1157 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1158 |
/*PIDE*/} else
|
wneuper@4842
|
1159 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4828
|
1160 |
/*PIDE*/}
|
wneuper@4812
|
1161 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1162 |
return return_val;
|
wneuper@4762
|
1163 |
}
|
wneuper@4762
|
1164 |
|
wneuper@4762
|
1165 |
/** MATH_ENGINE: val moveActiveRoot : calcID -> XML.tree */
|
wneuper@4762
|
1166 |
public Position moveRoot(int javaCalcID, int iteratorID) {
|
wneuper@4762
|
1167 |
if (logger.isDebugEnabled())
|
wneuper@4762
|
1168 |
logger.debug("moveRoot: javaCalcID=" + javaCalcID);
|
wneuper@4763
|
1169 |
Position return_val = null;
|
wneuper@4812
|
1170 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1171 |
//*TTY*/ResponseWrapper wrapper = null;
|
wneuper@4828
|
1172 |
//*TTY*/if (iteratorID == 1)
|
wneuper@4828
|
1173 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveActiveRoot @calcid@" + ";", false);
|
wneuper@4828
|
1174 |
//*TTY*/else
|
wneuper@4828
|
1175 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveRoot @calcid@ " + ";", false);
|
wneuper@4828
|
1176 |
//*TTY*/return_val = moveSuccess(wrapper);
|
wneuper@4812
|
1177 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1178 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
1179 |
/*PIDE*/scala.math.BigInt xml_in = null;
|
wneuper@4828
|
1180 |
/*PIDE*/XML.Tree xml_out = null;
|
wneuper@4797
|
1181 |
|
wneuper@4828
|
1182 |
/*PIDE*/if (iteratorID == 1) {
|
wneuper@4828
|
1183 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveActiveRoot " + sml_id + "" + ";");
|
wneuper@4828
|
1184 |
/*PIDE*/xml_in = new scala.math.BigInt(BigInteger.valueOf(sml_id));
|
wneuper@4828
|
1185 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1186 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ACTIVE_ROOT, xml_in);
|
wneuper@4770
|
1187 |
|
wneuper@4828
|
1188 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1189 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1190 |
/*PIDE*/ java_out = IsaToJava.move_active_root_out(xml_out);
|
wneuper@4828
|
1191 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1192 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1193 |
/*PIDE*/} else
|
wneuper@4842
|
1194 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4797
|
1195 |
|
wneuper@4828
|
1196 |
/*PIDE*/} else {
|
wneuper@4797
|
1197 |
|
wneuper@4828
|
1198 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveRoot " + sml_id + " " + ";");
|
wneuper@4828
|
1199 |
/*PIDE*/XML.Tree xml_in2 = JavaToIsa.move_root(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
1200 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in2);
|
wneuper@4848
|
1201 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ROOT, xml_in2);
|
wneuper@4770
|
1202 |
|
wneuper@4828
|
1203 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1204 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1205 |
/*PIDE*/ java_out = IsaToJava.move_root_out(xml_out);
|
wneuper@4828
|
1206 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1207 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1208 |
/*PIDE*/} else
|
wneuper@4842
|
1209 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4828
|
1210 |
/*PIDE*/}
|
wneuper@4812
|
1211 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1212 |
return return_val;
|
wneuper@4762
|
1213 |
}
|
wneuper@4762
|
1214 |
|
wneuper@4762
|
1215 |
/** MATH_ENGINE: val moveActiveRootTEST : calcID -> XML.tree
|
wneuper@4762
|
1216 |
* used only internally in Math_Engine */
|
wneuper@4762
|
1217 |
|
wneuper@4762
|
1218 |
/** MATH_ENGINE: val moveActiveUp : calcID -> XML.tree */
|
wneuper@4762
|
1219 |
public Position moveUp(int javaCalcID, int iteratorID, Position p) {
|
wneuper@4763
|
1220 |
Position return_val = null;
|
wneuper@4812
|
1221 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1222 |
//*TTY*/ResponseWrapper wrapper = null;
|
wneuper@4828
|
1223 |
//*TTY*/if (iteratorID == 1)
|
wneuper@4828
|
1224 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveActiveUp @calcid@" + ";", false);
|
wneuper@4828
|
1225 |
//*TTY*/else
|
wneuper@4828
|
1226 |
//*TTY*/ wrapper = interpretSML(javaCalcID, "moveUp @calcid@ " + p.toSMLString() + ";", false);
|
wneuper@4828
|
1227 |
//*TTY*/return_val = moveSuccess(wrapper);
|
wneuper@4812
|
1228 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1229 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
1230 |
/*PIDE*/XML.Tree xml_in = null;
|
wneuper@4828
|
1231 |
/*PIDE*/XML.Tree xml_out = null;
|
wneuper@4797
|
1232 |
|
wneuper@4828
|
1233 |
/*PIDE*/if (iteratorID == 1) {
|
wneuper@4828
|
1234 |
/*PIDE*/xml_in = JavaToIsa.move_active_up(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
1235 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1236 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_ACTIVE_UP, xml_in);
|
wneuper@4770
|
1237 |
|
wneuper@4828
|
1238 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1239 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1240 |
/*PIDE*/ java_out = IsaToJava.move_active_calchead_out(xml_out);
|
wneuper@4828
|
1241 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1242 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1243 |
/*PIDE*/} else
|
wneuper@4842
|
1244 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4797
|
1245 |
|
wneuper@4828
|
1246 |
/*PIDE*/} else {
|
wneuper@4797
|
1247 |
|
wneuper@4828
|
1248 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "moveUp " + sml_id + " " + p.toSMLString() + ";");
|
wneuper@4828
|
1249 |
/*PIDE*/xml_in = JavaToIsa.move_up(new scala.math.BigInt(BigInteger.valueOf(sml_id)), p);
|
wneuper@4828
|
1250 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1251 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.MOVE_UP, xml_in);
|
wneuper@4770
|
1252 |
|
wneuper@4828
|
1253 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1254 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1255 |
/*PIDE*/ java_out = IsaToJava.move_calchead_out(xml_out);
|
wneuper@4828
|
1256 |
/*PIDE*/ return_val = java_out.getPosition();
|
wneuper@4828
|
1257 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1258 |
/*PIDE*/} else
|
wneuper@4842
|
1259 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4828
|
1260 |
/*PIDE*/}
|
wneuper@4812
|
1261 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1262 |
return return_val;
|
wneuper@4762
|
1263 |
}
|
wneuper@4762
|
1264 |
|
wneuper@4796
|
1265 |
// /----- these methods are designed for a visitor of the CalcTree ------------\
|
wneuper@4796
|
1266 |
// (with a iteratorID > 1), e.g. a teacher watching the student.
|
wneuper@4762
|
1267 |
/** MATH_ENGINE: val moveCalcHead : calcID -> pos' -> XML.tree
|
wneuper@4770
|
1268 |
* does not exist in isac-java, see val moveActiveCalcHead */
|
wneuper@4762
|
1269 |
|
wneuper@4762
|
1270 |
/** MATH_ENGINE: val moveDown : calcID -> pos' -> XML.tree
|
wneuper@4770
|
1271 |
* does not exist in isac-java, see val moveActiveDown */
|
wneuper@4762
|
1272 |
|
wneuper@4762
|
1273 |
/** MATH_ENGINE: val val moveLevelDown : calcID -> pos' -> XML.tree
|
wneuper@4770
|
1274 |
* does not exist in isac-java, see val moveActiveLevelDown */
|
wneuper@4762
|
1275 |
|
wneuper@4762
|
1276 |
/** MATH_ENGINE: val moveLevelUp : calcID -> pos' -> XML.tree
|
wneuper@4770
|
1277 |
* does not exist in isac-java, see val moveActiveLevelUp */
|
wneuper@4762
|
1278 |
|
wneuper@4762
|
1279 |
/** MATH_ENGINE: val moveRoot : calcID -> XML.tree
|
wneuper@4770
|
1280 |
* does not exist in isac-java, see val moveActiveRoot */
|
wneuper@4762
|
1281 |
|
wneuper@4762
|
1282 |
/** MATH_ENGINE: val moveUp : calcID -> pos' -> XML.tree
|
wneuper@4770
|
1283 |
* does not exist in isac-java, see val moveActiveUp */
|
wneuper@4796
|
1284 |
// \----- these methods are designed for a visitor of the CalcTree ------------/
|
wneuper@4762
|
1285 |
|
wneuper@4762
|
1286 |
/**
|
wneuper@4762
|
1287 |
* @see isac.bridge.IBridgeRMI#getElement(int, int)
|
wneuper@4762
|
1288 |
* MATH_ENGINE: val refFormula : calcID -> pos' -> XML.tree
|
wneuper@4762
|
1289 |
*/
|
wneuper@4762
|
1290 |
public ICalcElement getElement(int javaCalcID, Position p) {
|
wneuper@4762
|
1291 |
ICalcElement return_val = null;
|
wneuper@4812
|
1292 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1293 |
//*TTY*/ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4828
|
1294 |
//*TTY*/ "(*getElement*)refFormula @calcid@ " + p.toSMLString() + ";", false);
|
wneuper@4828
|
1295 |
//*TTY*/if (wrapper == null) return_val = null;
|
wneuper@4828
|
1296 |
//*TTY*/return_val = (ICalcElement) wrapper.getResponse();
|
wneuper@4812
|
1297 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1298 |
/*PIDE*/int sml_calcid = ((Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID))).intValue();
|
wneuper@4828
|
1299 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*getElement*)refFormula " + sml_calcid
|
wneuper@4828
|
1300 |
/*PIDE*/ + " " + p.toSMLString() + ";");
|
wneuper@4770
|
1301 |
|
wneuper@4828
|
1302 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.ref_formula(new scala.math.BigInt(BigInteger.valueOf(sml_calcid)), p);
|
wneuper@4828
|
1303 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1304 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.REF_FORMULA, xml_in);
|
wneuper@4794
|
1305 |
|
wneuper@4828
|
1306 |
/*PIDE*/IntFormHead java_out = null;
|
wneuper@4828
|
1307 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1308 |
/*PIDE*/ java_out = IsaToJava.ref_formula_out(xml_out);
|
wneuper@4828
|
1309 |
/*PIDE*/ return_val = (ICalcElement)java_out.getFormHead();
|
wneuper@4828
|
1310 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1311 |
/*PIDE*/} else
|
wneuper@4842
|
1312 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4762
|
1313 |
/*---------------------------------------------------------------------------*/
|
wneuper@4762
|
1314 |
return return_val;
|
wneuper@4762
|
1315 |
}
|
wneuper@4770
|
1316 |
|
wneuper@4802
|
1317 |
/** MATH_ENGINE: val refineProblem : calcID -> pos' -> guh -> XML.tree
|
wneuper@4802
|
1318 |
* see notes WN150824 */
|
wneuper@4770
|
1319 |
public Context refineProblem(int javaCalcID, Context context, Position pos) throws RemoteException {
|
wneuper@4763
|
1320 |
Context return_val = null;
|
wneuper@4812
|
1321 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1322 |
//*TTY*/ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4828
|
1323 |
//*TTY*/ "refineProblem @calcid@ " + pos.toSMLString() + " \"" + context.getKEStoreKey().toString() + "\";", false);
|
wneuper@4828
|
1324 |
//*TTY*/if(wrapper == null) return null;
|
wneuper@4828
|
1325 |
//*TTY*/return_val = (Context) wrapper.getResponse();
|
wneuper@4812
|
1326 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1327 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
1328 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "refineProblem " + sml_id + " " + pos.toSMLString() + " \"" + context.getKEStoreKey().toString() + "\";");
|
wneuper@4784
|
1329 |
|
wneuper@4828
|
1330 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.refine_pbl(new scala.math.BigInt(BigInteger.valueOf(sml_id)),
|
wneuper@4828
|
1331 |
/*PIDE*/ pos, context.getKEStoreKey().toString() + "\"");
|
wneuper@4828
|
1332 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1333 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.REFINE_PBL, xml_in);
|
wneuper@4770
|
1334 |
|
wneuper@4828
|
1335 |
/*PIDE*/IntContext java_out = null;
|
wneuper@4828
|
1336 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1337 |
/*PIDE*/ java_out = IsaToJava.refine_pbl_out(xml_out);
|
wneuper@4828
|
1338 |
/*PIDE*/ return_val = java_out.getContext();
|
wneuper@4828
|
1339 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1340 |
/*PIDE*/} else
|
wneuper@4842
|
1341 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
1342 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1343 |
return return_val;
|
wneuper@4762
|
1344 |
}
|
wneuper@4762
|
1345 |
|
wneuper@4762
|
1346 |
/** MATH_ENGINE: val replaceFormula : calcID -> cterm' -> XML.tree */
|
wneuper@4762
|
1347 |
public CEvent replaceFormula(int id, CalcFormula f) {
|
wneuper@4763
|
1348 |
CEvent return_val = null;
|
wneuper@4812
|
1349 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1350 |
//*TTY*/ResponseWrapper wrapper = null;
|
wneuper@4828
|
1351 |
//*TTY*/wrapper = interpretSML(id, "replaceFormula @calcid@ \"" + f.toSMLString() + "\";", false);
|
wneuper@4828
|
1352 |
//*TTY*/if (wrapper == null) return_val = null;
|
wneuper@4828
|
1353 |
//*TTY*/else return_val = (CEvent) wrapper.getResponse();
|
wneuper@4812
|
1354 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1355 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(id));
|
wneuper@4828
|
1356 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "replaceFormula " + sml_id + " \"" + f.toSMLString() + "\";");
|
wneuper@4764
|
1357 |
|
wneuper@4828
|
1358 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.replace_form(new scala.math.BigInt(BigInteger.valueOf(sml_id)), f.getFormula());
|
wneuper@4828
|
1359 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1360 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.REPLACE_FORM, xml_in);
|
wneuper@4770
|
1361 |
|
wneuper@4828
|
1362 |
/*PIDE*/IntCEvent java_out = null;
|
wneuper@4828
|
1363 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1364 |
/*PIDE*/ java_out = IsaToJava.replace_form_out(xml_out);
|
wneuper@4828
|
1365 |
/*PIDE*/ return_val = java_out.getCEvent();
|
wneuper@4828
|
1366 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1367 |
/*PIDE*/} else
|
wneuper@4842
|
1368 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
1369 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1370 |
return return_val;
|
wneuper@4762
|
1371 |
}
|
wneuper@4762
|
1372 |
|
wneuper@4762
|
1373 |
/** MATH_ENGINE: val requestFillformula : calcID -> errpatID * fillpatID -> XML.tree
|
wneuper@4762
|
1374 |
* only implemented in Math_Engine */
|
wneuper@4762
|
1375 |
|
wneuper@4762
|
1376 |
/** MATH_ENGINE: val resetCalcHead : calcID -> XML.tree */
|
wneuper@4762
|
1377 |
/**
|
wneuper@4762
|
1378 |
* @see isac.interfaces.IToCalc#resetCalcHead()
|
wneuper@4762
|
1379 |
*/
|
wneuper@4762
|
1380 |
public CalcHead resetCalcHead(int calc_tree_id) throws RemoteException {
|
wneuper@4763
|
1381 |
CalcHead return_val = null;
|
wneuper@4812
|
1382 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1383 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calc_tree_id, "resetCalcHead @calcid@;", false);
|
wneuper@4828
|
1384 |
//*TTY*/return_val = (CalcHead) wrapper.getResponse();
|
wneuper@4812
|
1385 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1386 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calc_tree_id));
|
wneuper@4828
|
1387 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "resetCalcHead " + sml_id + ";");
|
wneuper@4764
|
1388 |
|
wneuper@4828
|
1389 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.reset_calchead(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
1390 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1391 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.RESET_CALCHEAD, xml_in);
|
wneuper@4770
|
1392 |
|
wneuper@4828
|
1393 |
/*PIDE*/IntCalcHead java_out = null;
|
wneuper@4828
|
1394 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1395 |
/*PIDE*/ java_out = IsaToJava.reset_calchead_out(xml_out);
|
wneuper@4828
|
1396 |
/*PIDE*/ return_val = java_out.getCalcHead();
|
wneuper@4828
|
1397 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1398 |
/*PIDE*/} else
|
wneuper@4842
|
1399 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
1400 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1401 |
return return_val;
|
wneuper@4762
|
1402 |
}
|
wneuper@4762
|
1403 |
|
wneuper@4762
|
1404 |
/** MATH_ENGINE: val setContext : calcID -> pos' -> guh -> XML.tree */
|
wneuper@4803
|
1405 |
/* The status of this method is unclear:
|
wneuper@4803
|
1406 |
*
|
wneuper@4803
|
1407 |
** There is no use-case and no test
|
wneuper@4803
|
1408 |
** The code is NOT used when showing the contexts
|
wneuper@4803
|
1409 |
* of thy, pbl, met, exp for example Biegelinie.
|
wneuper@4803
|
1410 |
** The code is not deleted, nevertheless, because there is
|
wneuper@4803
|
1411 |
* code in isabisac: interface#setContext
|
wneuper@4803
|
1412 |
*
|
wneuper@4803
|
1413 |
* So the changes for "isabelle tty" --> libisabelle adapt to the XML
|
wneuper@4803
|
1414 |
* sent from isabisac interface#setContext > autocalculateOK2xml.
|
wneuper@4803
|
1415 |
*/
|
wneuper@4803
|
1416 |
public CChanged setContext(int javaCalcID, ContextTheory context, Position pos ) throws RemoteException {
|
wneuper@4803
|
1417 |
CChanged return_val = null;
|
wneuper@4812
|
1418 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1419 |
//*TTY*/ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4828
|
1420 |
//*TTY*/ "setContext @calcid@ " + pos.toSMLString() + " \"" + context.getKEStoreKey().toString() + "\";", false);
|
wneuper@4828
|
1421 |
//*TTY*/if(wrapper == null) return_val = null;
|
wneuper@4828
|
1422 |
//*TTY*/else return_val = (CChanged) wrapper.getResponse();
|
wneuper@4812
|
1423 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1424 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(javaCalcID));
|
wneuper@4828
|
1425 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "setContext " + sml_id + " " + pos.toSMLString() + " \"" + context.getKEStoreKey().toString() + "\";");
|
wneuper@4764
|
1426 |
|
wneuper@4828
|
1427 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.set_ctxt(new scala.math.BigInt(BigInteger.valueOf(sml_id)),
|
wneuper@4828
|
1428 |
/*PIDE*/ pos, context.getKEStoreKey().toString() + "\"");
|
wneuper@4828
|
1429 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1430 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.SET_CTXT, xml_in);
|
wneuper@4770
|
1431 |
|
wneuper@4828
|
1432 |
/*PIDE*/IntCEvent java_out = null;
|
wneuper@4828
|
1433 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1434 |
/*PIDE*/ java_out = IsaToJava.set_ctxt_out(xml_out);
|
wneuper@4828
|
1435 |
/*PIDE*/ return_val = (CChanged) java_out.getCEvent();
|
wneuper@4828
|
1436 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1437 |
/*PIDE*/} else
|
wneuper@4842
|
1438 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
1439 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1440 |
return return_val;
|
wneuper@4762
|
1441 |
}
|
wneuper@4762
|
1442 |
|
wneuper@4762
|
1443 |
/**
|
wneuper@4762
|
1444 |
* @see isac.interfaces.IToCalc#setMethod()
|
wneuper@4762
|
1445 |
*
|
wneuper@4762
|
1446 |
* MATH_ENGINE: val setMethod : calcID -> metID -> XML.tree
|
wneuper@4762
|
1447 |
*/
|
wneuper@4762
|
1448 |
public CalcHead setMethod(int calc_tree_id, MethodID id) throws RemoteException {
|
wneuper@4763
|
1449 |
CalcHead return_val = null;
|
wneuper@4812
|
1450 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1451 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1452 |
//*TTY*/ "setMethod @calcid@ " + id.toSMLString() + ";", false);
|
wneuper@4828
|
1453 |
//*TTY*/return_val = (CalcHead) wrapper.getResponse();
|
wneuper@4812
|
1454 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1455 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calc_tree_id));
|
wneuper@4828
|
1456 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "setMethod " + sml_id + " " + id.toSMLString() + ";");
|
wneuper@4764
|
1457 |
|
wneuper@4828
|
1458 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.set_met(new scala.math.BigInt(BigInteger.valueOf(sml_id)), id.getID());
|
wneuper@4828
|
1459 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1460 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.SET_MET, xml_in);
|
wneuper@4770
|
1461 |
|
wneuper@4828
|
1462 |
/*PIDE*/IntCalcHead java_out = null;
|
wneuper@4828
|
1463 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1464 |
/*PIDE*/ java_out = IsaToJava.set_met_out(xml_out);
|
wneuper@4828
|
1465 |
/*PIDE*/ return_val = java_out.getCalcHead();
|
wneuper@4828
|
1466 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1467 |
/*PIDE*/} else
|
wneuper@4842
|
1468 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
1469 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1470 |
return return_val;
|
wneuper@4762
|
1471 |
}
|
wneuper@4762
|
1472 |
|
wneuper@4762
|
1473 |
/** MATH_ENGINE: val setNextTactic : calcID -> tac -> XML.tree */
|
wneuper@4762
|
1474 |
public int setNextTactic(int id, Tactic tactic) {
|
wneuper@4814
|
1475 |
int return_val = 4711;
|
wneuper@4812
|
1476 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1477 |
//*TTY*/ResponseWrapper wrapper = interpretSML(id,
|
wneuper@4828
|
1478 |
//*TTY*/ "setNextTactic @calcid@ (" + tactic.toSMLString() + ");", false);
|
wneuper@4828
|
1479 |
//*TTY*/if (wrapper == null) return_val = -1;//WN050223 response ... MESSAGE not parsed
|
wneuper@4828
|
1480 |
//*TTY*/if (wrapper.getResponse() == null) { return_val = 0; //Everything is ok
|
wneuper@4828
|
1481 |
//*TTY*/} else { return_val = -1; } //An Error occcured
|
wneuper@4812
|
1482 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1483 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(id));
|
wneuper@4828
|
1484 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "setNextTactic " + sml_id + " (" + tactic.toSMLString() + ");");
|
wneuper@4780
|
1485 |
|
wneuper@4828
|
1486 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.set_next_tac(new scala.math.BigInt(BigInteger.valueOf(sml_id)), tactic);
|
wneuper@4828
|
1487 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1488 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.SET_NEXT_TAC, xml_in);
|
wneuper@4806
|
1489 |
|
wneuper@4828
|
1490 |
/*PIDE*/if (!IsaToJava.is_syserror(xml_out)) {
|
a@4974
|
1491 |
IsaToJava.set_next_tac_out(xml_out);
|
wneuper@4828
|
1492 |
/*PIDE*/ return_val = 0; //Everything is ok
|
wneuper@4828
|
1493 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1494 |
/*PIDE*/} else {
|
wneuper@4842
|
1495 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_syserror: " + xml_out);
|
wneuper@4828
|
1496 |
/*PIDE*/}
|
wneuper@4812
|
1497 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1498 |
return return_val;
|
wneuper@4762
|
1499 |
}
|
wneuper@4762
|
1500 |
|
wneuper@4762
|
1501 |
/**
|
wneuper@4762
|
1502 |
* @see isac.interfaces.IToCalc#setProblem()
|
wneuper@4762
|
1503 |
*
|
wneuper@4762
|
1504 |
* MATH_ENGINE: val setProblem : calcID -> pblID -> XML.tree
|
wneuper@4762
|
1505 |
*/
|
wneuper@4762
|
1506 |
public CalcHead setProblem(int calc_tree_id, ProblemID id) throws RemoteException {
|
wneuper@4763
|
1507 |
CalcHead return_val = null;
|
wneuper@4812
|
1508 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1509 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1510 |
//*TTY*/ "setProblem @calcid@ " + id.toSMLString() + ";", false);
|
wneuper@4828
|
1511 |
//*TTY*/return_val = (CalcHead) wrapper.getResponse();
|
wneuper@4812
|
1512 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1513 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calc_tree_id));
|
wneuper@4828
|
1514 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "setProblem " + sml_id + " " + id.toSMLString() + ";");
|
wneuper@4764
|
1515 |
|
wneuper@4828
|
1516 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.set_met(new scala.math.BigInt(BigInteger.valueOf(sml_id)), id.getID());
|
wneuper@4828
|
1517 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1518 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.SET_PBL, xml_in);
|
wneuper@4784
|
1519 |
|
wneuper@4828
|
1520 |
/*PIDE*/IntCalcHead java_out = null;
|
wneuper@4828
|
1521 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1522 |
/*PIDE*/ java_out = IsaToJava.set_met_out(xml_out);
|
wneuper@4828
|
1523 |
/*PIDE*/ return_val = java_out.getCalcHead();
|
wneuper@4828
|
1524 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1525 |
/*PIDE*/} else
|
wneuper@4842
|
1526 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4812
|
1527 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1528 |
return return_val;
|
wneuper@2838
|
1529 |
}
|
wneuper@2838
|
1530 |
|
wneuper@2838
|
1531 |
/**
|
wneuper@2838
|
1532 |
* @see isac.interfaces.IToCalc#setTheory()
|
wneuper@4762
|
1533 |
*
|
wneuper@4762
|
1534 |
* TODO/WN150812: use implementation in Math_Engine.
|
wneuper@4762
|
1535 |
* MATH_ENGINE: val setTheory : calcID -> thyID -> XML.tree
|
wneuper@2838
|
1536 |
*/
|
wneuper@2838
|
1537 |
public CalcHead setTheory(int calc_tree_id, String thy_id)
|
wneuper@2838
|
1538 |
throws RemoteException {
|
wneuper@4763
|
1539 |
CalcHead return_val = null;
|
wneuper@4774
|
1540 |
Position pos = null;
|
wneuper@4812
|
1541 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1542 |
//*TTY*///---FIXXXME.WN050809 hack until setTheory pushed into SML-kernel
|
wneuper@4828
|
1543 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1544 |
//*TTY*/ "(*setTheory*)setNextTactic @calcid@ (Specify_Theory \"" + thy_id + "\");", false);
|
wneuper@4828
|
1545 |
//*TTY*/wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1546 |
//*TTY*/ "(*setTheory*)autoCalculate @calcid@ (Step 1);", false);
|
wneuper@4828
|
1547 |
//*TTY*///drop the CalcChanged returned by autoCalculate
|
wneuper@4828
|
1548 |
//*TTY*/wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1549 |
//*TTY*/ "(*setTheory*)getActiveFormula @calcid@ ;", false);
|
wneuper@4828
|
1550 |
//*TTY*/pos = moveSuccess(wrapper);
|
wneuper@4828
|
1551 |
//*TTY*/wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1552 |
//*TTY*/ "(*setTheory*)refFormula @calcid@ " + pos.toSMLString() + ";", false);
|
wneuper@4828
|
1553 |
//*TTY*/return_val = (CalcHead) wrapper.getResponse();
|
wneuper@4812
|
1554 |
//\---End hack
|
wneuper@4812
|
1555 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1556 |
//---FIXXXME.WN050809 hack until setTheory pushed into SML-kernel
|
wneuper@4828
|
1557 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calc_tree_id));
|
wneuper@4784
|
1558 |
|
wneuper@4828
|
1559 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*setTheory*)setNextTactic " + sml_id + " (Specify_Theory \"" + thy_id + "\");");
|
wneuper@4828
|
1560 |
/*PIDE*/SimpleTactic tac = new SimpleTactic("Specify_Theory", thy_id + "\"");
|
wneuper@4828
|
1561 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.set_next_tac(new scala.math.BigInt(BigInteger.valueOf(sml_id)), tac);
|
wneuper@4828
|
1562 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1563 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.SET_NEXT_TAC, xml_in);
|
wneuper@4828
|
1564 |
/*PIDE*/bridge_.log(1, "<--ISA: message not sent to Dialog ... " + xml_out);
|
wneuper@4771
|
1565 |
|
wneuper@4828
|
1566 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*setTheory*)autoCalculate " + sml_id + " (Step 1);");
|
wneuper@4828
|
1567 |
/*PIDE*/xml_in = JavaToIsa.auto_calculate(new scala.math.BigInt(BigInteger.valueOf(sml_id)),
|
wneuper@4828
|
1568 |
/*PIDE*/ "Step", new scala.math.BigInt(BigInteger.valueOf(1)));
|
wneuper@4828
|
1569 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1570 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.AUTO_CALC, xml_in);
|
wneuper@4828
|
1571 |
/*PIDE*/bridge_.log(1, "<--ISA: CalcChanged not sent to Dialog ... " + xml_out);
|
wneuper@4771
|
1572 |
|
wneuper@4828
|
1573 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*setTheory*)getActiveFormula " + sml_id + ";");
|
wneuper@4828
|
1574 |
/*PIDE*/xml_in = JavaToIsa.get_active_form(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4848
|
1575 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.GET_ACTIVE_FORM, xml_in);
|
wneuper@4828
|
1576 |
/*PIDE*/IntPosition java_out = null;
|
wneuper@4828
|
1577 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1578 |
/*PIDE*/ java_out = IsaToJava.get_active_form_out(xml_out);
|
wneuper@4828
|
1579 |
/*PIDE*/ pos = java_out.getPosition();
|
wneuper@4828
|
1580 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1581 |
/*PIDE*/} else
|
wneuper@4842
|
1582 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4800
|
1583 |
|
wneuper@4828
|
1584 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*setTheory*)refFormula " + sml_id + " " + pos.toSMLString() + ";");
|
wneuper@4828
|
1585 |
/*PIDE*/xml_in = JavaToIsa.ref_formula(new scala.math.BigInt(BigInteger.valueOf(sml_id)), pos);//^^pos.setKind("DUMMY")
|
wneuper@4828
|
1586 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1587 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.REF_FORMULA, xml_in);
|
wneuper@4771
|
1588 |
|
wneuper@4828
|
1589 |
/*PIDE*/IntFormHead java_out2 = null;
|
wneuper@4828
|
1590 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1591 |
/*PIDE*/ java_out2 = IsaToJava.ref_formula_out(xml_out);
|
wneuper@4828
|
1592 |
/*PIDE*/ return_val = (CalcHead)java_out2.getFormHead();
|
wneuper@4828
|
1593 |
/*PIDE*/bridge_.log(1, "<--ISA: " + xml_out);
|
wneuper@4828
|
1594 |
/*PIDE*/} else
|
wneuper@4842
|
1595 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4828
|
1596 |
/*PIDE*///\---End hack
|
wneuper@4812
|
1597 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1598 |
return return_val;
|
wneuper@2838
|
1599 |
}
|
wneuper@2838
|
1600 |
|
wneuper@4762
|
1601 |
/***********************************************************************
|
wneuper@4762
|
1602 |
* Below are methods not contained in MATH_ENGINE, rather
|
wneuper@4762
|
1603 |
* they composed from other methods in Math_Engine.
|
wneuper@2838
|
1604 |
*/
|
wneuper@2838
|
1605 |
|
wneuper@2838
|
1606 |
/**
|
wneuper@2838
|
1607 |
* @see isac.interfaces.IToCalc#completeCalcHead()
|
wneuper@2838
|
1608 |
*/
|
wneuper@2838
|
1609 |
public CalcHead completeCalcHead(int calc_tree_id) {
|
wneuper@4763
|
1610 |
CalcHead return_val = null;
|
wneuper@4775
|
1611 |
Position pos = null;
|
wneuper@4812
|
1612 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1613 |
//*TTY*///---FIXXXME.WN050809 hack until setTheory pushed into SML-kernel
|
wneuper@4828
|
1614 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1615 |
//*TTY*/ "(*completeCalcHead*)autoCalculate @calcid@ CompleteCalcHead;", false);
|
wneuper@4828
|
1616 |
//*TTY*///drop the CalcChanged returned by autoCalculate
|
wneuper@4828
|
1617 |
//*TTY*/wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1618 |
//*TTY*/ "(*completeCalcHead*)getActiveFormula @calcid@ ;", false);
|
wneuper@4828
|
1619 |
//*TTY*/pos = moveSuccess(wrapper);
|
wneuper@4828
|
1620 |
//*TTY*/wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1621 |
//*TTY*/ "(*completeCalcHead*)refFormula @calcid@ " + pos.toSMLString() + ";", false);
|
wneuper@4828
|
1622 |
//*TTY*/return_val = (CalcHead) wrapper.getResponse();
|
wneuper@4828
|
1623 |
//*TTY*///\---End hack
|
wneuper@4812
|
1624 |
/*---------------------------------------------------------------------------*/
|
wneuper@4812
|
1625 |
//---FIXXXME.WN050809 hack until setTheory pushed into SML-kernel
|
wneuper@4828
|
1626 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calc_tree_id));
|
wneuper@4784
|
1627 |
|
wneuper@4828
|
1628 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*completeCalcHead*)autoCalculate " + sml_id + "CompleteCalcHead;");
|
wneuper@4828
|
1629 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.auto_calculate(new scala.math.BigInt(BigInteger.valueOf(sml_id)),
|
wneuper@4828
|
1630 |
/*PIDE*/ "CompleteCalcHead", new scala.math.BigInt(BigInteger.valueOf(0)));
|
wneuper@4828
|
1631 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1632 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.AUTO_CALC, xml_in);
|
wneuper@4801
|
1633 |
|
wneuper@4828
|
1634 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
a@4974
|
1635 |
IsaToJava.auto_calc_out(xml_out);
|
wneuper@4828
|
1636 |
/*PIDE*/// return_val = java_out.getCEvent();
|
wneuper@4828
|
1637 |
/*PIDE*/bridge_.log(1, "<--ISA: not sent to Dialog ... " + xml_out);
|
wneuper@4828
|
1638 |
/*PIDE*/} else
|
wneuper@4842
|
1639 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4763
|
1640 |
|
wneuper@4801
|
1641 |
|
wneuper@4828
|
1642 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*completeCalcHead*)getActiveFormula " + sml_id + ";");
|
wneuper@4828
|
1643 |
/*PIDE*/xml_in = JavaToIsa.get_active_form(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
1644 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1645 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.GET_ACTIVE_FORM, xml_in);
|
wneuper@4801
|
1646 |
|
wneuper@4828
|
1647 |
/*PIDE*/IntPosition java_out2 = null;
|
wneuper@4828
|
1648 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1649 |
/*PIDE*/ java_out2 = IsaToJava.get_active_form_out(xml_out);
|
wneuper@4828
|
1650 |
/*PIDE*/ pos = java_out2.getPosition();
|
wneuper@4828
|
1651 |
/*PIDE*/bridge_.log(1, "<--ISA: used locally ... " + xml_out);
|
wneuper@4828
|
1652 |
/*PIDE*/} else
|
wneuper@4842
|
1653 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4801
|
1654 |
|
wneuper@4766
|
1655 |
|
wneuper@4828
|
1656 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*completeCalcHead*)refFormula " + sml_id + pos.toSMLString() + ";");
|
wneuper@4828
|
1657 |
/*PIDE*/xml_in = JavaToIsa.ref_formula(new scala.math.BigInt(BigInteger.valueOf(sml_id)), pos);
|
wneuper@4828
|
1658 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1659 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.REF_FORMULA, xml_in);
|
wneuper@4801
|
1660 |
|
wneuper@4828
|
1661 |
/*PIDE*/IntFormHead java_out3 = null;
|
wneuper@4828
|
1662 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1663 |
/*PIDE*/ java_out3 = IsaToJava.ref_formula_out(xml_out);
|
wneuper@4828
|
1664 |
/*PIDE*/ return_val = (CalcHead)java_out3.getFormHead();
|
wneuper@4828
|
1665 |
/*PIDE*/bridge_.log(1, "<--ISA: used locally ... " + xml_out);
|
wneuper@4828
|
1666 |
/*PIDE*/} else
|
wneuper@4842
|
1667 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4828
|
1668 |
/*PIDE*///\---End hack
|
wneuper@4812
|
1669 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1670 |
return return_val;
|
wneuper@2838
|
1671 |
}
|
wneuper@2838
|
1672 |
|
wneuper@2838
|
1673 |
/**
|
wneuper@4762
|
1674 |
* @see isac.interfaces.IToCalc#completeModel() WN050809 push this method
|
wneuper@4762
|
1675 |
* through to the SML-kernel
|
wneuper@2543
|
1676 |
*/
|
wneuper@4762
|
1677 |
public CalcHead completeModel(int calc_tree_id) throws RemoteException {
|
wneuper@4763
|
1678 |
CalcHead return_val = null;
|
wneuper@4778
|
1679 |
Position pos = null;
|
wneuper@4812
|
1680 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1681 |
//*TTY*///---FIXXXME.WN050809 hack until setTheory pushed into SML-kernel
|
wneuper@4828
|
1682 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1683 |
//*TTY*/ "(*completeModel*)autoCalculate @calcid@ CompleteModel;", false);
|
wneuper@4828
|
1684 |
//*TTY*///drop the CalcChanged returned by autoCalculate
|
wneuper@4828
|
1685 |
//*TTY*/wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1686 |
//*TTY*/ "(*completeModel*)getActiveFormula @calcid@ ;", false);
|
wneuper@4828
|
1687 |
//*TTY*/pos = moveSuccess(wrapper);
|
wneuper@4828
|
1688 |
//*TTY*/wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1689 |
//*TTY*/ "(*completeModel*)refFormula @calcid@ " + pos.toSMLString() + ";", false);
|
wneuper@4828
|
1690 |
//*TTY*/return_val = (CalcHead) wrapper.getResponse();
|
wneuper@4812
|
1691 |
//\---End hack
|
wneuper@4812
|
1692 |
/*---------------------------------------------------------------------------*/
|
wneuper@4812
|
1693 |
//---FIXXXME.WN050809 hack until setTheory pushed into SML-kernel
|
wneuper@4828
|
1694 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calc_tree_id));
|
wneuper@4784
|
1695 |
|
wneuper@4828
|
1696 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*completeModel*)autoCalculate " + sml_id + " CompleteModel;");
|
wneuper@4828
|
1697 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.auto_calculate(new scala.math.BigInt(BigInteger.valueOf(sml_id)),
|
wneuper@4828
|
1698 |
/*PIDE*/ "CompleteModel", new scala.math.BigInt(BigInteger.valueOf(0)));
|
wneuper@4828
|
1699 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1700 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.AUTO_CALC, xml_in);
|
wneuper@4801
|
1701 |
|
wneuper@4828
|
1702 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
a@4974
|
1703 |
IsaToJava.set_met_out(xml_out);
|
wneuper@4828
|
1704 |
/*PIDE*/bridge_.log(1, "<--ISA: not sent to Dialog = " + xml_out);
|
wneuper@4828
|
1705 |
/*PIDE*/} else
|
wneuper@4842
|
1706 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4801
|
1707 |
|
wneuper@4763
|
1708 |
|
wneuper@4828
|
1709 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*completeModel*)getActiveFormula " + sml_id + ";");
|
wneuper@4828
|
1710 |
/*PIDE*/xml_in = JavaToIsa.get_active_form(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4828
|
1711 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1712 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.GET_ACTIVE_FORM, xml_in);
|
wneuper@4801
|
1713 |
|
wneuper@4828
|
1714 |
/*PIDE*/IntPosition java_out2 = null;
|
wneuper@4828
|
1715 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1716 |
/*PIDE*/ java_out2 = IsaToJava.get_active_form_out(xml_out);
|
wneuper@4828
|
1717 |
/*PIDE*/ pos = java_out2.getPosition();
|
wneuper@4828
|
1718 |
/*PIDE*/bridge_.log(1, "<--ISA: used locally ... " + xml_out);
|
wneuper@4828
|
1719 |
/*PIDE*/} else
|
wneuper@4842
|
1720 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4801
|
1721 |
|
wneuper@4828
|
1722 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*completeModel*)refFormula " + sml_id + " " + pos.toSMLString() + ";");
|
wneuper@4828
|
1723 |
/*PIDE*/xml_in = JavaToIsa.ref_formula(new scala.math.BigInt(BigInteger.valueOf(sml_id)), pos);
|
wneuper@4828
|
1724 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1725 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.REF_FORMULA, xml_in);
|
wneuper@4801
|
1726 |
|
wneuper@4828
|
1727 |
/*PIDE*/IntFormHead java_out3 = null;
|
wneuper@4828
|
1728 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1729 |
/*PIDE*/ java_out3 = IsaToJava.ref_formula_out(xml_out);
|
wneuper@4828
|
1730 |
/*PIDE*/ return_val = (CalcHead)java_out3.getFormHead();
|
wneuper@4828
|
1731 |
/*PIDE*/bridge_.log(1, "<--ISA: used locally ... " + xml_out);
|
wneuper@4828
|
1732 |
/*PIDE*/} else
|
wneuper@4842
|
1733 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4828
|
1734 |
/*PIDE*///\---End hack
|
wneuper@4812
|
1735 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1736 |
return return_val;
|
wneuper@4762
|
1737 |
}
|
wneuper@4762
|
1738 |
|
wneuper@4762
|
1739 |
/**
|
wneuper@4762
|
1740 |
* @see isac.interfaces.IToCalc#nextSpecify() WN050809 push this method
|
wneuper@4762
|
1741 |
* through to the SML-kernel.
|
wneuper@4762
|
1742 |
*/
|
wneuper@4762
|
1743 |
public CalcHead nextSpecify(int calc_tree_id) throws RemoteException {
|
wneuper@4763
|
1744 |
CalcHead return_val = null;
|
wneuper@4778
|
1745 |
Position pos = null;
|
wneuper@4812
|
1746 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1747 |
//*TTY*///---FIXXXME.WN050809 hack until setTheory pushed into SML-kernel
|
wneuper@4828
|
1748 |
//*TTY*/ResponseWrapper wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1749 |
//*TTY*/ "(*nextSpecify*)autoCalculate @calcid@ (Step 1);", false);
|
wneuper@4828
|
1750 |
//*TTY*///drop the CalcChanged returned by autoCalculate
|
wneuper@4828
|
1751 |
//*TTY*/wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1752 |
//*TTY*/ "(*nextSpecify*)getActiveFormula @calcid@ ;", false);
|
wneuper@4828
|
1753 |
//*TTY*/pos = moveSuccess(wrapper);
|
wneuper@4828
|
1754 |
//*TTY*/wrapper = interpretSML(calc_tree_id,
|
wneuper@4828
|
1755 |
//*TTY*/ "(*nextSpecify*)refFormula @calcid@ " + pos.toSMLString() + ";", false);
|
wneuper@4828
|
1756 |
//*TTY*/return_val = (CalcHead) wrapper.getResponse();
|
wneuper@4828
|
1757 |
//*TTY*///\---End hack
|
wneuper@4812
|
1758 |
/*---------------------------------------------------------------------------*/
|
wneuper@4828
|
1759 |
/*PIDE*/int sml_id = (Integer) java_calcid_to_smlcalcid_.get(new Integer(calc_tree_id));
|
wneuper@4828
|
1760 |
/*PIDE*///---FIXXXME.WN050809 hack until setTheory pushed into SML-kernel
|
wneuper@4784
|
1761 |
|
wneuper@4828
|
1762 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*nextSpecify*)autoCalculate " + sml_id + " (Step 1);");
|
wneuper@4828
|
1763 |
/*PIDE*/XML.Tree xml_in = JavaToIsa.auto_calculate(new scala.math.BigInt(BigInteger.valueOf(sml_id)),
|
wneuper@4828
|
1764 |
/*PIDE*/ "Step", new scala.math.BigInt(BigInteger.valueOf(1)));
|
wneuper@4828
|
1765 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1766 |
/*PIDE*/XML.Tree xml_out = connection_to_kernel_.invoke(IsacOperations.AUTO_CALC, xml_in);
|
wneuper@4801
|
1767 |
|
wneuper@4828
|
1768 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
a@4974
|
1769 |
IsaToJava.set_met_out(xml_out);
|
wneuper@4828
|
1770 |
/*PIDE*/bridge_.log(1, "<--ISA: not sent to Dialog = " + xml_out);
|
wneuper@4828
|
1771 |
/*PIDE*/} else
|
wneuper@4842
|
1772 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4801
|
1773 |
|
wneuper@4766
|
1774 |
|
wneuper@4828
|
1775 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*nextSpecify*)getActiveFormula " + sml_id + ";");
|
wneuper@4828
|
1776 |
/*PIDE*/xml_in = JavaToIsa.get_active_form(new scala.math.BigInt(BigInteger.valueOf(sml_id)));
|
wneuper@4848
|
1777 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.GET_ACTIVE_FORM, xml_in);
|
wneuper@4801
|
1778 |
|
wneuper@4828
|
1779 |
/*PIDE*/IntPosition java_out2 = null;
|
wneuper@4828
|
1780 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1781 |
/*PIDE*/ java_out2 = IsaToJava.get_active_form_out(xml_out);
|
wneuper@4828
|
1782 |
/*PIDE*/ pos = java_out2.getPosition();
|
wneuper@4828
|
1783 |
/*PIDE*/bridge_.log(1, "<--ISA: used locally ... " + xml_out);
|
wneuper@4828
|
1784 |
/*PIDE*/} else
|
wneuper@4842
|
1785 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4801
|
1786 |
|
wneuper@4766
|
1787 |
|
wneuper@4828
|
1788 |
/*PIDE*/bridge_.log(1, "-->ISA: " + "(*nextSpecify*)refFormula " + sml_id + pos.toSMLString() + ";");
|
wneuper@4828
|
1789 |
/*PIDE*/xml_in = JavaToIsa.ref_formula(new scala.math.BigInt(BigInteger.valueOf(sml_id)), pos);//^^pos.setKind("DUMMY")
|
wneuper@4828
|
1790 |
/*PIDE*/bridge_.log(1, "-->ISA: " + xml_in);
|
wneuper@4848
|
1791 |
/*PIDE*/xml_out = connection_to_kernel_.invoke(IsacOperations.REF_FORMULA, xml_in);
|
wneuper@4801
|
1792 |
|
wneuper@4828
|
1793 |
/*PIDE*/IntFormHead java_out3 = null;
|
wneuper@4828
|
1794 |
/*PIDE*/if (!IsaToJava.is_message(xml_out)) {
|
wneuper@4828
|
1795 |
/*PIDE*/ java_out3 = IsaToJava.ref_formula_out(xml_out);
|
wneuper@4828
|
1796 |
/*PIDE*/ return_val = (CalcHead)java_out3.getFormHead();
|
wneuper@4828
|
1797 |
/*PIDE*/bridge_.log(1, "<--ISA: used locally ... " + xml_out);
|
wneuper@4828
|
1798 |
/*PIDE*/} else
|
wneuper@4842
|
1799 |
/*PIDE*/ bridge_.log(1, "<--ISA: IsaToJava.is_message: " + xml_out);
|
wneuper@4828
|
1800 |
/*PIDE*///\---End hack
|
wneuper@4812
|
1801 |
/*---------------------------------------------------------------------------*/
|
wneuper@4763
|
1802 |
return return_val;
|
mlang@2448
|
1803 |
}
|
rgradisc@1065
|
1804 |
|
wneuper@4762
|
1805 |
/***********************************************************************
|
wneuper@4762
|
1806 |
* Below are methods not implemented in MATH_ENGINE at all,
|
wneuper@4762
|
1807 |
* or only very fragmentarily.
|
wneuper@4762
|
1808 |
* WN150812 here are also methods, where the status is not clarified.
|
wneuper@4762
|
1809 |
* Some methods seem to be replaced by similar ones.
|
wneuper@4762
|
1810 |
* TODO: review IBridgeRMI, MathEngine, etc.
|
wneuper@4762
|
1811 |
*/
|
wneuper@4762
|
1812 |
|
wneuper@4762
|
1813 |
/**
|
wneuper@5047
|
1814 |
* <b>Do not use:</b><br></br> not impl. in Math_Engine
|
wneuper@4762
|
1815 |
* @see isac.interfaces.ICalcIterator#tryMatchMethod(MethodID)
|
wneuper@4762
|
1816 |
*/
|
wneuper@4762
|
1817 |
public Match initMatchMethod(int javaCalcID) throws RemoteException {
|
wneuper@4762
|
1818 |
ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4762
|
1819 |
"initMatchMethod @calcid@ ;", false);
|
wneuper@4762
|
1820 |
Object response = wrapper.getResponse();
|
wneuper@4762
|
1821 |
CalcHead ch = (CalcHead) response;
|
wneuper@4762
|
1822 |
Match m = new Match(ch.getSpecification().getProblem(), ch
|
wneuper@4762
|
1823 |
.getStatusString(), ch.getHeadLine(), ch.getModel());
|
wneuper@4762
|
1824 |
return m;
|
wneuper@4762
|
1825 |
}
|
wneuper@4762
|
1826 |
|
wneuper@4762
|
1827 |
/**
|
wneuper@5047
|
1828 |
* <b>Do not use:</b><br></br> not impl. in Math_Engine
|
wneuper@5047
|
1829 |
* @see isac.interfaces.ICalcIterator#tryMatchMethod(MethodID)
|
wneuper@4762
|
1830 |
*/
|
wneuper@4762
|
1831 |
public Match initMatchProblem(int javaCalcID) {
|
wneuper@4762
|
1832 |
ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4762
|
1833 |
"initMatchProblem @calcid@ ;", false);
|
wneuper@4762
|
1834 |
Object response = wrapper.getResponse();
|
wneuper@4762
|
1835 |
CalcHead ch = (CalcHead) response;
|
wneuper@4762
|
1836 |
Match m = new Match(ch.getSpecification().getProblem(), ch
|
wneuper@4762
|
1837 |
.getStatusString(), ch.getHeadLine(), ch.getModel());
|
wneuper@4762
|
1838 |
return m;
|
wneuper@4762
|
1839 |
}
|
rgradisc@1252
|
1840 |
|
wneuper@4762
|
1841 |
/**
|
wneuper@5047
|
1842 |
* <b>Do not use:</b><br></br> not impl. in Math_Engine
|
wneuper@4762
|
1843 |
* @see isac.interfaces.ICalcIterator#tryMatchMethod(MethodID)
|
mlang@2448
|
1844 |
*/
|
wneuper@4762
|
1845 |
public Match tryMatchMethod(int javaCalcID, MethodID keStoreID)
|
wneuper@4762
|
1846 |
throws RemoteException {
|
mlang@2448
|
1847 |
ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4762
|
1848 |
"tryMatchMethod @calcid@ " + keStoreID.toSMLString() + ";",
|
wneuper@4762
|
1849 |
false);
|
wneuper@4762
|
1850 |
Object response = wrapper.getResponse();
|
wneuper@4762
|
1851 |
CalcHead ch = (CalcHead) response;
|
wneuper@4762
|
1852 |
Match m = new Match(ch.getSpecification().getProblem(), ch
|
wneuper@4762
|
1853 |
.getStatusString(), ch.getHeadLine(), ch.getModel());
|
wneuper@4762
|
1854 |
return m;
|
mlang@2448
|
1855 |
}
|
rgradisc@1191
|
1856 |
|
wneuper@4763
|
1857 |
/** enforced by IBridgeRMI, WN150812: exp-, met-, pbl-, thy-contexts all work --
|
wneuper@4803
|
1858 |
* -- see: CChanged setContext(int, ContextTheory, ... */
|
wneuper@4762
|
1859 |
@Override
|
wneuper@4762
|
1860 |
public CalcHead setContext(int javaCalcID, ContextMethod context, Position pos) throws RemoteException {
|
wneuper@4762
|
1861 |
return null;
|
wneuper@4762
|
1862 |
}
|
rgradisc@1196
|
1863 |
|
wneuper@4763
|
1864 |
/** enforced by IBridgeRMI, WN150812: exp-, met-, pbl-, thy-contexts all work --
|
wneuper@4803
|
1865 |
* -- see: CChanged setContext(int, ContextTheory, ...
|
wneuper@4803
|
1866 |
* This method changed role with ^^^^^^^^^^^^^^^^ during "isabelle tty" --> libisabelle
|
wneuper@4803
|
1867 |
*/
|
wneuper@4762
|
1868 |
@Override
|
wneuper@4803
|
1869 |
public CalcHead setContext(int javaCalcID, ContextProblem context, Position pos) throws RemoteException {
|
wneuper@4762
|
1870 |
return null;
|
wneuper@4762
|
1871 |
}
|
wneuper@4762
|
1872 |
|
wneuper@4762
|
1873 |
/**
|
wneuper@4762
|
1874 |
* @see isac.interfaces.ICalcIterator#tryMatchProblem(HierarchyKey)
|
wneuper@4762
|
1875 |
*
|
wneuper@4762
|
1876 |
* WN150812: tryMatchProblem, trymatch only partially implemented in Math_Engine
|
wneuper@4762
|
1877 |
*/
|
wneuper@4762
|
1878 |
public Match tryMatchProblem(int javaCalcID, ProblemID problemID) {
|
wneuper@4762
|
1879 |
ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4762
|
1880 |
"tryMatchProblem @calcid@ " + problemID.toSMLString() + ";",
|
wneuper@4762
|
1881 |
false);
|
wneuper@4762
|
1882 |
Object response = wrapper.getResponse();
|
wneuper@4762
|
1883 |
CalcHead ch = (CalcHead) response;
|
wneuper@4762
|
1884 |
Match m = new Match(ch.getSpecification().getProblem(), ch
|
wneuper@4762
|
1885 |
.getStatusString(), ch.getHeadLine(), ch.getModel());
|
wneuper@4762
|
1886 |
return m;
|
mlang@2448
|
1887 |
}
|
wneuper@1875
|
1888 |
|
mlang@2448
|
1889 |
/**
|
wneuper@5047
|
1890 |
* <b>Do not use:</b><br></br> not impl. in Math_Engine
|
wneuper@4762
|
1891 |
* @see isac.interfaces.ICalcIterator#tryRefineProblem(HierarchyKey)
|
mlang@2448
|
1892 |
*/
|
wneuper@4762
|
1893 |
public Match tryRefineProblem(int javaCalcID, ProblemID problemID) {
|
wneuper@4762
|
1894 |
ResponseWrapper wrapper = interpretSML(javaCalcID,
|
wneuper@4762
|
1895 |
"tryRefineProblem @calcid@ " + problemID.toSMLString() + ";",
|
wneuper@4762
|
1896 |
false);
|
wneuper@4762
|
1897 |
Object response = wrapper.getResponse();
|
wneuper@4762
|
1898 |
CalcHead ch = (CalcHead) response;
|
wneuper@4762
|
1899 |
Match m = new Match(ch.getSpecification().getProblem(), ch
|
wneuper@4762
|
1900 |
.getStatusString(), ch.getHeadLine(), ch.getModel());
|
wneuper@4762
|
1901 |
return m;
|
mlang@2448
|
1902 |
}
|
wneuper@1976
|
1903 |
|
wneuper@4762
|
1904 |
/***********************************************************************
|
wneuper@4762
|
1905 |
* Below are methods for restoring Isabelle/Isac after a crash.
|
wneuper@4762
|
1906 |
* This never worked, is to be deleted and
|
wneuper@4762
|
1907 |
* to be reconsidered with introduction of libisabelle.
|
mlang@2448
|
1908 |
*/
|
wneuper@1976
|
1909 |
|
mlang@2448
|
1910 |
/**
|
mlang@2448
|
1911 |
* This method is used when the kernel crashes and the CalcTrees need to be
|
mlang@2448
|
1912 |
* entered again to the kernel to restore the previous state. The
|
mlang@2448
|
1913 |
* Java-CalcIDs stay the same
|
mlang@2448
|
1914 |
*/
|
mlang@2448
|
1915 |
public void restoreExistingCalcTrees() {
|
mlang@2448
|
1916 |
bridge_.log(1, "---- entering restoreExistingCalcTrees");
|
a@4984
|
1917 |
Iterator<?> it = java_calcid_to_smlcalcid_.keySet().iterator();
|
mlang@2448
|
1918 |
// keySet = javaCalcIDs
|
a@4974
|
1919 |
int javaCalcID;
|
a@4971
|
1920 |
Vector<String> v;
|
mlang@2448
|
1921 |
while (it.hasNext()) {
|
mlang@2448
|
1922 |
//bridge.log(1, "1");
|
mlang@2448
|
1923 |
//int i = ((Integer)it.next()).intValue();
|
mlang@2448
|
1924 |
javaCalcID = ((Integer) it.next()).intValue();
|
mlang@2448
|
1925 |
//bridge.log(1, "2");
|
mlang@2448
|
1926 |
v = saveCalcTree(javaCalcID);
|
mlang@2448
|
1927 |
//bridge.log(1, "3");
|
mlang@2448
|
1928 |
this.restoreToSML(javaCalcID, v);
|
mlang@2448
|
1929 |
}
|
mlang@2448
|
1930 |
bridge_.log(1, "---- done restoreExistingCalcTrees");
|
mlang@2448
|
1931 |
}
|
wneuper@1976
|
1932 |
|
a@5052
|
1933 |
private void restoreToSML(int javaCalcID, Vector<String> v) {
|
a@5052
|
1934 |
Iterator<String> it = new Vector<String>(v).iterator();
|
wneuper@4762
|
1935 |
String s = (String) it.next();
|
a@4984
|
1936 |
newCalculation(javaCalcID, s, null/*never worked*/, true);
|
wneuper@4762
|
1937 |
//javaCalcIDtoSmlCalcID.put(new Integer(javaCalcID), new
|
wneuper@4762
|
1938 |
// Integer(smlCalcID));
|
wneuper@4762
|
1939 |
//int smlID = ((Integer)javaCalcIDtoSmlCalcID.get(new
|
wneuper@4762
|
1940 |
// Integer(calcID))).intValue();
|
wneuper@4762
|
1941 |
while (it.hasNext()) {
|
wneuper@4762
|
1942 |
s = (String) it.next();
|
wneuper@4762
|
1943 |
interpretSML(javaCalcID, s, true);
|
wneuper@4762
|
1944 |
}
|
mlang@2448
|
1945 |
}
|
wneuper@1976
|
1946 |
|
mlang@2448
|
1947 |
/**
|
wneuper@4762
|
1948 |
* Save a calcTree for later restoring (probably to another SML Kernel)
|
wneuper@4762
|
1949 |
*
|
wneuper@4762
|
1950 |
* @param calcTreeID
|
wneuper@4762
|
1951 |
* the ID of the calcTree
|
wneuper@4762
|
1952 |
* @return a vector containing strings. This is representatation of the
|
wneuper@4762
|
1953 |
* status of the calcTree
|
mlang@2448
|
1954 |
*/
|
a@4971
|
1955 |
public Vector<String> saveCalcTree(int calcTreeID) {
|
wneuper@4762
|
1956 |
this.bridge_.log(1, "----------------begin saving calcTree "
|
wneuper@4762
|
1957 |
+ calcTreeID + "------------");
|
a@4971
|
1958 |
return (Vector<String>) inputs_.get(new Integer(calcTreeID));
|
mlang@2448
|
1959 |
}
|
wneuper@1976
|
1960 |
|
nsimic@3490
|
1961 |
|
walther@5239
|
1962 |
}
|