1 /*
2
3 This file is part of the Maude 2 interpreter.
4
5 Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
20
21 */
22
23 //
24 // Class for idle and fail strategies.
25 //
26 #ifndef _testStrategy_hh_
27 #define _testStrategy_hh_
28 #include "strategyExpression.hh"
29 #include "pattern.hh"
30
31 class TestStrategy : public StrategyExpression
32 {
33 public:
34 //
35 // depth = -1 means at top, no extension
36 // depth = 0 means at top, with extension
37 // depth = UNBOUNDED means all the way down to the leaf nodes, with extension
38 //
39 TestStrategy(Term* patternTerm, int depth, const Vector<ConditionFragment*>& condition);
40
41 Term* getPatternTerm() const;
42 int getDepth() const;
43 const Vector<ConditionFragment*>& getCondition();
44
45 StrategicExecution::Survival decompose(StrategicSearch& searchObject, DecompositionProcess* remainder);
46
47
48 private:
49 Pattern pattern;
50 const int depth;
51 };
52
53 inline Term*
getPatternTerm() const54 TestStrategy::getPatternTerm() const
55 {
56 return pattern.getLhs();
57 }
58
59 inline int
getDepth() const60 TestStrategy::getDepth() const
61 {
62 return depth;
63 }
64
65 inline const Vector<ConditionFragment*>&
getCondition()66 TestStrategy::getCondition()
67 {
68 return pattern.getCondition();
69 }
70
71 #endif
72