예제 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="traceID">Trace id</param>
 /// <param name="pdg">Program dependency graph</param>
 /// <param name="config">Configuration object</param>
 public PageRankScript(string traceID, PDG pdg, PageRankConfig config)
     : base()
 {
     _pdg = pdg;
     _config = config;
     _traceID = traceID;
 }
예제 #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="traceID">Trace id</param>
 /// <param name="pdg">Program dependency graph</param>
 /// <param name="config">Configuration object</param>
 public HITSScript(string traceID, PDG pdg, HITSConfig config)
     : base()
 {
     _pdg = pdg;
     _config = config;
     _traceID = traceID;
 }
예제 #3
0
        /// <summary>
        /// Deep copy constructor for PDG
        /// </summary>
        /// <param name="pdg">Original PDG</param>
        /// <returns>New PDG</returns>
        public static PDG DeepCopy(PDG pdg)
        {
            PDG pdgCopy = new PDG();

            pdgCopy._nodes = new SerializableDictionary <string, PDGNode>();
            foreach (KeyValuePair <string, PDGNode> kvpNode in pdg._nodes)
            {
                PDGNode nodeCopy = new PDGNode(kvpNode.Value.MethodName);
                foreach (PDGEdge edge in kvpNode.Value.OutgoingEdges)
                {
                    nodeCopy.SetEdgeWeight(edge.OutgoingNodeID, edge.Weight);
                }
                pdgCopy.Add(nodeCopy);
            }
            return(pdgCopy);
        }
예제 #4
0
파일: PDG.cs 프로젝트: CoEST/TraceLab-CDK
        /// <summary>
        /// Converts a BiGramCollection to a PDG
        /// </summary>
        /// <param name="bigrams"></param>
        /// <returns>PDG</returns>
        public static PDG Convert(BiGramCollection bigrams)
        {
            PDG pdg = new PDG();

            foreach (BiGram bigram in bigrams)
            {
                if (!pdg._nodes.ContainsKey(bigram.Caller))
                {
                    pdg.Add(new PDGNode(bigram.Caller));
                }
                pdg._nodes[bigram.Caller].AddChild(bigram.Callee);
                if (!pdg._nodes.ContainsKey(bigram.Callee))
                    pdg.Add(new PDGNode(bigram.Callee));
            }

            return pdg;
        }
예제 #5
0
        /// <summary>
        /// Converts a BiGramCollection to a PDG
        /// </summary>
        /// <param name="bigrams"></param>
        /// <returns>PDG</returns>
        public static PDG Convert(BiGramCollection bigrams)
        {
            PDG pdg = new PDG();

            foreach (BiGram bigram in bigrams)
            {
                if (!pdg._nodes.ContainsKey(bigram.Caller))
                {
                    pdg.Add(new PDGNode(bigram.Caller));
                }
                pdg._nodes[bigram.Caller].AddChild(bigram.Callee);
                if (!pdg._nodes.ContainsKey(bigram.Callee))
                {
                    pdg.Add(new PDGNode(bigram.Callee));
                }
            }

            return(pdg);
        }
예제 #6
0
파일: PDG.cs 프로젝트: CoEST/TraceLab-CDK
 /// <summary>
 /// Deep copy constructor for PDG
 /// </summary>
 /// <param name="pdg">Original PDG</param>
 /// <returns>New PDG</returns>
 public static PDG DeepCopy(PDG pdg)
 {
     PDG pdgCopy = new PDG();
     pdgCopy._nodes = new SerializableDictionary<string,PDGNode>();
     foreach (KeyValuePair<string, PDGNode> kvpNode in pdg._nodes)
     {
         PDGNode nodeCopy = new PDGNode(kvpNode.Value.MethodName);
         foreach (PDGEdge edge in kvpNode.Value.OutgoingEdges)
         {
             nodeCopy.SetEdgeWeight(edge.OutgoingNodeID, edge.Weight);
         }
         pdgCopy.Add(nodeCopy);
     }
     return pdgCopy;
 }