01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: //
09: //
10:
11: package de.uka.ilkd.key.strategy.feature;
12:
13: import de.uka.ilkd.key.logic.PosInOccurrence;
14: import de.uka.ilkd.key.proof.Goal;
15: import de.uka.ilkd.key.rule.RuleApp;
16: import de.uka.ilkd.key.rule.Taclet;
17: import de.uka.ilkd.key.strategy.LongRuleAppCost;
18: import de.uka.ilkd.key.strategy.RuleAppCost;
19:
20: /**
21: * Feature that returns the number of branches for a given taclet application
22: * Size of "assumes" sequents is currently not considered
23: */
24: public class CountBranchFeature implements Feature {
25:
26: public static Feature INSTANCE = new CountBranchFeature();
27:
28: private CountBranchFeature() {
29: }
30:
31: /**
32: * Compute the cost of a RuleApp.
33: * @param app the RuleApp
34: * @param pos position where <code>app</code> is to be applied
35: * @param goal the goal on which <code>app</code> is to be applied
36: * @return the cost of <code>app</code>
37: */
38: public RuleAppCost compute(RuleApp app, PosInOccurrence pos,
39: Goal goal) {
40: if (app.rule() instanceof Taclet) {
41: final Taclet tac = (Taclet) app.rule();
42: final long branches = tac.goalTemplates().size();
43: return LongRuleAppCost.create(branches);
44: }
45: return LongRuleAppCost.ZERO_COST;
46: }
47: }
|