Add Tanks 1-5
This commit is contained in:
@@ -22,6 +22,16 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
return p;
|
||||
}
|
||||
|
||||
public Inlet CreateInlet(INode start, ISink end) {
|
||||
Nodes.Add(start);
|
||||
Nodes.Add(end);
|
||||
var p = new Inlet(start, end, start.CenterX > end.CenterX);
|
||||
start.Outputs.Add(p);
|
||||
end.Inputs.Add(p);
|
||||
Edges.Add(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
public Path? GetPath(INode start, INode end, Func<INode, bool>? valid = null) {
|
||||
if (!Nodes.Contains(start) || !Nodes.Contains(end)) throw new ArgumentException("Start/end node not contained in graph");
|
||||
valid ??= a => true;
|
||||
@@ -35,8 +45,11 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
}
|
||||
|
||||
var p = GetPath(o.End, end, valid);
|
||||
if (p != null && (path == null || p.Value.Hops.Count() + 1 < path.Value.Hops.Count())) {
|
||||
path = new(start, [(o, o.End), ..p.Value.Hops]);
|
||||
if (p != null) {
|
||||
var p2 = new Path(start, [(o, o.End), .. p.Value.Hops]);
|
||||
if (path == null || p2.Length < path.Value.Length) {
|
||||
path = p2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return path != null ? new(start, path.Value.Hops) : null;
|
||||
|
||||
Reference in New Issue
Block a user