Exemplo n.º 1
0
        private void ResolveData(ProcessingTree <SwitchBase> root, ProcessingNode <SwitchBase> start, ProcessingNode <SwitchBase> node)
        {
            var items =
                root.ConnectionsForCompilation.Where(x => !(x.ToInputOutput.InputOutput.Signature is ActionSignature))
                .OrderBy(x => x.ToInputOutput.InputOutputId);

            foreach (var c in items) // sorgt für korrekte reihenfolge
            {
                if (node.Value == c.FromInputOutput.Origin)
                {
                    var nextNode = new ProcessingNode <SwitchBase>(c.ToInputOutput.Origin, c, true);

                    if (node.Previous.Count == 0)
                    {
                        nextNode.NextData.Add(node);
                    }

                    node.PreviousData.Add(nextNode);

                    if (!start.ChainedNodes.Contains(nextNode.Value.Id) && c.ToInputOutput.Origin != start.Value)
                    {
                        start.ChainedNodes.Add(nextNode.Value.Id);
                        ResolveData(root, start, nextNode);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void RelayOutput(Processor p, ProcessingNode <T> node, Engine renderingEngine)
        {
            var connections = ConnectionsForCompilation.Where(x => x.ToInputOutput.Origin == node.Value);

            foreach (var c in connections)
            {
                c.FromInputOutput.InputOutput.Data = c.ToInputOutput.InputOutput.Data;
            }
        }
Exemplo n.º 3
0
        private void ProcessDataRoot(ProcessingNode <T> node, Engine renderingEngine)
        {
            var dataNodes = node.BacktrackData;

            foreach (var layer in dataNodes.OrderByDescending(x => x.Key))
            {
                foreach (var dataNode in layer.Value)
                {
                    if (renderingEngine.DebugMode)
                    {
                        Log.Debug("Processing: {0}", dataNode.Value.UniqueName);
                    }

                    dataNode.Value.ProcessData(Processor, dataNode);
                    RelayOutput(Processor, dataNode, renderingEngine);
                }
            }
        }
Exemplo n.º 4
0
        private void ResolveTree(ProcessingTree <SwitchBase> root, ProcessingNode <SwitchBase> start, ProcessingNode <SwitchBase> node)
        {
            ResolveData(root, node, node);
            BacktrackData(node, node, RenderingEngine, 0);

            var items =
                root.ConnectionsForCompilation.Where(x => x.ToInputOutput.InputOutput.Signature is ActionSignature)
                .OrderBy(x => x.ToInputOutput.InputOutputId);

            foreach (var c in items) // sorgt für korrekte reihenfolge
            {
                if (node.Value == c.ToInputOutput.Origin)
                {
                    var nextNode = new ProcessingNode <SwitchBase>(c.FromInputOutput.Origin, c);
                    nextNode.Previous.Add(node);
                    node.Next.Add(nextNode);
                    node.OutputIndex = c.ToInputOutput.InputOutputId;
                    ResolveTree(root, start, nextNode);
                }
            }
        }
Exemplo n.º 5
0
        private void BacktrackData(ProcessingNode <SwitchBase> start, ProcessingNode <SwitchBase> node, Engine renderingEngine, int layer)
        {
            layer++;
            foreach (var prev in node.PreviousData.Where(x => !x.Value.HasActionOutput))
            {
                BacktrackData(start, prev, renderingEngine, layer);
            }

            if (start != node && !node.Value.IsStart)
            {
                if (!start.BacktrackData.ContainsKey(layer))
                {
                    start.BacktrackData[layer] = new List <ProcessingNode <SwitchBase> >();
                }

                if (!start.BacktrackData[layer].Contains(node))
                {
                    start.BacktrackData[layer].Add(node);
                }
            }
        }
Exemplo n.º 6
0
        private void Process(ProcessingNode <T> node, Engine renderingEngine)
        {
            do
            {
                node.Repeat = false;
                ProcessDataRoot(node, renderingEngine);

                if (renderingEngine.DebugMode)
                {
                    Log.Warn("Processing: {0}", node.Value.UniqueName);
                }

                node.Value.Process(Processor, node);
                node.Value.ProcessData(Processor, node);

                RelayOutput(Processor, node, renderingEngine);

                if (node.Next != null && node.Next.Count > 0)
                {
                    for (int i = 0; i < node.Next.Count; i++)
                    {
                        var n = node.Next[i];
                        if (node.Skip == null)
                        {
                            Process(n, renderingEngine);
                        }
                        else
                        {
                            if (n.Connection.ToInputOutput.InputOutputId != node.Skip.OutputIndex)
                            {
                                Process(n, renderingEngine);
                            }
                        }
                    }
                }
            }while (node.Repeat && !CancellationTokenSource.IsCancellationRequested);
        }