37 LinkPath::LinkPath(
Link* base)
44 void LinkPath::find(
Link* root,
bool doUpward,
bool doDownward)
46 throw "The find method for LinkTraverse cannot be used in LinkPath";
53 numUpwardConnections = 0;
54 bool found = findPathSub(base, 0, end,
false);
62 bool LinkPath::findPathSub(
Link* link,
Link* prev,
Link* end,
bool isUpward)
64 links.push_back(link);
66 ++numUpwardConnections;
75 if(findPathSub(child, link, end,
false)){
82 if(parent && parent != prev){
83 if(findPathSub(parent, link, end,
true)){
90 --numUpwardConnections;
98 void LinkPath::find(
Link* end)
101 numUpwardConnections = 0;
102 findPathFromRootSub(end);
103 std::reverse(links.begin(), links.end());
107 void LinkPath::findPathFromRootSub(
Link* link)
109 links.push_back(link);
111 findPathFromRootSub(link->
parent);