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.termfeature;
12:
13: import de.uka.ilkd.key.logic.Term;
14: import de.uka.ilkd.key.strategy.LongRuleAppCost;
15: import de.uka.ilkd.key.strategy.RuleAppCost;
16: import de.uka.ilkd.key.strategy.TopRuleAppCost;
17:
18: /**
19: * Abstract superclass for features that have either zero cost or top cost.
20: */
21: public abstract class BinaryTermFeature implements TermFeature {
22:
23: protected BinaryTermFeature() {
24: }
25:
26: /** Constant that represents the boolean value true */
27: public static final RuleAppCost ZERO_COST = LongRuleAppCost.ZERO_COST;
28: /** Constant that represents the boolean value false */
29: public static final RuleAppCost TOP_COST = TopRuleAppCost.INSTANCE;
30:
31: final public RuleAppCost compute(Term term) {
32: return filter(term) ? ZERO_COST : TOP_COST;
33: }
34:
35: protected abstract boolean filter(Term term);
36:
37: }
|