public InPoint AddInConnection(InPoint inConn=null) { if (inConn==null) inConn = new InPoint(this); Input.Add(inConn); return inConn; }
protected InPoint AddInvisiblePoint(InPoint inConn = null) { var res = AddInConnection(inConn); InvisiblePoints.Add(res); return(res); }
public InPoint AddInConnection(InPoint inConn = null) { if (inConn == null) { inConn = new InPoint(this); } Input.Add(inConn); return(inConn); }
public static GraphConnection Connect(OutPoint outPoint, InPoint inPoint, int length = 1) { if (outPoint == null || inPoint == null) return null; var connection = new GraphConnection(length, outPoint, inPoint); connection.Name = outPoint.Name + " connection"; outPoint.AddConection(connection); inPoint.AddConection(connection); if (string.IsNullOrEmpty(inPoint.Name)) inPoint.Name = outPoint.Name + " connection inPoint"; return connection; }
public static GraphConnection Connect(OutPoint outPoint, InPoint inPoint, int length = 1) { if (outPoint == null || inPoint == null) { return(null); } var connection = new GraphConnection(length, outPoint, inPoint); connection.Name = outPoint.Name + " connection"; outPoint.AddConection(connection); inPoint.AddConection(connection); if (string.IsNullOrEmpty(inPoint.Name)) { inPoint.Name = outPoint.Name + " connection inPoint"; } return(connection); }
public GraphConnection(int length, OutPoint from, InPoint to) { Length = length; From = from; To = to; }
public override ColorableClass ConnectTo(InPoint inPoint, int length = 1) { var outPoint = AddOutConnection(); return outPoint.ConnectTo(inPoint, length); }
public override ColorableClass ConnectTo(InPoint inPoint, int length = 1) { GraphConnection.Connect(this, inPoint, length); return(this); }
public override ColorableClass ConnectTo(InPoint inPoint, int length = 1) { var outPoint = AddOutConnection(); return(outPoint.ConnectTo(inPoint, length)); }
public override ColorableClass ConnectTo(InPoint inPoint, int length = 1) { GraphConnection.Connect(this, inPoint,length); return this; }
public virtual ColorableClass ConnectTo(InPoint to, int length = 1) { return this; }
public override ColorableClass ConnectTo(InPoint inPoint, int length = 1) { return Output.ConnectTo(inPoint, length); }
protected InPoint AddInvisiblePoint(InPoint inConn = null) { var res = AddInConnection(inConn); InvisiblePoints.Add(res); return res; }
public virtual ColorableClass ConnectTo(InPoint to, int length = 1) { return(this); }
static int Sum(int x, int y) { var xNode = new InPoint(new IntColor(x)); var yNode = new InPoint(new IntColor(y)); int res = 0; var summator = new Summator(); //connect x and y to summato xNode.ConnectTo(summator); yNode.ConnectTo(summator); //both x and y will recieve the same result in this text, so add just one of them graph.Add(xNode); graph.OnFinish += delegate(GraphResult result) { GraphPath path = result[xNode]; if (path != null) { var color = path.LastColor as IntColor; if (color != null) res = color.Value; //sum is list of transitions of first value — result is the last one. } }; graph.Start(); return res; }
static void Test() { //Calculate x+y var summ = new Summator(); var summ2 = new Summator(); var summ3 = new Summator(); var str = new Stringer(); var one = new InPoint(new IntColor(1)); var one2 = new OutPoint(new IntColor(1)); var two = new InPoint(new IntColor(2)); var three = new OutPoint(new IntColor(3)); var four = new OutPoint(new IntColor(5)); var mix1 = new MixNode(); one.ConnectTo(summ); two.ConnectTo(summ); one2.ConnectTo(summ).ConnectTo(summ2); three.ConnectTo(summ2).ConnectTo(str); four.ConnectTo(summ2); summ.ConnectTo(summ3); summ2.ConnectTo(summ3); summ3.ConnectTo(str); new OutPoint(new IntColor(6)).ConnectTo(str); //str.ConnectTo(mix1); // new OutPoint(new StringColor("abba")).ConnectTo(mix1);/**/ // graph.Add(new ColorableClass[] { one, two, one2, three }); graph.Add(new ConnectionPoint[] { one, two, one2, three, four }); graph.OnFinish += OnFinish; graph.StartAsync(); }
public SerialOutPoint() { Output.OnAllFiltered += OnAllOutputSignalled; Input = new InPoint(this); }
public override ColorableClass ConnectTo(InPoint inPoint, int length = 1) { return(Output.ConnectTo(inPoint, length)); }
public ReplaceNode() { Replacement = new InPoint(this); }
public CompareNode() { CompareWith = AddInvisiblePoint(); CompareOperation = AddInvisiblePoint(); }