2 * Created on Sep 19, 2003
4 package isac.util.interfaces;
6 import isac.util.formulae.Assumptions;
7 import isac.util.formulae.CalcFormula;
8 import isac.util.formulae.Position;
9 import isac.util.tactics.Tactic;
11 import java.rmi.Remote;
12 import java.rmi.RemoteException;
13 import java.util.Vector;
16 * References a certain position in a CalcTree.
18 * At such a Position there is (a) a Formula or a CalcHead (b) a Tactic which is
19 * applicable to this Formula (Apply_Method is the only Tactic applicable to a
20 * CalcHead) (c) an Assumption generated by application of this Tactic to this
23 * Invariant: The Level changes at most +/- ONE when moveUp or moveDown.
25 * a CalcIterator may be invalid,
27 * @see isac.util.CalcChangedEvent#
29 * Comments for the Dialog Guide # on 'applicable Tactic': if a Formula is also
30 * a parent of some children (one LevelDown), there is also a 'DETAILED
31 * applicable Tactic' generating the children. WN040920 presentation unclear #
32 * on 'causal Tactic': this direction of investigation is opposite to the
33 * applicablility of Tactics; investigating in this direction, for each Formula
34 * the Tactic can befound which generated the Formula. The causal Tactic is
35 * unique for each Formula, with the exception of Positions with moveLevelUp
36 * (there is a 'DETAILED causal Tactic' analogously to 'DETAILED applicable
37 * Tactic' at LevelDown)
39 * @see isac.util.formulae.CalcElement
40 * @see isac.bridge.CalcTree
41 * @author Alan Krempler
43 public interface ICalcIterator extends Comparable, Cloneable, Remote {
46 * get the marker 'Position' unique within a CalcTree (i.e. a CalcIterator)
50 public Position getPosition() throws RemoteException;
53 * Reference the first (root) element in the attached calculation tree.
55 * @return Like all the moveXXX methods this returns true on success, false
56 * if there is no element to move to.
58 public boolean moveRoot() throws RemoteException;
61 * Reference the next enclosing CalcHead element in the attached calculation
62 * tree. This will be the subproblem being solved at the moment, or, if not
63 * solving subproblems, the root problem of the calculation.
65 * @return Like all the moveXXX methods this returns true on success, false
66 * if there is no element to move to.
68 public boolean moveCalcHead() throws RemoteException;
71 * Reference the previous formula in the attached calculation tree.
73 * @return Like all the moveXXX methods this returns true on success, false
74 * if there is no element to move to.
76 public boolean moveUp() throws RemoteException;
79 * Reference the next formula in the attached calculation tree.
81 * @return Like all the moveXXX methods this returns true on success, false
82 * if there is no element to move to.
84 * moveRoot() plus moveDown() reaches all nodes in a CalcTree
86 public boolean moveDown() throws RemoteException;
89 * Enter the next coarser level of refinement in the attached calculation
92 * @return Like all the moveXXX methods this returns true on success, false
93 * if there is no element to move to.
95 public boolean moveLevelUp() throws RemoteException;
98 * Enter the next more detailed level of refinement in the attached
101 * @return Like all the moveXXX methods this returns true on success, false
102 * if there is no element to move to.
104 public boolean moveLevelDown() throws RemoteException;
107 * Reference the formula which resulted in the currently selected element of
108 * the attached calculation tree.
110 public boolean moveFormula() throws RemoteException;
113 * Ask whether this is the last Item, which is equivalent to whwther there
114 * is another item where moveDown() could move to.
116 * @return true, if moveDown() would not yield any new elements false, if
117 * moveDown() would move to another element WN040819 awaiting
118 * problems with parallel branches (OR, AND, etc.) in calcTree
119 * @deprecated due to calcChangedEvent since 0512
121 public boolean isLast() throws RemoteException;
124 * is the Iterator on a CalcHead or not
126 public boolean onCalcHead() throws RemoteException;
129 * Use this to get the current element and check the type by calling
132 * @return The currently referenced Element
134 * @deprecated due to getFormula, getTactic, getAssumption
136 public ICalcElement getElement() throws RemoteException;
139 * @return Formula, which may also be a CalcHead !
142 public ICalcElement getFormula() throws RemoteException;
145 * @return Tactic applicable to the formula under the Iterator
147 public Tactic getTactic() throws RemoteException;
150 * Get a list of tactics applicable to the active formula.
153 * WN0502 not yet impl. The filter parameter selects the scope of
154 * search for applicable tactics.
155 * @return Vector with applicable tactics
157 * @see #TACTICS_CURRENT_THEORY
158 * @see #TACTICS_CURRENT_METHOD
160 public Vector getApplicableTactics(int scope) throws RemoteException;
163 * @return Assumptions generated by the Tactic applied to the formula, both
164 * under the same Iterator
166 public Assumptions getAssumptions() throws RemoteException;
169 * @return Assumptions accumulated during calculation down to the formula
170 * under the Iterator ATTENTION: this returnvalue is also used by
171 * getAssumptions as long as getAccumulatedAssumptions does not
172 * include references to their _several_ sources -- i.e. change
173 * _this_ return, not that in getAssumptions !
175 public Assumptions getAccumulatedAssumptions() throws RemoteException;
178 * The current level of nesting into subcalculations.
180 * @return An int representing level of nesting (higher == more detailed)
184 * 0: outmost level: only first and last step of calculation are on
187 public int getLevel() throws RemoteException;
190 * Create a copy of this Iterator: the clone will point to the same formula
193 * @return a cloned Iterator
195 public Object clone();
200 * @return 'position', i.e. unique identifier in a CalcTree
202 public String toSMLString();
205 // * Create a copy of this Iterator: the clone will point to the Position
206 // * in the calcTree (Position may come from a formula in the worksheet)
208 // * @return a cloned Iterator
210 // public ICalcIterator clone(Position p);
213 // * @return the position unique within a calctree
214 // * @see isac.uti.interfaces.ICalcIterator#clone(Position)
216 // public Position getSmlPos();