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

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

3
.idea/workspace.xml generated
View File

@@ -7,9 +7,10 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/Sapfor_F.exe" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetGraphLoops.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetGraphLoops.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetGraphLoops.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetGraphLoops.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Files/UI/Editor/SPFEditor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Files/UI/Editor/SPFEditor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Loops/Loop.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Loops/Loop.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

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

View File

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

View File

@@ -16,7 +16,17 @@ public class Loop extends FileObjectWithMessages {
@Expose @Expose
private int hasNonRectangularBounds; private int hasNonRectangularBounds;
@Expose @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 @Expose
public List<FuncCall> funcCalls = new Vector<>(); public List<FuncCall> funcCalls = new Vector<>();
@@ -44,74 +54,9 @@ public class Loop extends FileObjectWithMessages {
all_children.addAll(children); all_children.addAll(children);
return all_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 @Override
public String TypeKey() { public String TypeKey() {
return loopState.toString(); return getLoopState().toString();
} }
@Override @Override
public String Description() { public String Description() {
@@ -127,7 +72,7 @@ public class Loop extends FileObjectWithMessages {
} }
@Override @Override
public VisualiserFonts getFont() { public VisualiserFonts getFont() {
return loopState.getFont(); return getLoopState().getFont();
} }
public void toMap_r(LinkedHashMap<Integer, Loop> loops_map){ public void toMap_r(LinkedHashMap<Integer, Loop> loops_map){
loops_map.put(line, this); loops_map.put(line, this);