nodecursor.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef GECODE_GIST_NODECURSOR_HH
00035 #define GECODE_GIST_NODECURSOR_HH
00036
00037 #include <gecode/gist/visualnode.hh>
00038
00039 namespace Gecode { namespace Gist {
00040
00042 template<class Node>
00043 class NodeCursor {
00044 private:
00046 Node* _startNode;
00048 Node* _node;
00050 unsigned int _alternative;
00051 protected:
00053 const typename Node::NodeAllocator& na;
00055 void node(Node* n);
00057 Node* startNode(void);
00058 public:
00060 NodeCursor(Node* theNode, const typename Node::NodeAllocator& na);
00062 Node* node(void);
00064 unsigned int alternative(void);
00066 void alternative(unsigned int a);
00067
00069
00070
00071 bool mayMoveUpwards(void);
00073 void moveUpwards(void);
00075 bool mayMoveDownwards(void);
00077 void moveDownwards(void);
00079 bool mayMoveSidewards(void);
00081 void moveSidewards(void);
00083 };
00084
00086 class HideFailedCursor : public NodeCursor<VisualNode> {
00087 private:
00088 bool onlyDirty;
00089 public:
00091 HideFailedCursor(VisualNode* theNode,
00092 const VisualNode::NodeAllocator& na,
00093 bool onlyDirtyNodes);
00095
00096
00097 bool mayMoveDownwards(void);
00099 void processCurrentNode(void);
00101 };
00102
00104 class UnhideAllCursor : public NodeCursor<VisualNode> {
00105 public:
00107 UnhideAllCursor(VisualNode* theNode,
00108 const VisualNode::NodeAllocator& na);
00110
00111
00112 void processCurrentNode(void);
00114 };
00115
00117 class UnstopAllCursor : public NodeCursor<VisualNode> {
00118 public:
00120 UnstopAllCursor(VisualNode* theNode,
00121 const VisualNode::NodeAllocator& na);
00123
00124
00125 void processCurrentNode(void);
00127 };
00128
00130 class NextSolCursor : public NodeCursor<VisualNode> {
00131 private:
00133 bool back;
00135 bool notOnSol(void);
00136 public:
00138 NextSolCursor(VisualNode* theNode, bool backwards,
00139 const VisualNode::NodeAllocator& na);
00141
00142
00143 void processCurrentNode(void);
00145 bool mayMoveUpwards(void);
00147 bool mayMoveDownwards(void);
00149 void moveDownwards(void);
00151 bool mayMoveSidewards(void);
00153 void moveSidewards(void);
00155 };
00156
00158 class StatCursor : public NodeCursor<VisualNode> {
00159 private:
00161 int curDepth;
00162 public:
00164 int depth;
00166 int failed;
00168 int solved;
00170 int choice;
00172 int open;
00173
00175 StatCursor(VisualNode* theNode,
00176 const VisualNode::NodeAllocator& na);
00177
00179
00180
00181 void processCurrentNode(void);
00183 void moveDownwards(void);
00185 void moveUpwards(void);
00187
00188 };
00189
00191 class BranchLabelCursor : public NodeCursor<VisualNode> {
00192 private:
00194 VisualNode::NodeAllocator& _na;
00196 BestNode* _curBest;
00198 int _c_d;
00200 int _a_d;
00202 bool _clear;
00203 public:
00205 BranchLabelCursor(VisualNode* theNode, BestNode* curBest,
00206 int c_d, int a_d, bool clear,
00207 VisualNode::NodeAllocator& na);
00209
00210 void processCurrentNode(void);
00212 };
00213
00215 class DisposeCursor : public NodeCursor<VisualNode> {
00216 public:
00218 DisposeCursor(VisualNode* theNode,
00219 const VisualNode::NodeAllocator& na);
00220
00222
00223
00224 void processCurrentNode(void);
00226
00227 };
00228
00229 }}
00230
00231 #include <gecode/gist/nodecursor.hpp>
00232
00233 #endif
00234
00235