Initialize() protected method

protected Initialize ( ) : void
return void
        public override Problem[] Check(Method method)
        {
            this.populator.BuildGraphFromMethod(method);

            EdgeDepthFirstSearchAlgorithm edfs = new EdgeDepthFirstSearchAlgorithm(this.populator.Graph);
            NullStateVisitor vis = new NullStateVisitor(this.populator.Graph);
            edfs.RegisterEdgeColorizerHandlers(vis);

            vis.Log.WriteLine("-- Fault detection for {0}.{1}",
                method.DeclaringType.ToString(),
                method.Name
                );

            int index=0;
            ArrayList problems = new ArrayList();
            for(index=0;index<method.Parameters.Length;++index)
            {
                Parameter param = method.Parameters[index];
                vis.Clear();
                vis.Log.WriteLine("-- {0} parameter",param.Name);
                vis.ParameterIndex=index;
                edfs.Initialize();
                edfs.Compute( this.populator.Graph.Root );

                if (vis.Warnings.Count>0 || vis.Errors.Count > 0)
                {
                    this.Problems.Add(
                        this.GetResolution(method.Name.Name,param.Name.Name)
                        );
                }
            }

            Problem[] ps=new Problem[problems.Count];
            problems.CopyTo(ps,0);

            return ps;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Records all the edges that are part of the subtree of v
        /// </summary>
        /// <param name="g">visited graph</param>
        /// <param name="e">root edge</param>
        /// <param name="maxDepth">maximum expolration depth</param>
        /// <returns></returns>
        public static EdgeCollection OutEdgeTree(
            IEdgeListAndIncidenceGraph g,
            IEdge e,
            int maxDepth
            )
        {
            if (g==null)
                throw new ArgumentNullException("g");
            if (e==null)
                throw new ArgumentNullException("e");

            EdgeDepthFirstSearchAlgorithm dfs = new EdgeDepthFirstSearchAlgorithm(g);
            dfs.BackEdge +=new EdgeEventHandler(dfs_BackEdge);
            EdgeRecorderVisitor vis =new EdgeRecorderVisitor();
            vis.Edges.Add(e);

            dfs.DiscoverTreeEdge +=new EdgeEdgeEventHandler(vis.RecordTarget);

            dfs.MaxDepth = maxDepth;
            dfs.Initialize();
            dfs.Visit(e,0);

            return vis.Edges;
        }