рефакторинг. подготовка к переводу регионов на json

This commit is contained in:
2025-05-12 17:18:26 +03:00
parent d8178fa704
commit ef92651552
11 changed files with 184 additions and 141 deletions

View File

@@ -7,7 +7,6 @@ import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.ProjectData.DBArray.DBArray;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.Dimension;
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateDimension;
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateDimensionState;
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateLink;
@@ -57,57 +56,52 @@ public class ProjectArray extends DBObject {
//--
//----------------------------------------------------------------------
public static final String[] alignNames = {"i", "j", "k", "l", "m", "n", "q", "r", "s", "t", "u", "w", "x", "y", "z"};
//json-------------------
public String UniqKey;
public BigInteger address;
public void print(){
//только для шаблонов. для ФИЛЬТРА управления распределением измерений.
//<editor-fold desc="Функционал шаблона">
public Vector<BigInteger> regIDs;
public Vector<TemplateDimension> dimensions;
public LinkedHashMap<Long, ProjectArray> links;
public ProjectArray align_template = null; //ссылка на шаблон на который идет выравнивание.
public String spaces_shift = ""; //смещение из пробелов
public ParallelRegion parent_region = null; //родительяская область распараллеливания.
//ИЗМЕНЕНИЕ РАСПРЕДЕЛЕНИЯ
//текущие
public LinkedHashMap<Integer, Dimension> ac_current;
//кандидаты на замену.
public LinkedHashMap<Integer, Dimension> ac_new;
//https://stackoverflow.com/questions/4941372/how-to-insert-image-into-jtable-cell
public ArrayAlignmentBar bar = null;
//------
public void print() {
Vector<String> res = new Vector<>();
res.add(">");
res.add("id="+id);
res.add("packed_address="+ packed_address);
res.add("name="+name);
res.add("shortName="+shortName);
res.add("dimSize="+dimSize);
res.add("typeSize="+typeSize);
res.add("state="+state);
res.add("location="+location);
res.add("locName="+locName);
res.add("isTempFlag="+isTemplFlag);
res.add("isLoopArrayFlag="+isLoopArrayFlag);
res.add("id=" + id);
res.add("packed_address=" + packed_address);
res.add("name=" + name);
res.add("shortName=" + shortName);
res.add("dimSize=" + dimSize);
res.add("typeSize=" + typeSize);
res.add("state=" + state);
res.add("location=" + location);
res.add("locName=" + locName);
res.add("isTempFlag=" + isTemplFlag);
res.add("isLoopArrayFlag=" + isLoopArrayFlag);
res.add("<");
System.out.println(String.join("\n",res));
System.out.println(String.join("\n", res));
}
//--
public ArrayState getState() {
return ArrayState.fromInt(state);
}
public void setState(ArrayState state_in){
public void setState(ArrayState state_in) {
state = state_in.ordinal();
}
public ArrayLocation getLocation() {
return ArrayLocation.fromInt(location);
}
//только для шаблонов. для ФИЛЬТРА управления распределением измерений.
public Vector<TemplateDimension> dimensions = new Vector<>();
//------
public ParallelRegion parent_region = null; //родительяская область распараллеливания.
//связи->
public LinkedHashMap<Long, ProjectArray> links = new LinkedHashMap<>();
//------>
public ProjectArray align_template = null; //ссылка на шаблон на который идет выравнивание.
public String spaces_shift = ""; //смещение из пробелов
//ИЗМЕНЕНИЕ РАСПРЕДЕЛЕНИЯ
//------------------------------------------------------------------------------------------------------>
//текущие
public LinkedHashMap<Integer, Dimension> ac_current = new LinkedHashMap<>();
//кандидаты на замену.
public LinkedHashMap<Integer, Dimension> ac_new = new LinkedHashMap<>();
//https://stackoverflow.com/questions/4941372/how-to-insert-image-into-jtable-cell
public ArrayAlignmentBar bar = null;
//------------------------------------------------------------------------------------------------------>
//<editor-fold desc="Функционал шаблона">
public Vector<BigInteger> regIDs = new Vector<>();
//--
public ProjectArray(String[] infoF, Index idx, BigInteger address_in) {
id = Integer.parseInt(infoF[idx.Inc()]); //+
name = infoF[idx.Inc()]; //+
@@ -130,13 +124,12 @@ public class ProjectArray extends DBObject {
sizes_size = Integer.parseInt(infoF[idx.Inc()]);
for (int i = 0; i < sizes_size; ++i)
mappedDims.add(Integer.parseInt(infoF[idx.Inc()])); //+
//todo удалить после перехода на json
int templateInfo_size = Integer.parseInt(infoF[idx.Inc()]);
for (int i = 0; i < templateInfo_size; ++i) {
BigInteger key = new BigInteger(infoF[idx.Inc()]);
TemplateLink templateLink = new TemplateLink(infoF, idx);
// templateInfo.put(key, templateLink);
// templateInfo.put(key, templateLink);
}
//todo
String[] localSplited = infoF[idx.Inc()].split("\\|");
@@ -157,12 +150,19 @@ public class ProjectArray extends DBObject {
regions.add(localSplited[idxPl++]); //++
Init();
}
public void Init(){
// address = packed_address !=null ? new BigInteger(packed_address):BigInteger.ONE;
public void Init() {
//короткое имя+ функция/модуль/комон+ размерность
UniqKey = shortName + locName + dimSize;
for (ArrayDecl arrayDecl: declPlaces)
if (packed_address != null) address = new BigInteger(packed_address);
for (ArrayDecl arrayDecl : declPlaces)
arrayDecl.file = Utils_.toW(arrayDecl.file);
//-- полей нет в json поэтому они null
regIDs = new Vector<>();
dimensions = new Vector<>();
links = new LinkedHashMap<>();
ac_current = new LinkedHashMap<>();
ac_new = new LinkedHashMap<>();
//--
}
public static String fill_binary(int d, String binary) {
int delta = Math.abs(binary.length() - d);
@@ -405,7 +405,7 @@ public class ProjectArray extends DBObject {
}
@Override
public ImageIcon GetDisabledIcon() {
return Utils_.getIcon("/icons/Arrays/" +getState().toString() + ".png");
return Utils_.getIcon("/icons/Arrays/" + getState().toString() + ".png");
}
@Override
public void select(boolean flag) {