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
22 * Invariant: The Level changes at most +/- ONE when moveUp or moveDown.
24 * a CalcIterator may be invalid,
26 * @see isac.util.CalcChangedEvent#
28 * Comments for the Dialog Guide # on 'applicable Tactic': if a Formula is also
29 * a parent of some children (one LevelDown), there is also a 'DETAILED
30 * applicable Tactic' generating the children. WN040920 presentation unclear #
31 * on 'causal Tactic': this direction of investigation is opposite to the
32 * applicablility of Tactics; investigating in this direction, for each Formula
33 * the Tactic can befound which generated the Formula. The causal Tactic is
34 * unique for each Formula, with the exception of Positions with moveLevelUp
35 * (there is a 'DETAILED causal Tactic' analogously to 'DETAILED applicable
36 * Tactic' at LevelDown)
38 * @see isac.util.formulae.CalcElement
39 * @see isac.bridge.CalcTree
40 * @author Alan Krempler
42 public interface ICalcIterator extends Comparable, Cloneable, Remote {
45 * get the marker 'Position' unique within a CalcTree (i.e. a CalcIterator)
49 public Position getPosition() throws RemoteException;
52 * Reference the first (root) element in the attached calculation tree.
54 * @return Like all the moveXXX methods this returns true on success, false
55 * if there is no element to move to.
57 public boolean moveRoot() throws RemoteException;
60 * Reference the next enclosing CalcHead element in the attached calculation
61 * tree. This will be the subproblem being solved at the moment, or, if not
62 * solving subproblems, the root problem of the calculation.
64 * @return Like all the moveXXX methods this returns true on success, false
65 * if there is no element to move to.
67 public boolean moveCalcHead() throws RemoteException;
70 * Reference the previous formula in the attached calculation tree.
72 * @return Like all the moveXXX methods this returns true on success, false
73 * if there is no element to move to.
75 public boolean moveUp() throws RemoteException;
78 * Reference the next formula in the attached calculation tree.
80 * @return Like all the moveXXX methods this returns true on success, false
81 * if there is no element to move to.
83 * moveRoot() plus moveDown() reaches all nodes in a CalcTree
85 public boolean moveDown() throws RemoteException;
88 * Enter the next coarser level of refinement in the attached calculation
91 * @return Like all the moveXXX methods this returns true on success, false
92 * if there is no element to move to.
94 public boolean moveLevelUp() throws RemoteException;
97 * Enter the next more detailed level of refinement in the attached
100 * @return Like all the moveXXX methods this returns true on success, false
101 * if there is no element to move to.
103 public boolean moveLevelDown() throws RemoteException;
106 * Reference the formula which resulted in the currently selected element of
107 * the attached calculation tree.
109 public boolean moveFormula() throws RemoteException;
112 * Ask whether this is the last Item, which is equivalent to whwther there
113 * is another item where moveDown() could move to.
115 * @return true, if moveDown() would not yield any new elements false, if
116 * moveDown() would move to another element WN040819 awaiting
117 * problems with parallel branches (OR, AND, etc.) in calcTree
118 * @deprecated due to calcChangedEvent since 0512
120 public boolean isLast() throws RemoteException;
123 * is the Iterator on a CalcHead or not
125 public boolean onCalcHead() throws RemoteException;
128 * Use this to get the current element and check the type by calling
131 * @return The currently referenced Element
133 * @deprecated due to getFormula, getTactic, getAssumption
135 public ICalcElement getElement() throws RemoteException;
138 * @return Formula, which may also be a CalcHead !
141 public ICalcElement getFormula() throws RemoteException;
144 * @return Tactic applicable to the formula under the Iterator
146 public Tactic getTactic() throws RemoteException;
149 * Get a list of tactics applicable to the active formula.
152 * WN0502 not yet impl. The filter parameter selects the scope of
153 * search for applicable tactics.
154 * @return Vector with applicable tactics
156 * @see #TACTICS_CURRENT_THEORY
157 * @see #TACTICS_CURRENT_METHOD
159 public Vector getApplicableTactics(int scope) throws RemoteException;
162 * @return Assumptions generated by the Tactic applied to the formula, both
163 * under the same Iterator
165 public Assumptions getAssumptions() throws RemoteException;
168 * @return Assumptions accumulated during calculation down to the formula
169 * under the Iterator ATTENTION: this returnvalue is also used by
170 * getAssumptions as long as getAccumulatedAssumptions does not
171 * include references to their _several_ sources -- i.e. change
172 * _this_ return, not that in getAssumptions !
174 public Assumptions getAccumulatedAssumptions() throws RemoteException;
177 * The current level of nesting into subcalculations.
179 * @return An int representing level of nesting (higher == more detailed)
183 * 0: outmost level: only first and last step of calculation are on
186 public int getLevel() throws RemoteException;
189 * Create a copy of this Iterator: the clone will point to the same formula
192 * @return a cloned Iterator
194 public Object clone();
199 * @return 'position', i.e. unique identifier in a CalcTree
201 public String toSMLString();
204 // * Create a copy of this Iterator: the clone will point to the Position
205 // * in the calcTree (Position may come from a formula in the worksheet)
207 // * @return a cloned Iterator
209 // public ICalcIterator clone(Position p);
212 // * @return the position unique within a calctree
213 // * @see isac.uti.interfaces.ICalcIterator#clone(Position)
215 // public Position getSmlPos();