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: package de.uka.ilkd.key.strategy.feature;
09:
10: import de.uka.ilkd.key.logic.PosInOccurrence;
11: import de.uka.ilkd.key.logic.sort.Sort;
12: import de.uka.ilkd.key.logic.util.TermHelper;
13: import de.uka.ilkd.key.proof.Goal;
14: import de.uka.ilkd.key.rule.RuleApp;
15: import de.uka.ilkd.key.strategy.termProjection.ProjectionToTerm;
16:
17: public class ImplicitCastNecessary extends BinaryFeature {
18:
19: private final ProjectionToTerm projection;
20:
21: private ImplicitCastNecessary(ProjectionToTerm projection) {
22: this .projection = projection;
23: }
24:
25: protected boolean filter(RuleApp app, PosInOccurrence pos, Goal goal) {
26: assert pos != null && pos.depth() >= 1;
27:
28: int subPos = pos.getIndex();
29:
30: final Sort maxSort = TermHelper.getMaxSort(pos.up().subTerm(),
31: subPos, goal.proof().getServices());
32: return projection.toTerm(app, pos, goal).sort().extendsTrans(
33: maxSort);
34: }
35:
36: public static Feature create(ProjectionToTerm s1) {
37: return new ImplicitCastNecessary(s1);
38: }
39:
40: }
|