rgradisc@1311
|
1 |
/*
|
rgradisc@1311
|
2 |
* Created on Sep 19, 2003
|
rgradisc@1311
|
3 |
*/
|
rgradisc@1311
|
4 |
package isac.util.interfaces;
|
rgradisc@1311
|
5 |
|
wneuper@2100
|
6 |
import isac.util.formulae.Assumptions;
|
wneuper@2523
|
7 |
import isac.util.formulae.KEStoreID;
|
wneuper@2523
|
8 |
import isac.util.formulae.Match;
|
wneuper@1991
|
9 |
import isac.util.formulae.Position;
|
wneuper@2528
|
10 |
import isac.util.formulae.ProblemID;
|
wneuper@1866
|
11 |
import isac.util.tactics.Tactic;
|
wneuper@1866
|
12 |
|
akirchst@1871
|
13 |
import java.rmi.Remote;
|
akirchst@1871
|
14 |
import java.rmi.RemoteException;
|
wneuper@2106
|
15 |
import java.util.Vector;
|
rgradisc@1311
|
16 |
|
rgradisc@1311
|
17 |
/**
|
wneuper@1866
|
18 |
* References a certain position in a CalcTree.
|
mkoschuc@2311
|
19 |
*
|
wneuper@1991
|
20 |
* At such a Position there is (a) a Formula or a CalcHead (b) a Tactic which is
|
wneuper@1991
|
21 |
* applicable to this Formula (Apply_Method is the only Tactic applicable to a
|
wneuper@1991
|
22 |
* CalcHead) (c) an Assumption generated by application of this Tactic to this
|
wneuper@1991
|
23 |
* Formula
|
mkoschuc@2435
|
24 |
*
|
wneuper@1991
|
25 |
* Invariant: The Level changes at most +/- ONE when moveUp or moveDown.
|
wneuper@1866
|
26 |
*
|
wneuper@1991
|
27 |
* a CalcIterator may be invalid,
|
wneuper@1866
|
28 |
*
|
wneuper@1991
|
29 |
* @see isac.util.CalcChangedEvent#
|
wneuper@1991
|
30 |
*
|
wneuper@1991
|
31 |
* Comments for the Dialog Guide # on 'applicable Tactic': if a Formula is also
|
wneuper@1991
|
32 |
* a parent of some children (one LevelDown), there is also a 'DETAILED
|
wneuper@1991
|
33 |
* applicable Tactic' generating the children. WN040920 presentation unclear #
|
wneuper@1991
|
34 |
* on 'causal Tactic': this direction of investigation is opposite to the
|
wneuper@1991
|
35 |
* applicablility of Tactics; investigating in this direction, for each Formula
|
wneuper@1991
|
36 |
* the Tactic can befound which generated the Formula. The causal Tactic is
|
wneuper@1991
|
37 |
* unique for each Formula, with the exception of Positions with moveLevelUp
|
wneuper@1991
|
38 |
* (there is a 'DETAILED causal Tactic' analogously to 'DETAILED applicable
|
wneuper@1991
|
39 |
* Tactic' at LevelDown)
|
wneuper@1991
|
40 |
*
|
akremp@1338
|
41 |
* @see isac.util.formulae.CalcElement
|
akremp@1338
|
42 |
* @see isac.bridge.CalcTree
|
akremp@1338
|
43 |
* @author Alan Krempler
|
rgradisc@1311
|
44 |
*/
|
wneuper@1991
|
45 |
public interface ICalcIterator extends Comparable, Cloneable, Remote {
|
rgradisc@1311
|
46 |
|
wneuper@2305
|
47 |
/**
|
wneuper@2305
|
48 |
* get the marker 'Position' unique within a CalcTree (i.e. a CalcIterator)
|
wneuper@2305
|
49 |
*
|
wneuper@2305
|
50 |
* @return Position
|
wneuper@2305
|
51 |
*/
|
wneuper@2305
|
52 |
public Position getPosition() throws RemoteException;
|
wneuper@2106
|
53 |
|
wneuper@2305
|
54 |
/**
|
wneuper@2305
|
55 |
* Reference the first (root) element in the attached calculation tree.
|
wneuper@2305
|
56 |
*
|
wneuper@2305
|
57 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
58 |
* if there is no element to move to.
|
wneuper@2305
|
59 |
*/
|
wneuper@2305
|
60 |
public boolean moveRoot() throws RemoteException;
|
rgradisc@1311
|
61 |
|
wneuper@2305
|
62 |
/**
|
wneuper@2305
|
63 |
* Reference the next enclosing CalcHead element in the attached calculation
|
wneuper@2305
|
64 |
* tree. This will be the subproblem being solved at the moment, or, if not
|
wneuper@2305
|
65 |
* solving subproblems, the root problem of the calculation.
|
wneuper@2305
|
66 |
*
|
wneuper@2305
|
67 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
68 |
* if there is no element to move to.
|
wneuper@2305
|
69 |
*/
|
wneuper@2305
|
70 |
public boolean moveCalcHead() throws RemoteException;
|
wneuper@1991
|
71 |
|
wneuper@2305
|
72 |
/**
|
wneuper@2305
|
73 |
* Reference the previous formula in the attached calculation tree.
|
wneuper@2305
|
74 |
*
|
wneuper@2305
|
75 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
76 |
* if there is no element to move to.
|
wneuper@2305
|
77 |
*/
|
wneuper@2305
|
78 |
public boolean moveUp() throws RemoteException;
|
wneuper@1991
|
79 |
|
wneuper@2305
|
80 |
/**
|
wneuper@2305
|
81 |
* Reference the next formula in the attached calculation tree.
|
wneuper@2305
|
82 |
*
|
wneuper@2305
|
83 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
84 |
* if there is no element to move to.
|
wneuper@2305
|
85 |
*
|
wneuper@2305
|
86 |
* moveRoot() plus moveDown() reaches all nodes in a CalcTree
|
wneuper@2305
|
87 |
*/
|
wneuper@2305
|
88 |
public boolean moveDown() throws RemoteException;
|
wneuper@1991
|
89 |
|
wneuper@2305
|
90 |
/**
|
wneuper@2305
|
91 |
* Enter the next coarser level of refinement in the attached calculation
|
wneuper@2305
|
92 |
* tree.
|
wneuper@2305
|
93 |
*
|
wneuper@2305
|
94 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
95 |
* if there is no element to move to.
|
wneuper@2305
|
96 |
*/
|
wneuper@2305
|
97 |
public boolean moveLevelUp() throws RemoteException;
|
rgradisc@1311
|
98 |
|
wneuper@2305
|
99 |
/**
|
wneuper@2305
|
100 |
* Enter the next more detailed level of refinement in the attached
|
wneuper@2305
|
101 |
* calculation tree.
|
wneuper@2305
|
102 |
*
|
wneuper@2305
|
103 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
104 |
* if there is no element to move to.
|
wneuper@2305
|
105 |
*/
|
wneuper@2305
|
106 |
public boolean moveLevelDown() throws RemoteException;
|
rgradisc@1311
|
107 |
|
wneuper@2305
|
108 |
/**
|
wneuper@2305
|
109 |
* Reference the formula which resulted in the currently selected element of
|
wneuper@2305
|
110 |
* the attached calculation tree.
|
wneuper@2305
|
111 |
*/
|
wneuper@2305
|
112 |
public boolean moveFormula() throws RemoteException;
|
rgradisc@1311
|
113 |
|
wneuper@2305
|
114 |
/**
|
wneuper@2305
|
115 |
* Ask whether this is the last Item, which is equivalent to whwther there
|
wneuper@2305
|
116 |
* is another item where moveDown() could move to.
|
wneuper@2305
|
117 |
*
|
wneuper@2305
|
118 |
* @return true, if moveDown() would not yield any new elements false, if
|
wneuper@2305
|
119 |
* moveDown() would move to another element WN040819 awaiting
|
wneuper@2305
|
120 |
* problems with parallel branches (OR, AND, etc.) in calcTree
|
wneuper@2305
|
121 |
* @deprecated due to calcChangedEvent since 0512
|
wneuper@2305
|
122 |
*/
|
wneuper@2305
|
123 |
public boolean isLast() throws RemoteException;
|
wneuper@1991
|
124 |
|
wneuper@2305
|
125 |
/**
|
wneuper@2305
|
126 |
* is the Iterator on a CalcHead or not
|
wneuper@2305
|
127 |
*/
|
wneuper@2305
|
128 |
public boolean onCalcHead() throws RemoteException;
|
wneuper@2304
|
129 |
|
wneuper@2305
|
130 |
/**
|
wneuper@2305
|
131 |
* Use this to get the current element and check the type by calling
|
wneuper@2305
|
132 |
* getType().
|
wneuper@2305
|
133 |
*
|
wneuper@2305
|
134 |
* @return The currently referenced Element
|
wneuper@2305
|
135 |
* @see #getType()
|
wneuper@2522
|
136 |
*
|
wneuper@2522
|
137 |
* FIXXXME.WN050624 review calls when getFormula is deleted
|
wneuper@2305
|
138 |
*/
|
wneuper@2305
|
139 |
public ICalcElement getElement() throws RemoteException;
|
wneuper@1991
|
140 |
|
wneuper@2305
|
141 |
/**
|
wneuper@2528
|
142 |
* get the Formulae and CalcHeads of the calcTree between this.iterator
|
wneuper@2528
|
143 |
* ('from')and the argument iterator ('to'), excluding the 'from' and
|
wneuper@2528
|
144 |
* including 'to' iterator, i.e. the elements the iterators are pointing to
|
wneuper@2528
|
145 |
*
|
wneuper@2528
|
146 |
* @see isac.util.CalcChangedEvent.last_unchanged_formula_ which is to be
|
wneuper@2528
|
147 |
* set this.iterator, and
|
wneuper@2528
|
148 |
* @see isac.util.CalcChangedEvent.last_generated_formula_ which is to be
|
wneuper@2528
|
149 |
* set to iterator_to
|
wneuper@2528
|
150 |
*
|
wneuper@2528
|
151 |
* @param iterator_to
|
wneuper@2528
|
152 |
* The iterator pointing at the last element of the returned
|
wneuper@2528
|
153 |
* range
|
wneuper@2528
|
154 |
* @param level
|
wneuper@2528
|
155 |
* The maximum level of the elements in the range, element with a
|
wneuper@2528
|
156 |
* higher level (which are "deeper" in the hierarchie are not
|
wneuper@2528
|
157 |
* returned null if everything should be displayed
|
wneuper@2528
|
158 |
* @param result_includes_tactics
|
wneuper@2528
|
159 |
* true if the result should include the tactics, false otherwise
|
wneuper@2528
|
160 |
*
|
wneuper@2528
|
161 |
* @return an Vector containing the Formulae and CalcHeads of the calcTree
|
wneuper@2528
|
162 |
* @author Alois Kirchsteiger 12.01.2005 16:51:43
|
wneuper@2528
|
163 |
*/
|
wneuper@2528
|
164 |
public Vector getElementsFromTo(ICalcIterator iterator_to, Integer level,
|
wneuper@2528
|
165 |
boolean result_includes_tactics) throws RemoteException;
|
wneuper@2528
|
166 |
|
wneuper@2528
|
167 |
/**
|
wneuper@2305
|
168 |
* @return Formula, which may also be a CalcHead !
|
wneuper@2522
|
169 |
*
|
wneuper@2523
|
170 |
* @deprecated in favour if getElement FIXXXME.WN050624
|
wneuper@2305
|
171 |
*/
|
wneuper@1876
|
172 |
|
wneuper@2305
|
173 |
public ICalcElement getFormula() throws RemoteException;
|
rgradisc@1311
|
174 |
|
wneuper@2305
|
175 |
/**
|
wneuper@2305
|
176 |
* @return Tactic applicable to the formula under the Iterator
|
wneuper@2305
|
177 |
*/
|
wneuper@2305
|
178 |
public Tactic getTactic() throws RemoteException;
|
wneuper@1866
|
179 |
|
wneuper@2305
|
180 |
/**
|
wneuper@2305
|
181 |
* Get a list of tactics applicable to the active formula.
|
wneuper@2305
|
182 |
*
|
wneuper@2305
|
183 |
* @param scope
|
wneuper@2305
|
184 |
* WN0502 not yet impl. The filter parameter selects the scope of
|
wneuper@2305
|
185 |
* search for applicable tactics.
|
wneuper@2305
|
186 |
* @return Vector with applicable tactics
|
wneuper@2305
|
187 |
* @see #TACTICS_ALL
|
wneuper@2305
|
188 |
* @see #TACTICS_CURRENT_THEORY
|
wneuper@2305
|
189 |
* @see #TACTICS_CURRENT_METHOD
|
wneuper@2305
|
190 |
*/
|
wneuper@2305
|
191 |
public Vector getApplicableTactics(int scope) throws RemoteException;
|
wneuper@2106
|
192 |
|
wneuper@2305
|
193 |
/**
|
wneuper@2305
|
194 |
* @return Assumptions generated by the Tactic applied to the formula, both
|
wneuper@2305
|
195 |
* under the same Iterator
|
wneuper@2305
|
196 |
*/
|
wneuper@2305
|
197 |
public Assumptions getAssumptions() throws RemoteException;
|
wneuper@2106
|
198 |
|
wneuper@2305
|
199 |
/**
|
wneuper@2305
|
200 |
* @return Assumptions accumulated during calculation down to the formula
|
wneuper@2305
|
201 |
* under the Iterator ATTENTION: this returnvalue is also used by
|
wneuper@2305
|
202 |
* getAssumptions as long as getAccumulatedAssumptions does not
|
wneuper@2305
|
203 |
* include references to their _several_ sources -- i.e. change
|
wneuper@2305
|
204 |
* _this_ return, not that in getAssumptions !
|
wneuper@2305
|
205 |
*/
|
wneuper@2305
|
206 |
public Assumptions getAccumulatedAssumptions() throws RemoteException;
|
rgradisc@1311
|
207 |
|
wneuper@2305
|
208 |
/**
|
wneuper@2305
|
209 |
* The current level of nesting into subcalculations.
|
wneuper@2305
|
210 |
*
|
wneuper@2305
|
211 |
* @return An int representing level of nesting (higher == more detailed)
|
wneuper@2305
|
212 |
* <p>
|
wneuper@2305
|
213 |
* Special values:
|
wneuper@2305
|
214 |
* <p>
|
wneuper@2305
|
215 |
* 0: outmost level: only first and last step of calculation are on
|
wneuper@2305
|
216 |
* this level
|
wneuper@2305
|
217 |
*/
|
wneuper@2305
|
218 |
public int getLevel() throws RemoteException;
|
wneuper@1991
|
219 |
|
wneuper@2305
|
220 |
/**
|
wneuper@2305
|
221 |
* Create a copy of this Iterator: the clone will point to the same formula
|
wneuper@2305
|
222 |
* in the calcTree
|
wneuper@2305
|
223 |
*
|
wneuper@2305
|
224 |
* @return a cloned Iterator
|
wneuper@2305
|
225 |
*/
|
wneuper@2305
|
226 |
public Object clone();
|
wneuper@1991
|
227 |
|
wneuper@2305
|
228 |
/**
|
wneuper@2305
|
229 |
* for test-output
|
wneuper@2305
|
230 |
*
|
wneuper@2305
|
231 |
* @return 'position', i.e. unique identifier in a CalcTree
|
wneuper@2305
|
232 |
*/
|
wneuper@2305
|
233 |
public String toSMLString();
|
wneuper@1991
|
234 |
|
wneuper@2523
|
235 |
/**
|
wneuper@2523
|
236 |
* Match the problem referenced by ProblemID with the CalcHead at or just
|
wneuper@2523
|
237 |
* above the Position in the CalcTree this CalcIterator is pointing to.
|
wneuper@2523
|
238 |
*
|
wneuper@2523
|
239 |
* @param ProblemID
|
wneuper@2523
|
240 |
* or MethodID
|
wneuper@2523
|
241 |
*
|
wneuper@2523
|
242 |
* @return Match with the fields Given, Find, Where, Related with status
|
wneuper@2523
|
243 |
* etc.
|
wneuper@2523
|
244 |
*/
|
wneuper@2528
|
245 |
public Match tryMatchProblem(ProblemID problemID) throws RemoteException;
|
wneuper@2106
|
246 |
|
wneuper@2523
|
247 |
/**
|
wneuper@2523
|
248 |
* Refine the problem referenced by ProblemID with the CalcHead at or just
|
wneuper@2523
|
249 |
* above the Position in the CalcTree this CalcIterator is pointing to. The
|
wneuper@2523
|
250 |
* problem to be refined may remain the same.
|
wneuper@2523
|
251 |
*
|
wneuper@2523
|
252 |
* @param ProblemID
|
wneuper@2523
|
253 |
* or MethodID
|
wneuper@2523
|
254 |
*
|
wneuper@2523
|
255 |
* @return Match with the fields Given, Find, Where, Related with status,
|
wneuper@2523
|
256 |
* the problemID pointing at the refined problem etc.
|
wneuper@2523
|
257 |
*/
|
wneuper@2528
|
258 |
public Match tryRefineProblem(ProblemID problemID) throws RemoteException;
|
wneuper@2523
|
259 |
|
wneuper@2523
|
260 |
/**
|
wneuper@2528
|
261 |
* matches the Model on the Worksheet with the guard (Given, Where, Find,
|
wneuper@2528
|
262 |
* Relate) of the Method. The model is marked by the ActiveFormula (either
|
wneuper@2528
|
263 |
* on the CalcHead containing the Model or on a child-node of the CalcHead.
|
wneuper@2528
|
264 |
* There is no tryRefineMethod, because the hierarchy of Method's has no
|
wneuper@2528
|
265 |
* 'refine" yet.
|
wneuper@2528
|
266 |
*
|
wneuper@2523
|
267 |
* @see isac.util.interfaces.ICalcIterator#tryMatchProblem(KEStoreID)
|
wneuper@2523
|
268 |
*/
|
wneuper@2523
|
269 |
public Match tryMatchMethod(KEStoreID KEStoreID) throws RemoteException;
|
wneuper@2523
|
270 |
|
wneuper@1991
|
271 |
} |