Generated on Mon Aug 27 2012 17:15:36 for Gecode by doxygen 1.8.1.2
nodecursor.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  *
6  * Copyright:
7  * Guido Tack, 2006
8  *
9  * Last modified:
10  * $Date: 2010-08-12 17:48:30 +1000 (Thu, 12 Aug 2010) $ by $Author: tack $
11  * $Revision: 11345 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #ifndef GECODE_GIST_NODECURSOR_HH
39 #define GECODE_GIST_NODECURSOR_HH
40 
42 
43 namespace Gecode { namespace Gist {
44 
46  template<class Node>
47  class NodeCursor {
48  private:
50  Node* _startNode;
52  Node* _node;
54  unsigned int _alternative;
55  protected:
57  const typename Node::NodeAllocator& na;
59  void node(Node* n);
61  Node* startNode(void);
62  public:
64  NodeCursor(Node* theNode, const typename Node::NodeAllocator& na);
66  Node* node(void);
68  unsigned int alternative(void);
70  void alternative(unsigned int a);
71 
73 
74 
75  bool mayMoveUpwards(void);
77  void moveUpwards(void);
79  bool mayMoveDownwards(void);
81  void moveDownwards(void);
83  bool mayMoveSidewards(void);
85  void moveSidewards(void);
87  };
88 
90  class HideFailedCursor : public NodeCursor<VisualNode> {
91  private:
92  bool onlyDirty;
93  public:
97  bool onlyDirtyNodes);
99 
100 
101  bool mayMoveDownwards(void);
103  void processCurrentNode(void);
105  };
106 
108  class UnhideAllCursor : public NodeCursor<VisualNode> {
109  public:
111  UnhideAllCursor(VisualNode* theNode,
114 
115 
116  void processCurrentNode(void);
118  };
119 
121  class UnstopAllCursor : public NodeCursor<VisualNode> {
122  public:
124  UnstopAllCursor(VisualNode* theNode,
127 
128 
129  void processCurrentNode(void);
131  };
132 
134  class NextSolCursor : public NodeCursor<VisualNode> {
135  private:
137  bool back;
139  bool notOnSol(void);
140  public:
142  NextSolCursor(VisualNode* theNode, bool backwards,
145 
146 
147  void processCurrentNode(void);
149  bool mayMoveUpwards(void);
151  bool mayMoveDownwards(void);
153  void moveDownwards(void);
155  bool mayMoveSidewards(void);
157  void moveSidewards(void);
159  };
160 
162  class StatCursor : public NodeCursor<VisualNode> {
163  private:
165  int curDepth;
166  public:
168  int depth;
170  int failed;
172  int solved;
174  int choice;
176  int open;
177 
179  StatCursor(VisualNode* theNode,
181 
183 
184 
185  void processCurrentNode(void);
187  void moveDownwards(void);
189  void moveUpwards(void);
191 
192  };
193 
195  class DisposeCursor : public NodeCursor<VisualNode> {
196  public:
198  DisposeCursor(VisualNode* theNode,
200 
202 
203 
204  void processCurrentNode(void);
206 
207  };
208 
209 }}
210 
212 
213 #endif
214 
215 // STATISTICS: gist-any