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@2053
|
7 |
import isac.util.formulae.CalcFormula;
|
wneuper@1991
|
8 |
import isac.util.formulae.Position;
|
wneuper@1866
|
9 |
import isac.util.tactics.Tactic;
|
wneuper@1866
|
10 |
|
akirchst@1871
|
11 |
import java.rmi.Remote;
|
akirchst@1871
|
12 |
import java.rmi.RemoteException;
|
wneuper@2106
|
13 |
import java.util.Vector;
|
rgradisc@1311
|
14 |
|
rgradisc@1311
|
15 |
/**
|
wneuper@1866
|
16 |
* References a certain position in a CalcTree.
|
mkoschuc@2311
|
17 |
*
|
wneuper@1991
|
18 |
* At such a Position there is (a) a Formula or a CalcHead (b) a Tactic which is
|
wneuper@1991
|
19 |
* applicable to this Formula (Apply_Method is the only Tactic applicable to a
|
wneuper@1991
|
20 |
* CalcHead) (c) an Assumption generated by application of this Tactic to this
|
wneuper@1991
|
21 |
* Formula
|
wneuper@1991
|
22 |
* Invariant: The Level changes at most +/- ONE when moveUp or moveDown.
|
wneuper@1866
|
23 |
*
|
wneuper@1991
|
24 |
* a CalcIterator may be invalid,
|
wneuper@1866
|
25 |
*
|
wneuper@1991
|
26 |
* @see isac.util.CalcChangedEvent#
|
wneuper@1991
|
27 |
*
|
wneuper@1991
|
28 |
* Comments for the Dialog Guide # on 'applicable Tactic': if a Formula is also
|
wneuper@1991
|
29 |
* a parent of some children (one LevelDown), there is also a 'DETAILED
|
wneuper@1991
|
30 |
* applicable Tactic' generating the children. WN040920 presentation unclear #
|
wneuper@1991
|
31 |
* on 'causal Tactic': this direction of investigation is opposite to the
|
wneuper@1991
|
32 |
* applicablility of Tactics; investigating in this direction, for each Formula
|
wneuper@1991
|
33 |
* the Tactic can befound which generated the Formula. The causal Tactic is
|
wneuper@1991
|
34 |
* unique for each Formula, with the exception of Positions with moveLevelUp
|
wneuper@1991
|
35 |
* (there is a 'DETAILED causal Tactic' analogously to 'DETAILED applicable
|
wneuper@1991
|
36 |
* Tactic' at LevelDown)
|
wneuper@1991
|
37 |
*
|
akremp@1338
|
38 |
* @see isac.util.formulae.CalcElement
|
akremp@1338
|
39 |
* @see isac.bridge.CalcTree
|
akremp@1338
|
40 |
* @author Alan Krempler
|
rgradisc@1311
|
41 |
*/
|
wneuper@1991
|
42 |
public interface ICalcIterator extends Comparable, Cloneable, Remote {
|
rgradisc@1311
|
43 |
|
wneuper@2305
|
44 |
/**
|
wneuper@2305
|
45 |
* get the marker 'Position' unique within a CalcTree (i.e. a CalcIterator)
|
wneuper@2305
|
46 |
*
|
wneuper@2305
|
47 |
* @return Position
|
wneuper@2305
|
48 |
*/
|
wneuper@2305
|
49 |
public Position getPosition() throws RemoteException;
|
wneuper@2106
|
50 |
|
wneuper@2305
|
51 |
/**
|
wneuper@2305
|
52 |
* Reference the first (root) element in the attached calculation tree.
|
wneuper@2305
|
53 |
*
|
wneuper@2305
|
54 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
55 |
* if there is no element to move to.
|
wneuper@2305
|
56 |
*/
|
wneuper@2305
|
57 |
public boolean moveRoot() throws RemoteException;
|
rgradisc@1311
|
58 |
|
wneuper@2305
|
59 |
/**
|
wneuper@2305
|
60 |
* Reference the next enclosing CalcHead element in the attached calculation
|
wneuper@2305
|
61 |
* tree. This will be the subproblem being solved at the moment, or, if not
|
wneuper@2305
|
62 |
* solving subproblems, the root problem of the calculation.
|
wneuper@2305
|
63 |
*
|
wneuper@2305
|
64 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
65 |
* if there is no element to move to.
|
wneuper@2305
|
66 |
*/
|
wneuper@2305
|
67 |
public boolean moveCalcHead() throws RemoteException;
|
wneuper@1991
|
68 |
|
wneuper@2305
|
69 |
/**
|
wneuper@2305
|
70 |
* Reference the previous formula in the attached calculation tree.
|
wneuper@2305
|
71 |
*
|
wneuper@2305
|
72 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
73 |
* if there is no element to move to.
|
wneuper@2305
|
74 |
*/
|
wneuper@2305
|
75 |
public boolean moveUp() throws RemoteException;
|
wneuper@1991
|
76 |
|
wneuper@2305
|
77 |
/**
|
wneuper@2305
|
78 |
* Reference the next formula in the attached calculation tree.
|
wneuper@2305
|
79 |
*
|
wneuper@2305
|
80 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
81 |
* if there is no element to move to.
|
wneuper@2305
|
82 |
*
|
wneuper@2305
|
83 |
* moveRoot() plus moveDown() reaches all nodes in a CalcTree
|
wneuper@2305
|
84 |
*/
|
wneuper@2305
|
85 |
public boolean moveDown() throws RemoteException;
|
wneuper@1991
|
86 |
|
wneuper@2305
|
87 |
/**
|
wneuper@2305
|
88 |
* Enter the next coarser level of refinement in the attached calculation
|
wneuper@2305
|
89 |
* tree.
|
wneuper@2305
|
90 |
*
|
wneuper@2305
|
91 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
92 |
* if there is no element to move to.
|
wneuper@2305
|
93 |
*/
|
wneuper@2305
|
94 |
public boolean moveLevelUp() throws RemoteException;
|
rgradisc@1311
|
95 |
|
wneuper@2305
|
96 |
/**
|
wneuper@2305
|
97 |
* Enter the next more detailed level of refinement in the attached
|
wneuper@2305
|
98 |
* calculation tree.
|
wneuper@2305
|
99 |
*
|
wneuper@2305
|
100 |
* @return Like all the moveXXX methods this returns true on success, false
|
wneuper@2305
|
101 |
* if there is no element to move to.
|
wneuper@2305
|
102 |
*/
|
wneuper@2305
|
103 |
public boolean moveLevelDown() throws RemoteException;
|
rgradisc@1311
|
104 |
|
wneuper@2305
|
105 |
/**
|
wneuper@2305
|
106 |
* Reference the formula which resulted in the currently selected element of
|
wneuper@2305
|
107 |
* the attached calculation tree.
|
wneuper@2305
|
108 |
*/
|
wneuper@2305
|
109 |
public boolean moveFormula() throws RemoteException;
|
rgradisc@1311
|
110 |
|
wneuper@2305
|
111 |
/**
|
wneuper@2305
|
112 |
* Ask whether this is the last Item, which is equivalent to whwther there
|
wneuper@2305
|
113 |
* is another item where moveDown() could move to.
|
wneuper@2305
|
114 |
*
|
wneuper@2305
|
115 |
* @return true, if moveDown() would not yield any new elements false, if
|
wneuper@2305
|
116 |
* moveDown() would move to another element WN040819 awaiting
|
wneuper@2305
|
117 |
* problems with parallel branches (OR, AND, etc.) in calcTree
|
wneuper@2305
|
118 |
* @deprecated due to calcChangedEvent since 0512
|
wneuper@2305
|
119 |
*/
|
wneuper@2305
|
120 |
public boolean isLast() throws RemoteException;
|
wneuper@1991
|
121 |
|
wneuper@2305
|
122 |
/**
|
wneuper@2305
|
123 |
* is the Iterator on a CalcHead or not
|
wneuper@2305
|
124 |
*/
|
wneuper@2305
|
125 |
public boolean onCalcHead() throws RemoteException;
|
wneuper@2304
|
126 |
|
wneuper@2305
|
127 |
/**
|
wneuper@2305
|
128 |
* Use this to get the current element and check the type by calling
|
wneuper@2305
|
129 |
* getType().
|
wneuper@2305
|
130 |
*
|
wneuper@2305
|
131 |
* @return The currently referenced Element
|
wneuper@2305
|
132 |
* @see #getType()
|
wneuper@2305
|
133 |
* @deprecated due to getFormula, getTactic, getAssumption
|
wneuper@2305
|
134 |
*/
|
wneuper@2305
|
135 |
public ICalcElement getElement() throws RemoteException;
|
wneuper@1991
|
136 |
|
wneuper@2305
|
137 |
/**
|
wneuper@2305
|
138 |
* @return Formula, which may also be a CalcHead !
|
wneuper@2305
|
139 |
*/
|
wneuper@1876
|
140 |
|
wneuper@2305
|
141 |
public ICalcElement getFormula() throws RemoteException;
|
rgradisc@1311
|
142 |
|
wneuper@2305
|
143 |
/**
|
wneuper@2305
|
144 |
* @return Tactic applicable to the formula under the Iterator
|
wneuper@2305
|
145 |
*/
|
wneuper@2305
|
146 |
public Tactic getTactic() throws RemoteException;
|
wneuper@1866
|
147 |
|
wneuper@2305
|
148 |
/**
|
wneuper@2305
|
149 |
* Get a list of tactics applicable to the active formula.
|
wneuper@2305
|
150 |
*
|
wneuper@2305
|
151 |
* @param scope
|
wneuper@2305
|
152 |
* WN0502 not yet impl. The filter parameter selects the scope of
|
wneuper@2305
|
153 |
* search for applicable tactics.
|
wneuper@2305
|
154 |
* @return Vector with applicable tactics
|
wneuper@2305
|
155 |
* @see #TACTICS_ALL
|
wneuper@2305
|
156 |
* @see #TACTICS_CURRENT_THEORY
|
wneuper@2305
|
157 |
* @see #TACTICS_CURRENT_METHOD
|
wneuper@2305
|
158 |
*/
|
wneuper@2305
|
159 |
public Vector getApplicableTactics(int scope) throws RemoteException;
|
wneuper@2106
|
160 |
|
wneuper@2305
|
161 |
/**
|
wneuper@2305
|
162 |
* @return Assumptions generated by the Tactic applied to the formula, both
|
wneuper@2305
|
163 |
* under the same Iterator
|
wneuper@2305
|
164 |
*/
|
wneuper@2305
|
165 |
public Assumptions getAssumptions() throws RemoteException;
|
wneuper@2106
|
166 |
|
wneuper@2305
|
167 |
/**
|
wneuper@2305
|
168 |
* @return Assumptions accumulated during calculation down to the formula
|
wneuper@2305
|
169 |
* under the Iterator ATTENTION: this returnvalue is also used by
|
wneuper@2305
|
170 |
* getAssumptions as long as getAccumulatedAssumptions does not
|
wneuper@2305
|
171 |
* include references to their _several_ sources -- i.e. change
|
wneuper@2305
|
172 |
* _this_ return, not that in getAssumptions !
|
wneuper@2305
|
173 |
*/
|
wneuper@2305
|
174 |
public Assumptions getAccumulatedAssumptions() throws RemoteException;
|
rgradisc@1311
|
175 |
|
wneuper@2305
|
176 |
/**
|
wneuper@2305
|
177 |
* The current level of nesting into subcalculations.
|
wneuper@2305
|
178 |
*
|
wneuper@2305
|
179 |
* @return An int representing level of nesting (higher == more detailed)
|
wneuper@2305
|
180 |
* <p>
|
wneuper@2305
|
181 |
* Special values:
|
wneuper@2305
|
182 |
* <p>
|
wneuper@2305
|
183 |
* 0: outmost level: only first and last step of calculation are on
|
wneuper@2305
|
184 |
* this level
|
wneuper@2305
|
185 |
*/
|
wneuper@2305
|
186 |
public int getLevel() throws RemoteException;
|
wneuper@1991
|
187 |
|
wneuper@2305
|
188 |
/**
|
wneuper@2305
|
189 |
* Create a copy of this Iterator: the clone will point to the same formula
|
wneuper@2305
|
190 |
* in the calcTree
|
wneuper@2305
|
191 |
*
|
wneuper@2305
|
192 |
* @return a cloned Iterator
|
wneuper@2305
|
193 |
*/
|
wneuper@2305
|
194 |
public Object clone();
|
wneuper@1991
|
195 |
|
wneuper@2305
|
196 |
/**
|
wneuper@2305
|
197 |
* for test-output
|
wneuper@2305
|
198 |
*
|
wneuper@2305
|
199 |
* @return 'position', i.e. unique identifier in a CalcTree
|
wneuper@2305
|
200 |
*/
|
wneuper@2305
|
201 |
public String toSMLString();
|
wneuper@1991
|
202 |
|
wneuper@2305
|
203 |
// /**
|
wneuper@2305
|
204 |
// * Create a copy of this Iterator: the clone will point to the Position
|
wneuper@2305
|
205 |
// * in the calcTree (Position may come from a formula in the worksheet)
|
wneuper@2305
|
206 |
// *
|
wneuper@2305
|
207 |
// * @return a cloned Iterator
|
wneuper@2305
|
208 |
// */
|
wneuper@2305
|
209 |
// public ICalcIterator clone(Position p);
|
wneuper@2106
|
210 |
|
wneuper@2305
|
211 |
// /**
|
wneuper@2305
|
212 |
// * @return the position unique within a calctree
|
wneuper@2305
|
213 |
// * @see isac.uti.interfaces.ICalcIterator#clone(Position)
|
wneuper@2305
|
214 |
// */
|
wneuper@2305
|
215 |
// public Position getSmlPos();
|
wneuper@1991
|
216 |
} |