Esempio n. 1
0
        public static SourceCodeEntitiesFileCollection run(string src2srcml_path,
                                                           string input_directory)
        {
            if (!verifySrc2SrcMLExecutable(src2srcml_path))
            {
                Console.WriteLine("WARNING: src2srcml_path does not appear to be a " +
                                  "src2srcml executable");
            }

            List <FileInfo> files = SrcMLCodeReader.getFiles(
                new DirectoryInfo(input_directory), "*.java");
            SourceCodeEntitiesFileCollection collection =
                new SourceCodeEntitiesFileCollection();

            foreach (FileInfo file in files)
            {
                XmlDocument document = new XmlDocument();
                document.PreserveWhitespace = true;
                document.LoadXml(loadSourceInfo(file, src2srcml_path));
                SourceCodeEntitiesFile scef = processSrcML(document);
                scef.FileName = file.Name;
                collection.Add(scef);
            }

            return(collection);
        }
Esempio n. 2
0
        run(GazeResults gaze_results, SourceCodeEntitiesFileCollection scefc)
        {
            GazeSourceRelationship gsr = new GazeSourceRelationship();

            foreach (GazeData gd in gaze_results.gazes)
            {
                GazeSourceEntityRelationship gser = new GazeSourceEntityRelationship();

                SourceCodeEntitiesFile scef = getSourceFileByGaze(gd, scefc);
                if (scef != null)
                {
                    foreach (SourceCodeEntity sce in scef)
                    {
                        if (isInEntity(gd, sce))
                        {
                            gser.sc_file   = scef;
                            gser.sc_entity = sce;
                            gser.gaze_data = gd;

                            switch (sce.Type)
                            {
                            case SourceCodeEntityType.CLASS:
                                gser.class_ = sce.Name;
                                break;

                            case SourceCodeEntityType.ATTRIBUTE:
                                gser.attribute = sce.Name;
                                break;

                            case SourceCodeEntityType.METHOD:
                                gser.method = sce.Name;
                                break;

                            case SourceCodeEntityType.COMMENT:
                                gser.comment = sce.Name;
                                break;
                            }
                        }
                    }
                }
                else
                {
                    gser.gaze_data = gd;
                }

                gsr.Add(gser);
            }

            return(gsr);
        }
Esempio n. 3
0
        private static SourceCodeEntitiesFile getSourceFileByGaze(GazeData gd,
                                                                  SourceCodeEntitiesFileCollection scefc)
        {
            SourceCodeEntitiesFile scef = null;

            foreach (SourceCodeEntitiesFile cur_scef in scefc)
            {
                if (gd.filename == cur_scef.FileName)
                {
                    scef = cur_scef;
                    break;
                }
            }
            return(scef);
        }