This commit is contained in:
watrabi
2025-10-28 14:05:46 -04:00
parent 977f1ff4b8
commit c93494f795
452 changed files with 47860 additions and 152 deletions
+62
View File
@@ -0,0 +1,62 @@
/* Copyright 2003-2006 ROBLOX Corporation, All Rights Reserved */
#pragma once
#include "Util/IndexedTree.h"
namespace RBX {
class SpanningNode;
class SpanningTree;
class SpanningEdge
{
friend class SpanningTree;
private:
void removeFromSpanningTree();
void addToSpanningTree(SpanningNode* newParent);
protected:
public:
SpanningEdge() {}
virtual ~SpanningEdge() {}
bool isLighterThan(const SpanningEdge* other) const {
return other->isHeavierThan(this);
}
bool inSpanningTree() const;
SpanningNode* getChildSpanningNode();
SpanningNode* getParentSpanningNode();
const SpanningNode* getConstChildSpanningNode() const;
const SpanningNode* getConstParentSpanningNode() const;
//////////////////////////////////////////////////////////
//
virtual bool isHeavierThan(const SpanningEdge* other) const = 0;
virtual SpanningNode* otherNode(SpanningNode* n) = 0;
virtual const SpanningNode* otherConstNode(const SpanningNode* n) const = 0;
virtual SpanningNode* getNode(int i) = 0;
virtual const SpanningNode* getConstNode(int i) const = 0;
SpanningNode* otherNode(int i) {
RBXASSERT_VERY_FAST((i == 0) || (i == 1));
return getNode((i + 1) % 2);
}
//////////////////////////////////////////////////////////
//
static bool heavierEdge(const SpanningEdge* test, const SpanningEdge* other) {
return test->isHeavierThan(other);
}
};
} // namespace