public static void Main(string[] args) { if (args.Length < 2) { Console.WriteLine("You must provide the source directory and at least " + "one gaze file to run this program."); return; } string source_directory = args[0]; List <string> gaze_files = new List <string>(); for (int i = 1; i < args.Length; ++i) { gaze_files.Add(args[i]); } Config config = new Config(); SourceCodeEntitiesFileCollection source_info = SrcMLCodeReader.run( config.src2srcml_path, source_directory); List <GazeResults> gaze_results = GazeReader.run(gaze_files); for (int i = 0; i < gaze_results.Count; ++i) { GazeResults cur_gaze_results = gaze_results[i]; string cur_filename = gaze_files[i]; GazeSourceRelationship gsr = GazeToSource.run(cur_gaze_results, source_info); gsr.writeSqlite(cur_filename + ".sql"); } }
public static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("USAGE: Provide a gaze file as the first argument."); return; } GazeResults gaze_results = GazeReader.run(new List <string> { args[0] })[0]; Stack <string> source_filenames = new Stack <string>(); foreach (GazeData gaze_data in gaze_results.gazes) { if (source_filenames.Count == 0) { source_filenames.Push(gaze_data.filename); } else { if (source_filenames.Peek() != gaze_data.filename) { source_filenames.Push(gaze_data.filename); } } } Stack <string> backstack = new Stack <string>(); while (source_filenames.Count > 0) { backstack.Push(source_filenames.Pop()); } Console.WriteLine("Results:"); while (backstack.Count > 0) { Console.WriteLine(" - " + backstack.Pop()); } }
public static void Main(string[] args) { GazeResults gaze_results = GazeReader.run( new List <string> { "data/gazedata1.xml" })[0]; foreach (GazeData gaze_data in gaze_results.gazes) { foreach (PropertyDescriptor descriptor in TypeDescriptor. GetProperties(gaze_data)) { Console.Write("{0}={1}; ", descriptor.Name, descriptor.GetValue(gaze_data)); } Console.WriteLine(""); } Config config = new Config(); SourceCodeEntitiesFileCollection collection = SrcMLCodeReader.run( config.src2srcml_path, "data/java/"); foreach (SourceCodeEntitiesFile file in collection) { Console.WriteLine(file.FileName + ":"); foreach (SourceCodeEntity entity in file) { Console.Write(" - "); foreach (PropertyDescriptor descriptor in TypeDescriptor. GetProperties(entity)) { Console.Write("{0}={1}; ", descriptor.Name, descriptor.GetValue(entity)); } Console.WriteLine(""); } } }
public static int Main(string[] args) { // I don't recommend making a composite of several sessions. // The differing timestamps would throw off the weights such // that earlier sessions count less. If composites are a // design goal, a preprocessing step wouldn't be hard to add // to the src2srcml reader. // Split files from the same session should be OK, though. if (args.Length < 3) { Console.WriteLine("USAGE: SimpleGraph.exe {edge-digraph|importance} " + "out-file source-directory edge-filter-highpass sce-filter-highpass composite-sce-filter-highpass gaze-result(s)"); Console.WriteLine("\tIf <out-file> is - print to stdout."); Console.WriteLine("\t<source-directory> is recursively " + "searched for .java source files."); Console.WriteLine("\t<edge-filter-highpass>, <sce-filter-highpass> and <composite-sce-filter-highpass>" + "should be numbers between 0 and 1."); Console.WriteLine("\t<gaze-result(s)> is/are XML eye tracking " + "data over the source\n\t files in <source-directory>."); return(1); } Config config = new Config(); SourceCodeEntitiesFileCollection collection = SrcMLCodeReader.run( config.src2srcml_path, args [2]); List <string> gaze_files = new List <string> (); for (int i = 0; i < args.Length - 6; i++) { gaze_files.Add(args [i + 6]); } List <GazeResults> gaze_results = GazeReader.run(gaze_files); var src2src_links = new List <Dictionary <EntityLink, double> >(); var entity_scores = new List <Dictionary <SourceCodeEntity, double> >(); foreach (var gaze_result in gaze_results) { var cur_src2src_links = gen_graph(gaze_result, collection); normalize_graph(cur_src2src_links); edge_filter_highpass(cur_src2src_links, Convert.ToDouble(args[3])); src2src_links.Add(cur_src2src_links); if (args[0] == "importance") { var entity_score = entity_score_from_edge_score(cur_src2src_links); sce_filter_highpass(entity_score, Convert.ToDouble(args[4])); entity_scores.Add(entity_score); } } // Write DOT file for GraphViz or write importance set. Use standard out if // specified. TextWriter output_writer = System.Console.Out; if (args[1] != "-") { output_writer = new StreamWriter(args[1]); } if (args[0] == "edge-digraph") { dump_DOT(output_writer, src2src_links[0]); } else if (args[0] == "importance") { var composite = composite_entity_scores(entity_scores); sce_filter_highpass(composite, Convert.ToDouble(args[5])); dump_links(output_writer, composite); } else { Console.WriteLine("Incorrect first parameter"); } return(0); }