рефакторинг объектов сапфора для подготовки к джсону
This commit is contained in:
@@ -2,9 +2,12 @@ package _VisualDVM.ProjectData.SapforData.Arrays;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
|
||||
import com.google.gson.annotations.Expose;
|
||||
// это то что отображается в боковом графе файла. не путать с сапфоровским ProjectArray
|
||||
public class ArrayDecl extends FileObjectWithMessages {
|
||||
@Expose
|
||||
public String array_name;
|
||||
@Expose
|
||||
public ArrayLocation array_loc;
|
||||
public ArrayDecl(String array_name_in, ArrayLocation array_loc_in, DBProjectFile father_in, int lineNum_in) {
|
||||
super(father_in, lineNum_in);
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package _VisualDVM.ProjectData.SapforData;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Selectable;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
//объект принадлежащий файлу и относящийся к его строке.
|
||||
public abstract class FileObject extends iDBObject {
|
||||
public class FileObject implements Selectable {
|
||||
@Expose
|
||||
@Description("DEFAULT ''")
|
||||
public String file = "";
|
||||
@Expose
|
||||
@Description("DEFAULT 1")
|
||||
public int line = 1;
|
||||
public FileObject() {
|
||||
@@ -15,14 +19,25 @@ public abstract class FileObject extends iDBObject {
|
||||
public FileObject(String file_in) {
|
||||
file = file_in;
|
||||
}
|
||||
@Override
|
||||
public String getSelectionText() {
|
||||
return "файл " + Utils_.Brackets(file) + " строка: " + line;
|
||||
}
|
||||
public DBProjectFile getFather() {
|
||||
return Global.mainModule.getProject().db.files.Data.get(file);
|
||||
}
|
||||
public void Show(boolean focus) {
|
||||
Global.mainModule.getUI().getMainWindow().getProjectWindow().GotoFile(file, line, focus);
|
||||
}
|
||||
//Selectable----
|
||||
@Description("IGNORE")
|
||||
boolean selected=false;
|
||||
public String getSelectionText() {
|
||||
return "файл " + Utils_.Brackets(file) + " строка: " + line;
|
||||
}
|
||||
@Override
|
||||
public boolean isSelected() {
|
||||
return selected;
|
||||
}
|
||||
@Override
|
||||
public void select(boolean flag) {
|
||||
selected = flag;
|
||||
}
|
||||
//-------
|
||||
}
|
||||
|
||||
@@ -1,31 +1,41 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Functions;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Selectable;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
|
||||
public class FuncCall extends FileObjectWithMessages {
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
public class FuncCall extends FileObjectWithMessages{
|
||||
@Description("IGNORE")
|
||||
private boolean selected = false;
|
||||
@Expose
|
||||
public String funcName = ""; //не нужны дополнительные поля.имя функции это уже ключ.
|
||||
@Expose
|
||||
public boolean canBeInlined = false;
|
||||
@Expose
|
||||
public int parent_offset = 0;
|
||||
//---
|
||||
public FuncCall(DBProjectFile father_in, String funcName_in, int line_in) {
|
||||
super(father_in, line_in);
|
||||
funcName = funcName_in;
|
||||
}
|
||||
public FuncCall() {
|
||||
}
|
||||
//selectable
|
||||
@Override
|
||||
public String getSelectionText() {
|
||||
return "вызов в строке " + line;
|
||||
public String Description() {
|
||||
return "вызов " + Utils_.Brackets(funcName);
|
||||
}
|
||||
@Override
|
||||
public boolean isSelectionEnabled() {
|
||||
return canBeInlined;
|
||||
}
|
||||
@Override
|
||||
public String Description() {
|
||||
return "вызов " + Utils_.Brackets(funcName);
|
||||
public String getSelectionText() {
|
||||
return "вызов в строке " + line;
|
||||
}
|
||||
@Override
|
||||
public void Select(boolean flag) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import Common.Utils.Index;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.mxgraph.model.mxCell;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -10,12 +11,19 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class FuncInfo extends FileObjectWithMessages {
|
||||
//----------------------------------------------------------
|
||||
@Expose
|
||||
public int lineEnd;
|
||||
@Expose
|
||||
public String funcName;
|
||||
@Expose
|
||||
public FunctionType type;
|
||||
@Expose
|
||||
public boolean doNotInline;
|
||||
@Expose
|
||||
public boolean doNotAnalyze;
|
||||
@Expose
|
||||
public boolean needToInline;
|
||||
@Expose
|
||||
public FuncParam parameters;
|
||||
//вызовы функций в теле этой функции
|
||||
public Vector<FuncCall> calls = new Vector<>();
|
||||
@@ -66,7 +74,6 @@ public class FuncInfo extends FileObjectWithMessages {
|
||||
public ImageIcon GetDisabledIcon() {
|
||||
return Utils_.getIcon("/icons/Function.png");
|
||||
}
|
||||
@Override
|
||||
public void SelectAllChildren(boolean select) {
|
||||
for (String file_name : own_calls.keySet())
|
||||
for (FuncCall fc : own_calls.get(file_name))
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Functions;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.Vector;
|
||||
public class FuncParam {
|
||||
static final int IN_BIT = 16;
|
||||
static final int OUT_BIT = 256;
|
||||
@Expose
|
||||
Vector<Integer> inout_types;
|
||||
@Expose
|
||||
Vector<String> identificators;
|
||||
@Expose
|
||||
Vector<String> parametersT;
|
||||
@Expose
|
||||
int countOfPars;
|
||||
public FuncParam() {
|
||||
countOfPars = 0;
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Includes;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.ProjectData.SapforData.FileObject;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class FileInfo extends FileObject {
|
||||
public Vector<DependencyInfo> dependencies = new Vector<>();
|
||||
@Expose
|
||||
public List<DependencyInfo> dependencies = new Vector<>();
|
||||
public FileInfo(String file_in) {
|
||||
super(file_in);
|
||||
}
|
||||
@@ -13,15 +16,12 @@ public class FileInfo extends FileObject {
|
||||
public String getSelectionText() {
|
||||
return file;
|
||||
}
|
||||
@Override
|
||||
public boolean isSelectionEnabled() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public ImageIcon GetDisabledIcon() {
|
||||
return Utils_.getIcon("/Common/icons/File.png");
|
||||
}
|
||||
@Override
|
||||
public void SelectAllChildren(boolean select) {
|
||||
for (DependencyInfo di : dependencies)
|
||||
di.Select(select);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Loops.Json;
|
||||
import _VisualDVM.ProjectData.SapforData.Loops.Loop;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class LoopsJson {
|
||||
@Expose
|
||||
public List<Loop> values= new Vector<>();
|
||||
}
|
||||
@@ -5,25 +5,60 @@ import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.Messages.Message;
|
||||
import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
|
||||
import _VisualDVM.ProjectData.SapforData.Functions.FuncCall;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class Loop extends FileObjectWithMessages {
|
||||
@Expose
|
||||
private final int lineNumAfterLoop;
|
||||
@Expose
|
||||
private final int perfectLoop;
|
||||
@Expose
|
||||
private final boolean hasOutGoto;
|
||||
@Expose
|
||||
private final boolean hasPrints;
|
||||
@Expose
|
||||
private final boolean hasNonRectIters;
|
||||
//
|
||||
@Expose
|
||||
private final int childCount;
|
||||
@Expose
|
||||
public LoopState loopState;
|
||||
public Vector<FileObjectWithMessages> children = new Vector<>();
|
||||
//---
|
||||
@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<>();
|
||||
//--
|
||||
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 Loop(String[] packedLoopInfo, Index idx, DBProjectFile father_in) {
|
||||
file = father_in.name;
|
||||
int calls = Integer.parseInt(packedLoopInfo[idx.Inc()]);
|
||||
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()]);
|
||||
children.add(new FuncCall(father_in, c_name, c_line));
|
||||
func_calls.add(new FuncCall(father_in, c_name, c_line));
|
||||
}
|
||||
line = Integer.parseInt(packedLoopInfo[idx.Inc()]);
|
||||
lineNumAfterLoop = Integer.parseInt(packedLoopInfo[idx.Inc()]);
|
||||
@@ -43,38 +78,38 @@ public class Loop extends FileObjectWithMessages {
|
||||
loopState = LoopState.Loop;
|
||||
break;
|
||||
}
|
||||
hasNonRectIters = (Integer.parseInt(packedLoopInfo[idx.Inc()]) == 1);
|
||||
hasNonRectIters = (Integer.parseInt(packedLoopInfo[idx.Inc()]) == 1); //+
|
||||
if (hasNonRectIters)
|
||||
children.add(new NonRectIter(father_in, line));
|
||||
non_rect_iters.add(new NonRectIter(father_in, line));
|
||||
////-------------------------------------------------------------------------------
|
||||
// число внешних переходов
|
||||
int e_gotos = Integer.parseInt(packedLoopInfo[idx.Inc()]);
|
||||
for (int k = 0; k < e_gotos; ++k) {
|
||||
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()]);
|
||||
children.add(new EGoto(father_in, c_line));
|
||||
e_gotos.add(new EGoto(father_in, c_line));
|
||||
}
|
||||
//число внутренних переходов
|
||||
int i_gotos = Integer.parseInt(packedLoopInfo[idx.Inc()]);
|
||||
for (int k = 0; k < i_gotos; ++k) {
|
||||
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()]);
|
||||
children.add(new IGoto(father_in, c_line));
|
||||
i_gotos.add(new IGoto(father_in, c_line));
|
||||
}
|
||||
//число операторов печати
|
||||
int IO = Integer.parseInt(packedLoopInfo[idx.Inc()]);
|
||||
for (int k = 0; k < IO; ++k) {
|
||||
int IOs_size = Integer.parseInt(packedLoopInfo[idx.Inc()]); //+
|
||||
for (int k = 0; k < IOs_size; ++k) {
|
||||
int c_line = Integer.parseInt(packedLoopInfo[idx.Inc()]);
|
||||
children.add(new IO(father_in, c_line));
|
||||
ios.add(new IO(father_in, c_line));
|
||||
}
|
||||
//число операторов останова (STOPб PAUSE)
|
||||
int stop = Integer.parseInt(packedLoopInfo[idx.Inc()]);
|
||||
for (int k = 0; k < stop; ++k) {
|
||||
int stops_size = Integer.parseInt(packedLoopInfo[idx.Inc()]); //++
|
||||
for (int k = 0; k < stops_size; ++k) {
|
||||
int c_line = Integer.parseInt(packedLoopInfo[idx.Inc()]);
|
||||
children.add(new Stop(father_in, c_line));
|
||||
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);
|
||||
loops.add(nextChild);
|
||||
}
|
||||
father_in.AllLoops.put(line, this);
|
||||
//нельзя использовать конструктор с параметрами из за особеностей распаковки.
|
||||
|
||||
Reference in New Issue
Block a user