Example #1
0
 /// <summary>
 /// Base class for implementing a Node to include into a Graph.
 /// </summary>
 /// <param name="graphFilter">The graph that holds this node.</param>
 /// <param name="parent">The parent node of this node. Set to null if this is the root node.</param>
 public Node(Graph graphFilter, Node parent)
 {
     _children = new List<Node>();
     _graphFilter = graphFilter;
     _parent = parent;
     _duration = TimeSpan.Zero;
 }
 /// <summary>
 /// Node that executes a certain filter.
 /// </summary>
 /// <param name="graphFilter">The graph that holds this node.</param>
 /// <param name="filter">The filter to execute.</param>
 /// <param name="configs">The configurations of the filter to execute.</param>
 /// <param name="measures">The measures to calculate.</param>
 public NodeFilter(
             Graph graphFilter, Node parent, Filter filter,
             SortedDictionary<string, object> configs,
             List<MetricExecBase> measures)
     : base(graphFilter, parent)
 {
     this.filter = filter;
     this.configs = configs;
     this.measures = measures;
 }
Example #3
0
        /// <summary>
        /// Provides a representation of a graph-like structure for representing
        /// the execution of interdependent filters.
        /// </summary>
        /// <param name="batchFilter">The parent BatchFilter that holds this graph.</param>
        /// <param name="relations">List of relations between nodes.</param>
        /// <param name="filters">List of filters.</param>
        public Graph(
                BatchFilter batchFilter,
                List<RowNodeRelation> relations,
                List<RowBatchFilter> filters)
        {
            _batchFilter = batchFilter;

            // Create root node, dependent of the input images associated with the BatchFilter ...
            _root = new Node(this, null);

            MakeGraph(Guid.Empty, _root, relations, filters);
        }
Example #4
0
        /// <summary>
        /// Builds the graph of nodes from a list of node relations and a list of filters.
        /// After building the currentNode, it will build the countChilds of this node, using the 
        /// relations list as a reference.
        /// </summary>
        /// <param name="currentGuid">The Guid of the node begin created.</param>
        /// <param name="currentNode">The node being created.</param>
        /// <param name="relations">List of relations between nodes.</param>
        /// <param name="filters">List of filters.</param>
        private void MakeGraph(
                Guid currentGuid, Node currentNode,
                List<RowNodeRelation> relations,
                List<RowBatchFilter> filters)
        {
            SortedDictionary<string, object> configs;
            Filter filter; Node filter_f;
            List<MetricExecBase> metrics;

            IEnumerable<RowBatchFilter> sons =
                    from a in filters
                    join r in relations on a.Item5 equals r.Item2
                    where r.Item1 == currentGuid
                    select a;
            // --

            foreach (RowBatchFilter r in sons)
            {
                configs = r.Item2; filter = r.Item3; metrics = r.Item4;

                filter_f = (Node)new NodeFilter(this, currentNode, filter, configs, metrics);
                filter_f.FilterExecuted += new Node.FilterExecutedDelegate(filter_f_FilterExecuted);
                filter_f.FilterMeasured += new Node.FilterMeasuredDelegate(filter_f_FilterMeasured);

                currentNode.Children.Add(filter_f);

                MakeGraph(r.Item5, filter_f, relations, filters);
            }
        }