Esempio n. 1
0
 public InPoint AddInConnection(InPoint inConn=null)
 {
     if (inConn==null)
         inConn = new InPoint(this);
     Input.Add(inConn);
     return inConn;
 }
Esempio n. 2
0
        protected InPoint AddInvisiblePoint(InPoint inConn = null)
        {
            var res = AddInConnection(inConn);

            InvisiblePoints.Add(res);
            return(res);
        }
Esempio n. 3
0
 public InPoint AddInConnection(InPoint inConn = null)
 {
     if (inConn == null)
     {
         inConn = new InPoint(this);
     }
     Input.Add(inConn);
     return(inConn);
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
 public GraphConnection(int length, OutPoint from, InPoint to)
 {
     Length = length;
     From = from;
     To = to;
 }
Esempio n. 7
0
 public GraphConnection(int length, OutPoint from, InPoint to)
 {
     Length = length;
     From   = from;
     To     = to;
 }
Esempio n. 8
0
 public override ColorableClass ConnectTo(InPoint inPoint, int length = 1)
 {
     var outPoint = AddOutConnection();
     return outPoint.ConnectTo(inPoint, length);
 }
Esempio n. 9
0
 public override ColorableClass ConnectTo(InPoint inPoint, int length = 1)
 {
     GraphConnection.Connect(this, inPoint, length);
     return(this);
 }
Esempio n. 10
0
        public override ColorableClass ConnectTo(InPoint inPoint, int length = 1)
        {
            var outPoint = AddOutConnection();

            return(outPoint.ConnectTo(inPoint, length));
        }
Esempio n. 11
0
 public override ColorableClass ConnectTo(InPoint inPoint, int length = 1)
 {
     GraphConnection.Connect(this, inPoint,length);
     return this;
 }
Esempio n. 12
0
 public virtual ColorableClass ConnectTo(InPoint to, int length = 1)
 {
     return this;
 }
Esempio n. 13
0
 public override ColorableClass ConnectTo(InPoint inPoint, int length = 1)
 {
     return Output.ConnectTo(inPoint, length);
 }
Esempio n. 14
0
 protected InPoint AddInvisiblePoint(InPoint inConn = null)
 {
     var res = AddInConnection(inConn);
     InvisiblePoints.Add(res);
     return res;
 }
Esempio n. 15
0
 public virtual ColorableClass ConnectTo(InPoint to, int length = 1)
 {
     return(this);
 }
Esempio n. 16
0
        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;
        }
Esempio n. 17
0
        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();
        }
Esempio n. 18
0
 public SerialOutPoint()
 {
     Output.OnAllFiltered += OnAllOutputSignalled;
     Input = new InPoint(this);
 }
Esempio n. 19
0
 public override ColorableClass ConnectTo(InPoint inPoint, int length = 1)
 {
     return(Output.ConnectTo(inPoint, length));
 }
Esempio n. 20
0
 public ReplaceNode()
 {
     Replacement = new InPoint(this);
 }
Esempio n. 21
0
 public CompareNode()
 {
     CompareWith      = AddInvisiblePoint();
     CompareOperation = AddInvisiblePoint();
 }
Esempio n. 22
0
 public SerialOutPoint()
 {
     Output.OnAllFiltered += OnAllOutputSignalled;
     Input = new InPoint(this);
 }