src: Rename aggregation edge to bundled edges (#1051)
The term aggregation is misleading. Bundled edges is a better definition for this type of edge. closes #962
This commit is contained in:
@@ -147,8 +147,8 @@ add_files(
|
||||
data/graph/token_component/TokenComponentAbstraction.h
|
||||
data/graph/token_component/TokenComponentAccess.cpp
|
||||
data/graph/token_component/TokenComponentAccess.h
|
||||
data/graph/token_component/TokenComponentAggregation.cpp
|
||||
data/graph/token_component/TokenComponentAggregation.h
|
||||
data/graph/token_component/TokenComponentBundledEdges.cpp
|
||||
data/graph/token_component/TokenComponentBundledEdges.h
|
||||
data/graph/token_component/TokenComponentConst.cpp
|
||||
data/graph/token_component/TokenComponentConst.h
|
||||
data/graph/token_component/TokenComponentFilePath.cpp
|
||||
|
||||
@@ -24,12 +24,12 @@ void ActivationController::clear() {}
|
||||
|
||||
void ActivationController::handleMessage(MessageActivateEdge* message)
|
||||
{
|
||||
if (message->isAggregation())
|
||||
if (message->isBundledEdges())
|
||||
{
|
||||
MessageActivateTokens m(message);
|
||||
m.tokenIds = message->aggregationIds;
|
||||
m.tokenIds = message->bundledEdgesIds;
|
||||
m.setKeepContent(false);
|
||||
m.isAggregation = true;
|
||||
m.isBundledEdges = true;
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -209,10 +209,10 @@ void BookmarkController::activateBookmark(const std::shared_ptr<Bookmark> bookma
|
||||
else
|
||||
{
|
||||
MessageActivateEdge activateEdge(
|
||||
0, Edge::EdgeType::EDGE_AGGREGATION, sourceName, targetName);
|
||||
for (const Id aggregatedEdgeId: edgeBookmark->getEdgeIds())
|
||||
0, Edge::EdgeType::EDGE_BUNDLED_EDGES, sourceName, targetName);
|
||||
for (const Id bundledEdgeId: edgeBookmark->getEdgeIds())
|
||||
{
|
||||
activateEdge.aggregationIds.push_back(aggregatedEdgeId);
|
||||
activateEdge.bundledEdgesIds.push_back(bundledEdgeId);
|
||||
}
|
||||
activateEdge.dispatch();
|
||||
}
|
||||
@@ -318,7 +318,7 @@ void BookmarkController::handleMessage(MessageActivateTokens* message)
|
||||
Id tabId = message->getSchedulerId();
|
||||
m_activeEdgeIds[tabId].clear();
|
||||
|
||||
if (message->isEdge || message->isAggregation)
|
||||
if (message->isEdge || message->isBundledEdges)
|
||||
{
|
||||
m_activeEdgeIds[tabId] = message->tokenIds;
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ void CodeController::handleMessage(MessageActivateTokens* message)
|
||||
params.clearSnippets = true;
|
||||
|
||||
Id declarationId = 0; // 0 means that no token is found.
|
||||
if (!message->isAggregation)
|
||||
if (!message->isBundledEdges)
|
||||
{
|
||||
std::vector<Id> activeTokenIds;
|
||||
for (Id tokenId: params.activeTokenIds)
|
||||
|
||||
@@ -98,7 +98,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
if (message->isEdge || message->keepContent())
|
||||
{
|
||||
m_activeEdgeIds = message->tokenIds;
|
||||
if (message->isAggregation) // only on redo
|
||||
if (message->isBundledEdges) // only on redo
|
||||
{
|
||||
m_activeEdgeIds.clear();
|
||||
}
|
||||
@@ -119,7 +119,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
getView()->activateEdge(edgeId);
|
||||
return;
|
||||
}
|
||||
else if (message->isAggregation)
|
||||
else if (message->isBundledEdges)
|
||||
{
|
||||
m_activeNodeIds.clear();
|
||||
m_activeEdgeIds = message->tokenIds;
|
||||
@@ -166,7 +166,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
{
|
||||
bundleNodes();
|
||||
}
|
||||
else if (message->isAggregation)
|
||||
else if (message->isBundledEdges)
|
||||
{
|
||||
bool isInheritanceChain = true;
|
||||
for (const auto& edge: m_dummyEdges)
|
||||
@@ -489,22 +489,22 @@ void GraphController::handleMessage(MessageGraphNodeExpand* message)
|
||||
{
|
||||
std::shared_ptr<DummyEdge> edge = m_dummyEdges[i];
|
||||
|
||||
if (edge && edge->data && edge->data->isType(Edge::EDGE_AGGREGATION) &&
|
||||
if (edge && edge->data && edge->data->isType(Edge::EDGE_BUNDLED_EDGES) &&
|
||||
(edge->targetId == dummyNode->tokenId || edge->ownerId == dummyNode->tokenId))
|
||||
{
|
||||
std::vector<Id> aggregationIds = utility::toVector<Id>(
|
||||
edge->data->getComponent<TokenComponentAggregation>()->getAggregationIds());
|
||||
std::vector<Id> bundledEdgesIds = utility::toVector<Id>(
|
||||
edge->data->getComponent<TokenComponentBundledEdges>()->getBundledEdgesIds());
|
||||
|
||||
if (m_graph->getEdgeById(aggregationIds[0]) != nullptr)
|
||||
if (m_graph->getEdgeById(bundledEdgesIds[0]) != nullptr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
std::shared_ptr<Graph> aggregationGraph =
|
||||
std::shared_ptr<Graph> bundledEdgesGraph =
|
||||
m_storageAccess->getGraphForActiveTokenIds(
|
||||
aggregationIds, std::vector<Id>());
|
||||
bundledEdgesIds, std::vector<Id>());
|
||||
|
||||
aggregationGraph->forEachEdge([this](Edge* e) {
|
||||
bundledEdgesGraph->forEachEdge([this](Edge* e) {
|
||||
if (!e->isType(Edge::EDGE_MEMBER))
|
||||
{
|
||||
m_dummyEdges.push_back(std::make_shared<DummyEdge>(
|
||||
@@ -1085,25 +1085,25 @@ void GraphController::bundleNodes()
|
||||
bundleInfo->isReferencing = false;
|
||||
}
|
||||
|
||||
if (e->isType(Edge::EDGE_AGGREGATION))
|
||||
if (e->isType(Edge::EDGE_BUNDLED_EDGES))
|
||||
{
|
||||
TokenComponentAggregation::Direction dir =
|
||||
e->getComponent<TokenComponentAggregation>()->getDirection();
|
||||
TokenComponentBundledEdges::Direction dir =
|
||||
e->getComponent<TokenComponentBundledEdges>()->getDirection();
|
||||
|
||||
if (dir == TokenComponentAggregation::DIRECTION_NONE)
|
||||
if (dir == TokenComponentBundledEdges::DIRECTION_NONE)
|
||||
{
|
||||
bundleInfo->isReferenced = true;
|
||||
bundleInfo->isReferencing = true;
|
||||
}
|
||||
else if (
|
||||
(dir == TokenComponentAggregation::DIRECTION_FORWARD && e->getFrom() == n) ||
|
||||
(dir == TokenComponentAggregation::DIRECTION_BACKWARD && e->getTo() == n))
|
||||
(dir == TokenComponentBundledEdges::DIRECTION_FORWARD && e->getFrom() == n) ||
|
||||
(dir == TokenComponentBundledEdges::DIRECTION_BACKWARD && e->getTo() == n))
|
||||
{
|
||||
bundleInfo->isReferencing = true;
|
||||
}
|
||||
else if (
|
||||
(dir == TokenComponentAggregation::DIRECTION_FORWARD && e->getTo() == n) ||
|
||||
(dir == TokenComponentAggregation::DIRECTION_BACKWARD && e->getFrom() == n))
|
||||
(dir == TokenComponentBundledEdges::DIRECTION_FORWARD && e->getTo() == n) ||
|
||||
(dir == TokenComponentBundledEdges::DIRECTION_BACKWARD && e->getFrom() == n))
|
||||
{
|
||||
bundleInfo->isReferenced = true;
|
||||
}
|
||||
@@ -2041,7 +2041,7 @@ Vec4i GraphController::layoutNestingRecursive(DummyNode* node, int relayoutAcces
|
||||
break;
|
||||
|
||||
case GroupLayout::BUCKET:
|
||||
if (node->hasActiveSubNode() || !m_activeNodeIds.size() /* aggregations */)
|
||||
if (node->hasActiveSubNode() || !m_activeNodeIds.size() /* bundled edges */)
|
||||
{
|
||||
BucketLayouter grid(viewSize);
|
||||
grid.createBuckets(node->subNodes, m_dummyEdges);
|
||||
@@ -2446,25 +2446,25 @@ void GraphController::createLegendGraph()
|
||||
addEdge(Edge::EDGE_INHERITANCE, derived, main);
|
||||
|
||||
{
|
||||
Edge* edge = addEdge(Edge::EDGE_AGGREGATION, user, main);
|
||||
std::shared_ptr<TokenComponentAggregation> aggregationComp =
|
||||
std::make_shared<TokenComponentAggregation>();
|
||||
Edge* edge = addEdge(Edge::EDGE_BUNDLED_EDGES, user, main);
|
||||
std::shared_ptr<TokenComponentBundledEdges> bundledEdgesComp =
|
||||
std::make_shared<TokenComponentBundledEdges>();
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
{
|
||||
aggregationComp->addAggregationId(++id, true);
|
||||
bundledEdgesComp->addBundledEdgesId(++id, true);
|
||||
}
|
||||
edge->addComponent(aggregationComp);
|
||||
edge->addComponent(bundledEdgesComp);
|
||||
}
|
||||
|
||||
{
|
||||
Edge* edge = addEdge(Edge::EDGE_AGGREGATION, main, usee);
|
||||
std::shared_ptr<TokenComponentAggregation> aggregationComp =
|
||||
std::make_shared<TokenComponentAggregation>();
|
||||
Edge* edge = addEdge(Edge::EDGE_BUNDLED_EDGES, main, usee);
|
||||
std::shared_ptr<TokenComponentBundledEdges> bundledEdgesComp =
|
||||
std::make_shared<TokenComponentBundledEdges>();
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
{
|
||||
aggregationComp->addAggregationId(++id, true);
|
||||
bundledEdgesComp->addBundledEdgesId(++id, true);
|
||||
}
|
||||
edge->addComponent(aggregationComp);
|
||||
edge->addComponent(bundledEdgesComp);
|
||||
}
|
||||
|
||||
Node* publicMethod = addNode(NODE_METHOD, L"public method", Vec2i());
|
||||
@@ -2622,17 +2622,17 @@ void GraphController::createLegendGraph()
|
||||
}
|
||||
|
||||
{
|
||||
addText(L"aggregation", 0, Vec2i(x, y + dy * ++i));
|
||||
addText(L"bundled edges", 0, Vec2i(x, y + dy * ++i));
|
||||
Node* typeA = addNode(NODE_TYPE, L"Type A", Vec2i(x, y + dy * ++i));
|
||||
Node* typeB = addNode(NODE_TYPE, L"Type B", Vec2i(x + dx, y + dy * i));
|
||||
Edge* edge = addEdge(Edge::EDGE_AGGREGATION, typeA, typeB);
|
||||
std::shared_ptr<TokenComponentAggregation> aggregationComp =
|
||||
std::make_shared<TokenComponentAggregation>();
|
||||
Edge* edge = addEdge(Edge::EDGE_BUNDLED_EDGES, typeA, typeB);
|
||||
std::shared_ptr<TokenComponentBundledEdges> bundledEdgesComp =
|
||||
std::make_shared<TokenComponentBundledEdges>();
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
{
|
||||
aggregationComp->addAggregationId(++id, true);
|
||||
bundledEdgesComp->addBundledEdgesId(++id, true);
|
||||
}
|
||||
edge->addComponent(aggregationComp);
|
||||
edge->addComponent(bundledEdgesComp);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -349,7 +349,7 @@ void UndoRedoController::handleMessage(MessageIndexingFinished* message)
|
||||
MessageActivateTokens* msg = dynamic_cast<MessageActivateTokens*>(command.message.get());
|
||||
if (msg)
|
||||
{
|
||||
if (msg->isAggregation)
|
||||
if (msg->isBundledEdges)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -498,7 +498,7 @@ void UndoRedoController::replayCommand(std::list<Command>::iterator it)
|
||||
{
|
||||
MessageActivateTokens* msg = dynamic_cast<MessageActivateTokens*>(m.get());
|
||||
|
||||
if (!msg->isEdge && !msg->isAggregation)
|
||||
if (!msg->isEdge && !msg->isBundledEdges)
|
||||
{
|
||||
std::vector<SearchMatch> matches = msg->getSearchMatches();
|
||||
msg->searchMatches.clear();
|
||||
|
||||
@@ -310,9 +310,9 @@ void BucketLayouter::createBuckets(
|
||||
}
|
||||
}
|
||||
else if (
|
||||
edge->getDirection() == TokenComponentAggregation::DIRECTION_BACKWARD ||
|
||||
edge->getDirection() == TokenComponentBundledEdges::DIRECTION_BACKWARD ||
|
||||
// put nodes with bidirectional edges on the left
|
||||
(edge->getDirection() == TokenComponentAggregation::DIRECTION_NONE &&
|
||||
(edge->getDirection() == TokenComponentBundledEdges::DIRECTION_NONE &&
|
||||
!target->bundleInfo.isReferencing && !target->bundleInfo.isReferenced))
|
||||
{
|
||||
std::swap(owner, target);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "types.h"
|
||||
|
||||
#include "Edge.h"
|
||||
#include "TokenComponentAggregation.h"
|
||||
#include "TokenComponentBundledEdges.h"
|
||||
|
||||
class Edge;
|
||||
|
||||
@@ -21,7 +21,7 @@ struct DummyEdge
|
||||
, active(false)
|
||||
, layoutHorizontal(true)
|
||||
, weight(0)
|
||||
, direction(TokenComponentAggregation::DIRECTION_INVALID)
|
||||
, direction(TokenComponentBundledEdges::DIRECTION_INVALID)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ struct DummyEdge
|
||||
, active(false)
|
||||
, layoutHorizontal(true)
|
||||
, weight(0)
|
||||
, direction(TokenComponentAggregation::DIRECTION_INVALID)
|
||||
, direction(TokenComponentBundledEdges::DIRECTION_INVALID)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -44,43 +44,43 @@ struct DummyEdge
|
||||
{
|
||||
return weight;
|
||||
}
|
||||
else if (data->isType(Edge::EDGE_AGGREGATION))
|
||||
else if (data->isType(Edge::EDGE_BUNDLED_EDGES))
|
||||
{
|
||||
return data->getComponent<TokenComponentAggregation>()->getAggregationCount();
|
||||
return data->getComponent<TokenComponentBundledEdges>()->getBundledEdgesCount();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void updateDirection(TokenComponentAggregation::Direction dir, bool invert)
|
||||
void updateDirection(TokenComponentBundledEdges::Direction dir, bool invert)
|
||||
{
|
||||
if (invert)
|
||||
{
|
||||
dir = TokenComponentAggregation::opposite(dir);
|
||||
dir = TokenComponentBundledEdges::opposite(dir);
|
||||
}
|
||||
|
||||
if (direction == TokenComponentAggregation::DIRECTION_INVALID)
|
||||
if (direction == TokenComponentBundledEdges::DIRECTION_INVALID)
|
||||
{
|
||||
direction = dir;
|
||||
}
|
||||
else if (direction != dir)
|
||||
{
|
||||
direction = TokenComponentAggregation::DIRECTION_NONE;
|
||||
direction = TokenComponentBundledEdges::DIRECTION_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
TokenComponentAggregation::Direction getDirection() const
|
||||
TokenComponentBundledEdges::Direction getDirection() const
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
return direction;
|
||||
}
|
||||
else if (data->isType(Edge::EDGE_AGGREGATION))
|
||||
else if (data->isType(Edge::EDGE_BUNDLED_EDGES))
|
||||
{
|
||||
return data->getComponent<TokenComponentAggregation>()->getDirection();
|
||||
return data->getComponent<TokenComponentBundledEdges>()->getDirection();
|
||||
}
|
||||
|
||||
return TokenComponentAggregation::DIRECTION_FORWARD;
|
||||
return TokenComponentBundledEdges::DIRECTION_FORWARD;
|
||||
}
|
||||
|
||||
Id ownerId;
|
||||
@@ -98,7 +98,7 @@ struct DummyEdge
|
||||
|
||||
// BundleEdge
|
||||
int weight;
|
||||
TokenComponentAggregation::Direction direction;
|
||||
TokenComponentBundledEdges::Direction direction;
|
||||
};
|
||||
|
||||
#endif // DUMMY_EDGE_H
|
||||
|
||||
@@ -671,7 +671,7 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case Edge::EDGE_AGGREGATION:
|
||||
case Edge::EDGE_BUNDLED_EDGES:
|
||||
style.width = 3;
|
||||
style.arrowLength = 7;
|
||||
style.arrowWidth = 10;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "Node.h"
|
||||
#include "TokenComponentAggregation.h"
|
||||
#include "TokenComponentBundledEdges.h"
|
||||
#include "logging.h"
|
||||
#include "utilityString.h"
|
||||
|
||||
@@ -36,8 +36,8 @@ Edge::EdgeType Edge::intToType(int value)
|
||||
return EDGE_INCLUDE;
|
||||
case EDGE_IMPORT:
|
||||
return EDGE_IMPORT;
|
||||
case EDGE_AGGREGATION:
|
||||
return EDGE_AGGREGATION;
|
||||
case EDGE_BUNDLED_EDGES:
|
||||
return EDGE_BUNDLED_EDGES;
|
||||
case EDGE_MACRO_USAGE:
|
||||
return EDGE_MACRO_USAGE;
|
||||
case EDGE_ANNOTATION_USAGE:
|
||||
@@ -139,8 +139,8 @@ std::wstring Edge::getReadableTypeString(EdgeType type)
|
||||
return L"include";
|
||||
case EDGE_IMPORT:
|
||||
return L"import";
|
||||
case EDGE_AGGREGATION:
|
||||
return L"aggregation";
|
||||
case EDGE_BUNDLED_EDGES:
|
||||
return L"bundled edges";
|
||||
case EDGE_MACRO_USAGE:
|
||||
return L"macro use";
|
||||
case EDGE_ANNOTATION_USAGE:
|
||||
@@ -175,10 +175,10 @@ std::wstring Edge::getAsString() const
|
||||
str << L"[" << getId() << L"] " << getReadableTypeString();
|
||||
str << L": \"" << m_from->getName() << L"\" -> \"" + m_to->getName() << L"\"";
|
||||
|
||||
TokenComponentAggregation* aggregation = getComponent<TokenComponentAggregation>();
|
||||
if (aggregation)
|
||||
TokenComponentBundledEdges* bundledEdges = getComponent<TokenComponentBundledEdges>();
|
||||
if (bundledEdges)
|
||||
{
|
||||
str << L" " << aggregation->getAggregationCount();
|
||||
str << L" " << bundledEdges->getBundledEdgesCount();
|
||||
}
|
||||
|
||||
return str.str();
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
EDGE_TEMPLATE_SPECIALIZATION = 1 << 7,
|
||||
EDGE_INCLUDE = 1 << 8,
|
||||
EDGE_IMPORT = 1 << 9,
|
||||
EDGE_AGGREGATION = 1 << 10,
|
||||
EDGE_BUNDLED_EDGES = 1 << 10,
|
||||
EDGE_MACRO_USAGE = 1 << 11,
|
||||
EDGE_ANNOTATION_USAGE = 1 << 12,
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#ifndef TOKEN_COMPONENT_AGGREGATION_H
|
||||
#define TOKEN_COMPONENT_AGGREGATION_H
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "TokenComponent.h"
|
||||
|
||||
class TokenComponentAggregation: public TokenComponent
|
||||
{
|
||||
public:
|
||||
enum Direction
|
||||
{
|
||||
DIRECTION_NONE,
|
||||
DIRECTION_FORWARD,
|
||||
DIRECTION_BACKWARD,
|
||||
DIRECTION_INVALID
|
||||
};
|
||||
|
||||
static Direction opposite(Direction direction);
|
||||
|
||||
TokenComponentAggregation();
|
||||
virtual ~TokenComponentAggregation();
|
||||
|
||||
virtual std::shared_ptr<TokenComponent> copy() const;
|
||||
|
||||
int getAggregationCount() const;
|
||||
std::set<Id> getAggregationIds() const;
|
||||
|
||||
void addAggregationId(Id id, bool forward);
|
||||
void removeAggregationId(Id id);
|
||||
|
||||
Direction getDirection();
|
||||
|
||||
private:
|
||||
std::map<Id, Direction> m_ids;
|
||||
Direction m_direction;
|
||||
};
|
||||
|
||||
#endif // TOKEN_COMPONENT_AGGREGATION_H
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
#include "TokenComponentAggregation.h"
|
||||
#include "TokenComponentBundledEdges.h"
|
||||
|
||||
TokenComponentAggregation::Direction TokenComponentAggregation::opposite(Direction direction)
|
||||
TokenComponentBundledEdges::Direction TokenComponentBundledEdges::opposite(Direction direction)
|
||||
{
|
||||
if (direction == DIRECTION_FORWARD)
|
||||
{
|
||||
@@ -14,21 +14,21 @@ TokenComponentAggregation::Direction TokenComponentAggregation::opposite(Directi
|
||||
return direction;
|
||||
}
|
||||
|
||||
TokenComponentAggregation::TokenComponentAggregation(): m_direction(DIRECTION_INVALID) {}
|
||||
TokenComponentBundledEdges::TokenComponentBundledEdges(): m_direction(DIRECTION_INVALID) {}
|
||||
|
||||
TokenComponentAggregation::~TokenComponentAggregation() {}
|
||||
TokenComponentBundledEdges::~TokenComponentBundledEdges() {}
|
||||
|
||||
std::shared_ptr<TokenComponent> TokenComponentAggregation::copy() const
|
||||
std::shared_ptr<TokenComponent> TokenComponentBundledEdges::copy() const
|
||||
{
|
||||
return std::make_shared<TokenComponentAggregation>(*this);
|
||||
return std::make_shared<TokenComponentBundledEdges>(*this);
|
||||
}
|
||||
|
||||
int TokenComponentAggregation::getAggregationCount() const
|
||||
int TokenComponentBundledEdges::getBundledEdgesCount() const
|
||||
{
|
||||
return static_cast<int>(m_ids.size());
|
||||
}
|
||||
|
||||
std::set<Id> TokenComponentAggregation::getAggregationIds() const
|
||||
std::set<Id> TokenComponentBundledEdges::getBundledEdgesIds() const
|
||||
{
|
||||
std::set<Id> ids;
|
||||
|
||||
@@ -40,21 +40,21 @@ std::set<Id> TokenComponentAggregation::getAggregationIds() const
|
||||
return ids;
|
||||
}
|
||||
|
||||
void TokenComponentAggregation::addAggregationId(Id id, bool forward)
|
||||
void TokenComponentBundledEdges::addBundledEdgesId(Id id, bool forward)
|
||||
{
|
||||
m_ids.emplace(id, forward ? DIRECTION_FORWARD : DIRECTION_BACKWARD);
|
||||
|
||||
m_direction = DIRECTION_INVALID;
|
||||
}
|
||||
|
||||
void TokenComponentAggregation::removeAggregationId(Id id)
|
||||
void TokenComponentBundledEdges::removeBundledEdgesId(Id id)
|
||||
{
|
||||
m_ids.erase(id);
|
||||
|
||||
m_direction = DIRECTION_INVALID;
|
||||
}
|
||||
|
||||
TokenComponentAggregation::Direction TokenComponentAggregation::getDirection()
|
||||
TokenComponentBundledEdges::Direction TokenComponentBundledEdges::getDirection()
|
||||
{
|
||||
if (m_direction != DIRECTION_INVALID)
|
||||
{
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef TOKEN_COMPONENT_BUNDLED_EDGES_H
|
||||
#define TOKEN_COMPONENT_BUNDLED_EDGES_H
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "TokenComponent.h"
|
||||
|
||||
class TokenComponentBundledEdges: public TokenComponent
|
||||
{
|
||||
public:
|
||||
enum Direction
|
||||
{
|
||||
DIRECTION_NONE,
|
||||
DIRECTION_FORWARD,
|
||||
DIRECTION_BACKWARD,
|
||||
DIRECTION_INVALID
|
||||
};
|
||||
|
||||
static Direction opposite(Direction direction);
|
||||
|
||||
TokenComponentBundledEdges();
|
||||
virtual ~TokenComponentBundledEdges();
|
||||
|
||||
virtual std::shared_ptr<TokenComponent> copy() const;
|
||||
|
||||
int getBundledEdgesCount() const;
|
||||
std::set<Id> getBundledEdgesIds() const;
|
||||
|
||||
void addBundledEdgesId(Id id, bool forward);
|
||||
void removeBundledEdgesId(Id id);
|
||||
|
||||
Direction getDirection();
|
||||
|
||||
private:
|
||||
std::map<Id, Direction> m_ids;
|
||||
Direction m_direction;
|
||||
};
|
||||
|
||||
#endif // TOKEN_COMPONENT_BUNDLED_EDGES_H
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "TextCodec.h"
|
||||
#include "TimeStamp.h"
|
||||
#include "TokenComponentAccess.h"
|
||||
#include "TokenComponentAggregation.h"
|
||||
#include "TokenComponentBundledEdges.h"
|
||||
#include "TokenComponentFilePath.h"
|
||||
#include "TokenComponentInheritanceChain.h"
|
||||
#include "TokenComponentIsAmbiguous.h"
|
||||
@@ -1102,8 +1102,8 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForActiveTokenIds(
|
||||
std::vector<Id> nodeIds;
|
||||
std::vector<Id> edgeIds;
|
||||
|
||||
bool addAggregations = false;
|
||||
std::vector<StorageEdge> edgesToAggregate;
|
||||
bool addBundledEdges = false;
|
||||
std::vector<StorageEdge> edgesToBundle;
|
||||
|
||||
bool addFileContents = false;
|
||||
|
||||
@@ -1150,7 +1150,7 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForActiveTokenIds(
|
||||
(m_hierarchyCache.getLastVisibleParentNodeId(edge.targetNodeId) !=
|
||||
m_hierarchyCache.getLastVisibleParentNodeId(edge.sourceNodeId)))
|
||||
{
|
||||
edgesToAggregate.push_back(edge);
|
||||
edgesToBundle.push_back(edge);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1164,7 +1164,7 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForActiveTokenIds(
|
||||
}
|
||||
else
|
||||
{
|
||||
addAggregations = true;
|
||||
addBundledEdges = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1221,9 +1221,9 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForActiveTokenIds(
|
||||
addNodesWithParentsAndEdgesToGraph(nodeIds, edgeIds, graph, true);
|
||||
}
|
||||
|
||||
if (addAggregations)
|
||||
if (addBundledEdges)
|
||||
{
|
||||
addAggregationEdgesToGraph(tokenIds[0], edgesToAggregate, graph);
|
||||
addBundledEdgesToGraph(tokenIds[0], edgesToBundle, graph);
|
||||
}
|
||||
else if (addFileContents)
|
||||
{
|
||||
@@ -2968,8 +2968,8 @@ void PersistentStorage::addNodesWithParentsAndEdgesToGraph(
|
||||
addEdgesToGraph(utility::toVector(allEdgeIds), graph);
|
||||
}
|
||||
|
||||
void PersistentStorage::addAggregationEdgesToGraph(
|
||||
Id nodeId, const std::vector<StorageEdge>& edgesToAggregate, Graph* graph) const
|
||||
void PersistentStorage::addBundledEdgesToGraph(
|
||||
Id nodeId, const std::vector<StorageEdge>& edgesToBundle, Graph* graph) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
@@ -2979,19 +2979,19 @@ void PersistentStorage::addAggregationEdgesToGraph(
|
||||
bool forward;
|
||||
};
|
||||
|
||||
// build aggregation edges:
|
||||
// build bundled edges:
|
||||
// get all children of the active node
|
||||
std::set<Id> childNodeIdsSet, edgeIdsSet;
|
||||
m_hierarchyCache.addAllChildIdsForNodeId(nodeId, &childNodeIdsSet, &edgeIdsSet);
|
||||
const std::vector<Id> childNodeIds = utility::toVector(childNodeIdsSet);
|
||||
if (childNodeIds.size() == 0 && edgesToAggregate.size() == 0)
|
||||
if (childNodeIds.size() == 0 && edgesToBundle.size() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// get all edges of the children
|
||||
std::map<Id, std::vector<EdgeInfo>> connectedNodeIds;
|
||||
for (const StorageEdge& edge: edgesToAggregate)
|
||||
for (const StorageEdge& edge: edgesToBundle)
|
||||
{
|
||||
bool isSource = nodeId == edge.sourceNodeId;
|
||||
EdgeInfo edgeInfo;
|
||||
@@ -3038,38 +3038,38 @@ void PersistentStorage::addAggregationEdgesToGraph(
|
||||
std::vector<Id> nodeIdsToAdd;
|
||||
for (const std::pair<Id, std::vector<EdgeInfo>>& p: connectedParentNodeIds)
|
||||
{
|
||||
const Id aggregationTargetNodeId = p.first;
|
||||
if (!graph->getNodeById(aggregationTargetNodeId))
|
||||
const Id bundledEdgesTargetNodeId = p.first;
|
||||
if (!graph->getNodeById(bundledEdgesTargetNodeId))
|
||||
{
|
||||
nodeIdsToAdd.push_back(aggregationTargetNodeId);
|
||||
nodeIdsToAdd.push_back(bundledEdgesTargetNodeId);
|
||||
}
|
||||
}
|
||||
addNodesWithParentsAndEdgesToGraph(nodeIdsToAdd, std::vector<Id>(), graph, true);
|
||||
|
||||
// create aggregation edges between parents and active node
|
||||
// create bundled edges between parents and active node
|
||||
Node* sourceNode = graph->getNodeById(nodeId);
|
||||
for (const std::pair<Id, std::vector<EdgeInfo>>& p: connectedParentNodeIds)
|
||||
{
|
||||
const Id aggregationTargetNodeId = p.first;
|
||||
const Id bundledEdgesTargetNodeId = p.first;
|
||||
|
||||
Node* targetNode = graph->getNodeById(aggregationTargetNodeId);
|
||||
Node* targetNode = graph->getNodeById(bundledEdgesTargetNodeId);
|
||||
if (!targetNode)
|
||||
{
|
||||
LOG_ERROR("Aggregation target node not present.");
|
||||
LOG_ERROR("Bundled edges target node not present.");
|
||||
}
|
||||
|
||||
std::shared_ptr<TokenComponentAggregation> componentAggregation =
|
||||
std::make_shared<TokenComponentAggregation>();
|
||||
std::shared_ptr<TokenComponentBundledEdges> componentBundledEdges =
|
||||
std::make_shared<TokenComponentBundledEdges>();
|
||||
for (const EdgeInfo& edgeInfo: p.second)
|
||||
{
|
||||
componentAggregation->addAggregationId(edgeInfo.edgeId, edgeInfo.forward);
|
||||
componentBundledEdges->addBundledEdgesId(edgeInfo.edgeId, edgeInfo.forward);
|
||||
}
|
||||
|
||||
// Set first bit to 1 to avoid collisions
|
||||
const Id aggregationId = ~(~Id(0) >> 1) + *componentAggregation->getAggregationIds().begin();
|
||||
const Id bundledEdgesId = ~(~Id(0) >> 1) + *componentBundledEdges->getBundledEdgesIds().begin();
|
||||
|
||||
Edge* edge = graph->createEdge(aggregationId, Edge::EDGE_AGGREGATION, sourceNode, targetNode);
|
||||
edge->addComponent(componentAggregation);
|
||||
Edge* edge = graph->createEdge(bundledEdgesId, Edge::EDGE_BUNDLED_EDGES, sourceNode, targetNode);
|
||||
edge->addComponent(componentBundledEdges);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -246,8 +246,8 @@ private:
|
||||
inline void addFileNodeToGraph(const StorageNode& storageNode, Graph* const graph) const;
|
||||
void addNodeToGraph(
|
||||
const StorageNode& newNode, const NodeType& type, Graph* graph, bool addChildCount) const;
|
||||
void addAggregationEdgesToGraph(
|
||||
Id nodeId, const std::vector<StorageEdge>& edgesToAggregate, Graph* graph) const;
|
||||
void addBundledEdgesToGraph(
|
||||
Id nodeId, const std::vector<StorageEdge>& edgesToBundle, Graph* graph) const;
|
||||
void addFileContentsToGraph(Id fileId, Graph* graph) const;
|
||||
void addComponentAccessToGraph(Graph* graph) const;
|
||||
void addComponentIsAmbiguousToGraph(Graph* graph) const;
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
}
|
||||
|
||||
MessageActivateTokens(const MessageBase* other)
|
||||
: isEdge(false), isAggregation(false), isFromSearch(false)
|
||||
: isEdge(false), isBundledEdges(false), isFromSearch(false)
|
||||
{
|
||||
setIsParallel(true);
|
||||
setKeepContent(other->keepContent());
|
||||
@@ -43,10 +43,10 @@ public:
|
||||
|
||||
std::vector<SearchMatch> getSearchMatches() const override
|
||||
{
|
||||
if (isAggregation)
|
||||
if (isBundledEdges)
|
||||
{
|
||||
SearchMatch match;
|
||||
match.name = match.text = L"aggregation"; // TODO: show aggregation source and target
|
||||
match.name = match.text = L"bundled edges"; // TODO: show bundled edges source and target
|
||||
match.searchType = SearchMatch::SEARCH_TOKEN;
|
||||
match.nodeType = NodeType(NODE_TYPE);
|
||||
return {match};
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
std::vector<SearchMatch> searchMatches;
|
||||
|
||||
bool isEdge;
|
||||
bool isAggregation;
|
||||
bool isBundledEdges;
|
||||
bool isFromSearch;
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
, sourceNameHierarchy(sourceNameHierarchy)
|
||||
, targetNameHierarchy(targetNameHierarchy)
|
||||
{
|
||||
if (!isAggregation())
|
||||
if (!isBundledEdges())
|
||||
{
|
||||
setKeepContent(true);
|
||||
}
|
||||
@@ -35,9 +35,9 @@ public:
|
||||
return "MessageActivateEdge";
|
||||
}
|
||||
|
||||
bool isAggregation() const
|
||||
bool isBundledEdges() const
|
||||
{
|
||||
return type == Edge::EDGE_AGGREGATION;
|
||||
return type == Edge::EDGE_BUNDLED_EDGES;
|
||||
}
|
||||
|
||||
std::wstring getFullName() const
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
const NameHierarchy sourceNameHierarchy;
|
||||
const NameHierarchy targetNameHierarchy;
|
||||
|
||||
std::vector<Id> aggregationIds;
|
||||
std::vector<Id> bundledEdgesIds;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_ACTIVATE_EDGE_H
|
||||
|
||||
Reference in New Issue
Block a user