Skip to content

Commit

Permalink
Applied automated pretty printing.
Browse files Browse the repository at this point in the history
  • Loading branch information
koschke committed Sep 14, 2023
1 parent 39b36b3 commit b98355d
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions Assets/SEE/Tools/ReflexionAnalysis/ReflexionGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,14 @@ public override void RemoveEdge(Edge edge)
}
switch (edge.GetSubgraph())
{
case Architecture: RemoveFromArchitecture(edge);
case Architecture:
RemoveFromArchitecture(edge);
break;
case Implementation: RemoveFromImplementation(edge);
case Implementation:
RemoveFromImplementation(edge);
break;
case Mapping: RemoveFromMapping(edge);
case Mapping:
RemoveFromMapping(edge);
break;
default: throw new NotSupportedException("Given edge must be in reflexion graph!");
}
Expand Down Expand Up @@ -317,9 +320,11 @@ public override void AddEdge(Edge edge)
}
switch (DetermineSubgraph(edge))
{
case Architecture: AddToArchitecture(edge);
case Architecture:
AddToArchitecture(edge);
break;
case Implementation: AddToImplementation(edge);
case Implementation:
AddToImplementation(edge);
break;
case Mapping: throw new NotSupportedException("Call `AddToMapping` if you wish to create a MapsTo edge.");
default: throw new NotSupportedException("Given edge must either be in architecture or implementation graph!");
Expand Down Expand Up @@ -433,33 +438,32 @@ private static ReflexionSubgraph DetermineSubgraph(GraphElement element)
switch (element)
{
// Node with a parent:
case Node { Parent: {} } node:
case Node { Parent: { } } node:
subgraph = DetermineSubgraph(node.Parent);
break;
case Edge edge:
{
subgraph = DetermineSubgraph(edge.Source);
ReflexionSubgraph target = DetermineSubgraph(edge.Target);
if (subgraph == Implementation && target == Architecture)
{
// If edge had the MapsTo type, its subgraph would already reflect that.
throw new NotSupportedException("Mapping edge must have type MapsTo!\n"
+ $"(Offending edge: {edge.ToShortString()})");
subgraph = DetermineSubgraph(edge.Source);
ReflexionSubgraph target = DetermineSubgraph(edge.Target);
if (subgraph == Implementation && target == Architecture)
{
// If edge had the MapsTo type, its subgraph would already reflect that.
throw new NotSupportedException("Mapping edge must have type MapsTo!\n"
+ $"(Offending edge: {edge.ToShortString()})");
}
if (subgraph != target)
{
throw new NotSupportedException("Edge must be connected to nodes within the same graph!\n"
+ $"(Offending edge: {edge.ToShortString()})");
}
break;
}
if (subgraph != target)
{
throw new NotSupportedException("Edge must be connected to nodes within the same graph!\n"
+ $"(Offending edge: {edge.ToShortString()})");
}

break;
}
default: subgraph = None;
default:
subgraph = None;
break;
}
}
return subgraph;
}

}
}

0 comments on commit b98355d

Please sign in to comment.