| 52 | |
| 53 | template<typename T> |
| 54 | static void setUnion(LabelNode<T>* x, LabelNode<T>* y) { |
| 55 | LabelNode<T>* xRoot = find(x); |
| 56 | LabelNode<T>* yRoot = find(y); |
| 57 | if (xRoot == yRoot) return; |
| 58 | |
| 59 | T xMinLabel = xRoot->getMinLabel(); |
| 60 | T yMinLabel = yRoot->getMinLabel(); |
| 61 | xRoot->setMinLabel(std::min(xMinLabel, yMinLabel)); |
| 62 | yRoot->setMinLabel(std::min(xMinLabel, yMinLabel)); |
| 63 | |
| 64 | if (xRoot->getRank() < yRoot->getRank()) |
| 65 | xRoot->setParent(yRoot); |
| 66 | else if (xRoot->getRank() > yRoot->getRank()) |
| 67 | yRoot->setParent(xRoot); |
| 68 | else { |
| 69 | yRoot->setParent(xRoot); |
| 70 | xRoot->setRank(xRoot->getRank() + 1); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | template<typename T> |
| 75 | void regions(Param<T> out, CParam<char> in, af_connectivity connectivity) { |
no test coverage detected