переименование/лишние поля
This commit is contained in:
@@ -6,7 +6,9 @@ import _VisualDVM.Passes.Sapfor.SapforAnalysis;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.SapforData.Loops.Json.LoopsJson;
|
||||
import _VisualDVM.ProjectData.SapforData.Loops.Loop;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public class SPF_GetGraphLoops extends SapforAnalysis {
|
||||
@Override
|
||||
@@ -38,8 +40,8 @@ public class SPF_GetGraphLoops extends SapforAnalysis {
|
||||
}
|
||||
@Override
|
||||
protected void unpack(String packed) throws Exception {
|
||||
/*
|
||||
//System.out.println(Utils_.Brackets(packed));
|
||||
/*old
|
||||
Vector<String> done_programs = new Vector<>();
|
||||
String[] splitedPackedGraph = packed.split("\\|");
|
||||
for (int i = 0; i < splitedPackedGraph.length; i += 2) {
|
||||
@@ -59,8 +61,17 @@ public class SPF_GetGraphLoops extends SapforAnalysis {
|
||||
}
|
||||
}
|
||||
target.UpdateLoopsCount();
|
||||
//--
|
||||
*/
|
||||
//--
|
||||
/*
|
||||
LoopsJson loopsJson = new LoopsJson();
|
||||
for (String pname: done_programs){
|
||||
loopsJson.values.addAll(target.db.files.get(pname).AllLoops.values());
|
||||
}
|
||||
File debug = new File(Global.TempDirectory, "loops_json.txt");
|
||||
FileUtils.writeStringToFile(debug,Utils_.gson.toJson(loopsJson));
|
||||
*/
|
||||
/*
|
||||
int allLoops=0;
|
||||
Vector<String> loops_programs = new Vector<>();
|
||||
System.out.println("packed_loops = "+Utils_.Brackets(packed));
|
||||
@@ -79,6 +90,7 @@ public class SPF_GetGraphLoops extends SapforAnalysis {
|
||||
program.LoopGraphTitle = "Всего циклов: " + program.AllLoops.size();
|
||||
target.numLoops += program.AllLoops.size();
|
||||
}
|
||||
*/
|
||||
}
|
||||
@Override
|
||||
protected void FocusResult() {
|
||||
|
||||
@@ -258,7 +258,7 @@ public class DBProjectFile extends ProjectFile {
|
||||
public DefaultMutableTreeNode show_loop_graph_r(FileObjectWithMessages element) {
|
||||
DefaultMutableTreeNode res = new DefaultMutableTreeNode(element);
|
||||
if (element instanceof Loop) {
|
||||
for (FileObjectWithMessages child : ((Loop) element).getChildren())
|
||||
for (FileObjectWithMessages child : ((Loop) element).getAllChildren())
|
||||
res.add(show_loop_graph_r(child));
|
||||
}
|
||||
return res;
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Loops.Json;
|
||||
import _VisualDVM.ProjectData.SapforData.Functions.FuncCall;
|
||||
import _VisualDVM.ProjectData.SapforData.Loops.*;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class LoopJson {
|
||||
@Expose
|
||||
String file;
|
||||
@Expose
|
||||
int line;
|
||||
@Expose
|
||||
int lineNumAfterLoop;
|
||||
@Expose
|
||||
int perfectLoop;
|
||||
@Expose
|
||||
int hasOutGoto;
|
||||
@Expose
|
||||
int hasPrints;
|
||||
@Expose
|
||||
int hasNonRectIters;
|
||||
@Expose
|
||||
int childCount;
|
||||
@Expose
|
||||
public LoopState loopState;
|
||||
@Expose
|
||||
public List<FuncCall> func_calls = new Vector<>();
|
||||
@Expose
|
||||
public List<NonRectIter> non_rect_iters = new Vector<>();
|
||||
@Expose
|
||||
public List<EGoto> e_gotos = new Vector<>();
|
||||
@Expose
|
||||
public List<IGoto> i_gotos = new Vector<>();
|
||||
@Expose
|
||||
public List<IO> ios = new Vector<>();
|
||||
@Expose
|
||||
public List<Stop> stops = new Vector<>();
|
||||
@Expose
|
||||
public List<Loop> loops = new Vector<>();
|
||||
}
|
||||
@@ -6,26 +6,15 @@ import _VisualDVM.ProjectData.Messages.Message;
|
||||
import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
|
||||
import _VisualDVM.ProjectData.SapforData.Functions.FuncCall;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class Loop extends FileObjectWithMessages {
|
||||
//public String file = "";
|
||||
//public int line = 1;
|
||||
@Expose
|
||||
private final int lineNumAfterLoop;
|
||||
private int lineNumAfterLoop;
|
||||
@Expose
|
||||
private final int perfectLoop;
|
||||
@Expose
|
||||
private final int hasOutGoto;
|
||||
@Expose
|
||||
private final int hasPrints;
|
||||
@Expose
|
||||
private final int hasNonRectIters;
|
||||
@Expose
|
||||
private final int childCount;
|
||||
private int perfectLoop;
|
||||
@Expose
|
||||
public LoopState loopState;
|
||||
//---
|
||||
@@ -42,20 +31,21 @@ public class Loop extends FileObjectWithMessages {
|
||||
@Expose
|
||||
public List<Stop> stops = new Vector<>();
|
||||
@Expose
|
||||
public List<Loop> loops = new Vector<>();
|
||||
public List<Loop> children = new Vector<>();
|
||||
//--
|
||||
public List<FileObjectWithMessages> getChildren(){
|
||||
List<FileObjectWithMessages> children = new Vector<>();
|
||||
children.addAll(func_calls);
|
||||
children.addAll(non_rect_iters);
|
||||
children.addAll(e_gotos);
|
||||
children.addAll(i_gotos);
|
||||
children.addAll(ios);
|
||||
children.addAll(stops);
|
||||
children.addAll(loops);
|
||||
return children;
|
||||
public List<FileObjectWithMessages> getAllChildren(){
|
||||
List<FileObjectWithMessages> all_children = new Vector<>();
|
||||
all_children.addAll(func_calls);
|
||||
all_children.addAll(non_rect_iters);
|
||||
all_children.addAll(e_gotos);
|
||||
all_children.addAll(i_gotos);
|
||||
all_children.addAll(ios);
|
||||
all_children.addAll(stops);
|
||||
all_children.addAll(children);
|
||||
return all_children;
|
||||
}
|
||||
|
||||
/*
|
||||
public Loop(String[] packedLoopInfo, Index idx, DBProjectFile father_in) {
|
||||
file = father_in.name;
|
||||
int calls = Integer.parseInt(packedLoopInfo[idx.Inc()]);//+
|
||||
@@ -82,8 +72,8 @@ public class Loop extends FileObjectWithMessages {
|
||||
loopState = LoopState.Loop;
|
||||
break;
|
||||
}
|
||||
hasNonRectIters = Integer.parseInt(packedLoopInfo[idx.Inc()]); //+
|
||||
if (hasNonRectIters==1)
|
||||
hasNonRectangularBounds = Integer.parseInt(packedLoopInfo[idx.Inc()]); //+
|
||||
if (hasNonRectangularBounds ==1)
|
||||
non_rect_iters.add(new NonRectIter(father_in, line));
|
||||
////-------------------------------------------------------------------------------
|
||||
// число внешних переходов
|
||||
@@ -113,12 +103,13 @@ public class Loop extends FileObjectWithMessages {
|
||||
//--------------------------------------------------------------------------------
|
||||
for (int i = 0; i < childCount; ++i) {
|
||||
Loop nextChild = new Loop(packedLoopInfo, idx, father_in);
|
||||
loops.add(nextChild);
|
||||
children.add(nextChild);
|
||||
}
|
||||
father_in.AllLoops.put(line, this);
|
||||
//нельзя использовать конструктор с параметрами из за особеностей распаковки.
|
||||
CheckMessagesPresence();
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public String TypeKey() {
|
||||
return loopState.toString();
|
||||
@@ -141,7 +132,7 @@ public class Loop extends FileObjectWithMessages {
|
||||
}
|
||||
public void toMap_r(LinkedHashMap<Integer, Loop> loops_map){
|
||||
loops_map.put(line, this);
|
||||
for (Loop loop: loops)
|
||||
for (Loop loop: children)
|
||||
loop.toMap_r(loops_map);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user