исправление енума на инт

This commit is contained in:
2025-03-31 14:18:43 +03:00
parent e706b52b53
commit 48290ccf97
4 changed files with 19 additions and 72 deletions

View File

@@ -5,6 +5,7 @@ import _VisualDVM.Passes.Sapfor.SapforAnalysis;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.SapforData.Loops.Json.LoopsJson;
import _VisualDVM.ProjectData.SapforData.Loops.Loop;
import _VisualDVM.ProjectData.SapforData.Loops.LoopState;
import java.util.Vector;
public class SPF_GetGraphLoops extends SapforAnalysis {
@@ -39,11 +40,11 @@ public class SPF_GetGraphLoops extends SapforAnalysis {
protected void unpack(String packed) throws Exception {
int allLoops=0;
Vector<String> loops_programs = new Vector<>();
packed = "{\"loops\":"+new StringBuilder(packed).substring(9, packed.length()-1)+"}";
System.out.println(packed);
/// System.out.println(packed);
LoopsJson loopsJson = Utils_.gson.fromJson(packed, LoopsJson.class);
for (Loop loop: loopsJson.loops){
System.out.println("loop "+"file="+loop.file+" line="+loop.line);
target.db.files.get(loop.file).LoopNests.add(loop);
//-
if (!loops_programs.contains(loop.file)){

View File

@@ -143,7 +143,7 @@ public class SPFEditor extends BaseEditor implements SPFEditorInterface {
public void HighlightLoops() {
ClearLoopsHighLights();
for (Loop loop : file.AllLoops.values()) {
Highlighter.HighlightPainter painter = loop.loopState.getPainter();
Highlighter.HighlightPainter painter = loop.getLoopState().getPainter();
if (painter != null) {
try {
loopsHighlights.add(highlighter.addHighlight(

View File

@@ -16,7 +16,17 @@ public class Loop extends FileObjectWithMessages {
@Expose
private int hasNonRectangularBounds;
@Expose
public LoopState loopState;
private int loopState;
public LoopState getLoopState(){
switch (loopState){
case 1:
return LoopState.GoodLoop;
case 2:
return LoopState.BadLoop;
default:
return LoopState.Loop;
}
}
//---
@Expose
public List<FuncCall> funcCalls = new Vector<>();
@@ -44,74 +54,9 @@ public class Loop extends FileObjectWithMessages {
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()]);//+
for (int k = 0; k < calls; ++k) {
String c_name = packedLoopInfo[idx.Inc()];
int c_line = Integer.parseInt(packedLoopInfo[idx.Inc()]);
func_calls.add(new FuncCall(father_in, c_name, c_line));
}
line = Integer.parseInt(packedLoopInfo[idx.Inc()]);
lineNumAfterLoop = Integer.parseInt(packedLoopInfo[idx.Inc()]);
perfectLoop = Integer.parseInt(packedLoopInfo[idx.Inc()]);
hasOutGoto = Integer.parseInt(packedLoopInfo[idx.Inc()]);
hasPrints = Integer.parseInt(packedLoopInfo[idx.Inc()]);
childCount = Integer.parseInt(packedLoopInfo[idx.Inc()]);
int state = Integer.parseInt(packedLoopInfo[idx.Inc()]);
switch (state) {
case 1:
loopState = LoopState.GoodLoop;
break;
case 2:
loopState = LoopState.BadLoop;
break;
default:
loopState = LoopState.Loop;
break;
}
hasNonRectangularBounds = Integer.parseInt(packedLoopInfo[idx.Inc()]); //+
if (hasNonRectangularBounds ==1)
non_rect_iters.add(new NonRectIter(father_in, line));
////-------------------------------------------------------------------------------
// число внешних переходов
int e_gotos_size = Integer.parseInt(packedLoopInfo[idx.Inc()]); //+
for (int k = 0; k < e_gotos_size; ++k) {
int c_line = Integer.parseInt(packedLoopInfo[idx.Inc()]);
e_gotos.add(new EGoto(father_in, c_line));
}
//число внутренних переходов
int i_gotos_size = Integer.parseInt(packedLoopInfo[idx.Inc()]); //+
for (int k = 0; k < i_gotos_size; ++k) {
int c_line = Integer.parseInt(packedLoopInfo[idx.Inc()]);
i_gotos.add(new IGoto(father_in, c_line));
}
//число операторов печати
int IOs_size = Integer.parseInt(packedLoopInfo[idx.Inc()]); //+
for (int k = 0; k < IOs_size; ++k) {
int c_line = Integer.parseInt(packedLoopInfo[idx.Inc()]);
ios.add(new IO(father_in, c_line));
}
//число операторов останова (STOPб PAUSE)
int stops_size = Integer.parseInt(packedLoopInfo[idx.Inc()]); //++
for (int k = 0; k < stops_size; ++k) {
int c_line = Integer.parseInt(packedLoopInfo[idx.Inc()]);
stops.add(new Stop(father_in, c_line));
}
//--------------------------------------------------------------------------------
for (int i = 0; i < childCount; ++i) {
Loop nextChild = new Loop(packedLoopInfo, idx, father_in);
children.add(nextChild);
}
father_in.AllLoops.put(line, this);
//нельзя использовать конструктор с параметрами из за особеностей распаковки.
CheckMessagesPresence();
}
*/
@Override
public String TypeKey() {
return loopState.toString();
return getLoopState().toString();
}
@Override
public String Description() {
@@ -127,7 +72,7 @@ public class Loop extends FileObjectWithMessages {
}
@Override
public VisualiserFonts getFont() {
return loopState.getFont();
return getLoopState().getFont();
}
public void toMap_r(LinkedHashMap<Integer, Loop> loops_map){
loops_map.put(line, this);