Node class that supports visual layout More...
#include <visualnode.hh>
Public Member Functions | |
VisualNode (int p) | |
Construct with parent p. More... | |
VisualNode (Space *root) | |
Constructor for root node from root and b. More... | |
bool | isHidden (void) |
Return if node is hidden. More... | |
void | setHidden (bool h) |
Set hidden state to h. More... | |
void | setStop (bool h) |
Set stop state to h. More... | |
void | dirtyUp (const NodeAllocator &na) |
Mark all nodes up the path to the parent as dirty. More... | |
void | layout (const NodeAllocator &na) |
Compute layout for the subtree of this node. More... | |
int | getOffset (void) |
Return offset off this node from its parent. More... | |
void | setOffset (int n) |
Set offset of this node, relative to its parent. More... | |
bool | isDirty (void) |
Return whether node is marked as dirty. More... | |
void | setDirty (bool d) |
Mark node as dirty. More... | |
bool | childrenLayoutIsDone (void) |
Return whether the layout of the node's children has been completed. More... | |
void | setChildrenLayoutDone (bool d) |
Mark node whether the layout of the node's children has been completed. More... | |
bool | isMarked (void) |
Return whether node is marked. More... | |
void | setMarked (bool m) |
Set mark of this node. More... | |
bool | isBookmarked (void) |
Return whether node is bookmarked. More... | |
void | setBookmarked (bool m) |
Set bookmark of this node. More... | |
void | pathUp (const NodeAllocator &na) |
Set all nodes from the node to the root to be on the path. More... | |
void | unPathUp (const NodeAllocator &na) |
Set all nodes from the node to the root not to be on the path. More... | |
bool | isOnPath (void) |
Return whether node is on the path. More... | |
int | getPathAlternative (const NodeAllocator &na) |
Return the alternative of the child that is on the path (-1 if none) More... | |
void | setOnPath (bool onPath0) |
Set whether node is on the path. More... | |
void | toggleHidden (const NodeAllocator &na) |
Toggle whether this node is hidden. More... | |
void | hideFailed (const NodeAllocator &na, bool onlyDirty=false) |
Hide all failed subtrees of this node. More... | |
void | unhideAll (const NodeAllocator &na) |
Unhide all nodes in the subtree of this node. More... | |
void | toggleStop (const NodeAllocator &na) |
Do not stop at this node. More... | |
void | unstopAll (const NodeAllocator &na) |
Do not stop at any stop node in the subtree of this node. More... | |
Shape * | getShape (void) |
Return the shape of this node. More... | |
void | setShape (Shape *s) |
Set the shape of this node. More... | |
void | computeShape (const NodeAllocator &na, VisualNode *root) |
Compute the shape according to the shapes of the children. More... | |
BoundingBox | getBoundingBox (void) |
Return the bounding box. More... | |
void | changedStatus (const NodeAllocator &na) |
Signal that the status has changed. More... | |
VisualNode * | findNode (const NodeAllocator &na, int x, int y) |
Find a node in this subtree at coordinates x, y. More... | |
void | labelBranches (NodeAllocator &na, BestNode *curBest, int c_d, int a_d) |
Create or clear branch labels in subtree. More... | |
void | labelPath (NodeAllocator &na, BestNode *curBest, int c_d, int a_d) |
Create or clear branch labels on path to root. More... | |
std::string | getBranchLabel (NodeAllocator &na, VisualNode *p, const Choice *c, BestNode *curBest, int c_d, int a_d, int alt) |
Return string that describes the branch. More... | |
std::string | toolTip (NodeAllocator &na, BestNode *curBest, int c_d, int a_d) |
Return string that is used as a tool tip. More... | |
void | dispose (void) |
Free allocated memory. More... | |
![]() | |
SpaceNode (int p) | |
Construct node with parent p. More... | |
SpaceNode (Space *root) | |
Construct root node from Space root and branch-and-bound object better. More... | |
Space * | getSpace (NodeAllocator &na, BestNode *curBest, int c_d, int a_d) |
Return working space. Receiver must delete the space. More... | |
const Space * | getWorkingSpace (void) const |
Return working space (if present). More... | |
void | purge (const NodeAllocator &na) |
Clear working space and copy (if present and this is not the root). More... | |
void | dispose (void) |
Free allocated memory. More... | |
bool | isCurrentBest (BestNode *curBest) |
Return whether this node is the currently best solution. More... | |
int | getNumberOfChildNodes (NodeAllocator &na, BestNode *curBest, Statistics &stats, int c_d, int a_d) |
Compute and return the number of children. More... | |
NodeStatus | getStatus (void) const |
Return current status of the node. More... | |
bool | isOpen (void) |
Return whether this node still has open children. More... | |
bool | hasFailedChildren (void) |
Return whether the subtree of this node has any failed children. More... | |
bool | hasSolvedChildren (void) |
Return whether the subtree of this node has any solved children. More... | |
bool | hasOpenChildren (void) |
Return whether the subtree of this node has any open children. More... | |
int | getNoOfOpenChildren (const NodeAllocator &na) |
Return number of open children. More... | |
void | setNoOfOpenChildren (int n) |
Set number of open children to n. More... | |
bool | hasCopy (void) |
Return whether the node has a copy. More... | |
bool | hasWorkingSpace (void) |
Return whether the node has a working space. More... | |
int | getAlternative (const NodeAllocator &na) const |
Return alternative number of this node. More... | |
const Choice * | getChoice (void) |
Return choice of this node. More... | |
![]() | |
Node (int p, bool failed=false) | |
Construct node with parent p. More... | |
int | getParent (void) const |
Return the parent. More... | |
VisualNode * | getParent (const NodeAllocator &na) const |
Return the parent. More... | |
VisualNode * | getChild (const NodeAllocator &na, int n) const |
Return child no n. More... | |
int | getIndex (const NodeAllocator &na) const |
Return index of this node. More... | |
bool | isRoot (void) const |
Check if this node is the root of a tree. More... | |
void | setNumberOfChildren (unsigned int n, NodeAllocator &na) |
Set the number of children to n and initialize children. More... | |
unsigned int | getNumberOfChildren (void) const |
Return the number of children. More... | |
Protected Types | |
enum | VisualNodeFlags { DIRTY = SpaceNode::LASTBIT+1, CHILDRENLAYOUTDONE, HIDDEN, MARKED, ONPATH, BOOKMARKED } |
Flags for VisualNodes. More... | |
![]() | |
enum | SpaceNodeFlags { HASOPENCHILDREN = FIRSTBIT, HASFAILEDCHILDREN, HASSOLVEDCHILDREN } |
Flags for SpaceNodes. More... | |
Protected Member Functions | |
bool | containsCoordinateAtDepth (int x, int depth) |
Check if the x at depth depth lies in this subtree. More... | |
![]() | |
void | setDistance (unsigned int d) |
Set distance from copy. More... | |
unsigned int | getDistance (void) const |
Return distance from copy. More... | |
void | setFlag (int flag, bool value) |
Set status flag. More... | |
bool | getFlag (int flag) const |
Return status flag. More... | |
void | setStatus (NodeStatus s) |
Set status to s. More... | |
void | acquireSpace (NodeAllocator &na, BestNode *curBest, int c_d, int a_d) |
Acquire working space, either from parent or by recomputation. More... | |
![]() | |
bool | isUndetermined (void) const |
Return whether this node is undetermined. More... | |
int | getChild (int n) const |
Return index of child no n. More... | |
Protected Attributes | |
int | offset |
Relative offset from the parent node. More... | |
Shape * | shape |
Shape of this node. More... | |
![]() | |
Space * | copy |
A copy used for recomputation, or NULL. More... | |
const Choice * | choice |
unsigned int | nstatus |
Status of the node. More... | |
Additional Inherited Members | |
![]() | |
typedef NodeAllocatorBase< VisualNode > | NodeAllocator |
![]() | |
static const int | LASTBIT = HASSOLVEDCHILDREN |
Last bit used for SpaceNode flags. More... | |
Node class that supports visual layout
Definition at line 129 of file visualnode.hh.
|
protected |
Flags for VisualNodes.
Enumerator | |
---|---|
DIRTY | |
CHILDRENLAYOUTDONE | |
HIDDEN | |
MARKED | |
ONPATH | |
BOOKMARKED |
Definition at line 132 of file visualnode.hh.
Gecode::Gist::VisualNode::VisualNode | ( | int | p | ) |
Construct with parent p.
Definition at line 73 of file visualnode.cpp.
Gecode::Gist::VisualNode::VisualNode | ( | Space * | root | ) |
Constructor for root node from root and b.
Definition at line 86 of file visualnode.cpp.
|
protected |
Check if the x at depth depth lies in this subtree.
Definition at line 237 of file visualnode.cpp.
|
inline |
Return if node is hidden.
Definition at line 133 of file visualnode.hpp.
|
inline |
Set hidden state to h.
Definition at line 138 of file visualnode.hpp.
|
inline |
Set stop state to h.
Definition at line 143 of file visualnode.hpp.
void Gecode::Gist::VisualNode::dirtyUp | ( | const NodeAllocator & | na | ) |
Mark all nodes up the path to the parent as dirty.
Definition at line 106 of file visualnode.cpp.
void Gecode::Gist::VisualNode::layout | ( | const NodeAllocator & | na | ) |
Compute layout for the subtree of this node.
Definition at line 117 of file visualnode.cpp.
|
inline |
Return offset off this node from its parent.
Definition at line 151 of file visualnode.hpp.
|
inline |
Set offset of this node, relative to its parent.
Definition at line 154 of file visualnode.hpp.
|
inline |
Return whether node is marked as dirty.
Definition at line 157 of file visualnode.hpp.
|
inline |
Mark node as dirty.
Definition at line 162 of file visualnode.hpp.
|
inline |
Return whether the layout of the node's children has been completed.
Definition at line 167 of file visualnode.hpp.
|
inline |
Mark node whether the layout of the node's children has been completed.
Definition at line 172 of file visualnode.hpp.
|
inline |
Return whether node is marked.
Definition at line 177 of file visualnode.hpp.
|
inline |
Set mark of this node.
Definition at line 182 of file visualnode.hpp.
|
inline |
Return whether node is bookmarked.
Definition at line 187 of file visualnode.hpp.
|
inline |
Set bookmark of this node.
Definition at line 192 of file visualnode.hpp.
void Gecode::Gist::VisualNode::pathUp | ( | const NodeAllocator & | na | ) |
Set all nodes from the node to the root to be on the path.
Definition at line 131 of file visualnode.cpp.
void Gecode::Gist::VisualNode::unPathUp | ( | const NodeAllocator & | na | ) |
Set all nodes from the node to the root not to be on the path.
Definition at line 139 of file visualnode.cpp.
|
inline |
Return whether node is on the path.
Definition at line 197 of file visualnode.hpp.
int Gecode::Gist::VisualNode::getPathAlternative | ( | const NodeAllocator & | na | ) |
Return the alternative of the child that is on the path (-1 if none)
Definition at line 148 of file visualnode.cpp.
|
inline |
Set whether node is on the path.
Definition at line 202 of file visualnode.hpp.
void Gecode::Gist::VisualNode::toggleHidden | ( | const NodeAllocator & | na | ) |
Toggle whether this node is hidden.
Definition at line 157 of file visualnode.cpp.
void Gecode::Gist::VisualNode::hideFailed | ( | const NodeAllocator & | na, |
bool | onlyDirty = false |
||
) |
Hide all failed subtrees of this node.
Definition at line 163 of file visualnode.cpp.
void Gecode::Gist::VisualNode::unhideAll | ( | const NodeAllocator & | na | ) |
Unhide all nodes in the subtree of this node.
Definition at line 211 of file visualnode.cpp.
void Gecode::Gist::VisualNode::toggleStop | ( | const NodeAllocator & | na | ) |
Do not stop at this node.
Definition at line 218 of file visualnode.cpp.
void Gecode::Gist::VisualNode::unstopAll | ( | const NodeAllocator & | na | ) |
Do not stop at any stop node in the subtree of this node.
Definition at line 227 of file visualnode.cpp.
|
inline |
Return the shape of this node.
Definition at line 207 of file visualnode.hpp.
void Gecode::Gist::VisualNode::setShape | ( | Shape * | s | ) |
Set the shape of this node.
Definition at line 395 of file visualnode.cpp.
void Gecode::Gist::VisualNode::computeShape | ( | const NodeAllocator & | na, |
VisualNode * | root | ||
) |
Compute the shape according to the shapes of the children.
Definition at line 403 of file visualnode.cpp.
|
inline |
Return the bounding box.
Definition at line 212 of file visualnode.hpp.
void Gecode::Gist::VisualNode::changedStatus | ( | const NodeAllocator & | na | ) |
Signal that the status has changed.
Definition at line 234 of file visualnode.cpp.
VisualNode * Gecode::Gist::VisualNode::findNode | ( | const NodeAllocator & | na, |
int | x, | ||
int | y | ||
) |
Find a node in this subtree at coordinates x, y.
Definition at line 253 of file visualnode.cpp.
void Gecode::Gist::VisualNode::labelBranches | ( | NodeAllocator & | na, |
BestNode * | curBest, | ||
int | c_d, | ||
int | a_d | ||
) |
Create or clear branch labels in subtree.
Definition at line 170 of file visualnode.cpp.
void Gecode::Gist::VisualNode::labelPath | ( | NodeAllocator & | na, |
BestNode * | curBest, | ||
int | c_d, | ||
int | a_d | ||
) |
Create or clear branch labels on path to root.
Definition at line 179 of file visualnode.cpp.
std::string Gecode::Gist::VisualNode::getBranchLabel | ( | NodeAllocator & | na, |
VisualNode * | p, | ||
const Choice * | c, | ||
BestNode * | curBest, | ||
int | c_d, | ||
int | a_d, | ||
int | alt | ||
) |
Return string that describes the branch.
Definition at line 288 of file visualnode.cpp.
std::string Gecode::Gist::VisualNode::toolTip | ( | NodeAllocator & | na, |
BestNode * | curBest, | ||
int | c_d, | ||
int | a_d | ||
) |
Return string that is used as a tool tip.
Definition at line 283 of file visualnode.cpp.
void Gecode::Gist::VisualNode::dispose | ( | void | ) |
Free allocated memory.
Definition at line 100 of file visualnode.cpp.
|
protected |
Relative offset from the parent node.
Definition at line 142 of file visualnode.hh.
|
protected |
Shape of this node.
Definition at line 144 of file visualnode.hh.