|
|
|
|
@@ -1,7 +1,7 @@
|
|
|
|
|
package _VisualDVM.ProjectData.SapforData.Arrays;
|
|
|
|
|
import Common.Database.Objects.DBObject;
|
|
|
|
|
import Common.Utils.Index;
|
|
|
|
|
import Common.Utils.Pair;
|
|
|
|
|
import Common.Utils.IntegerPairJson;
|
|
|
|
|
import Common.Utils.Utils_;
|
|
|
|
|
import _VisualDVM.Global;
|
|
|
|
|
import _VisualDVM.Passes.PassCode;
|
|
|
|
|
@@ -13,31 +13,68 @@ import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateDimensionState
|
|
|
|
|
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateLink;
|
|
|
|
|
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
|
|
|
|
|
import _VisualDVM.ProjectData.SapforData.Regions.UI.ArrayAlignmentBar;
|
|
|
|
|
import com.google.gson.annotations.Expose;
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Vector;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
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"};
|
|
|
|
|
public String UniqKey;
|
|
|
|
|
public ArrayState State;
|
|
|
|
|
//-----------------------------
|
|
|
|
|
//json-------------------
|
|
|
|
|
@Expose
|
|
|
|
|
public long id;
|
|
|
|
|
@Expose
|
|
|
|
|
public String name;
|
|
|
|
|
@Expose
|
|
|
|
|
public String shortName;
|
|
|
|
|
@Expose
|
|
|
|
|
public int dimSize;
|
|
|
|
|
@Expose
|
|
|
|
|
public int typeSize;
|
|
|
|
|
public ArrayLocation location;
|
|
|
|
|
@Expose
|
|
|
|
|
int state;
|
|
|
|
|
@Expose
|
|
|
|
|
int location;
|
|
|
|
|
@Expose
|
|
|
|
|
public String locName;
|
|
|
|
|
@Expose
|
|
|
|
|
public int isTemplFlag;
|
|
|
|
|
@Expose
|
|
|
|
|
public int isLoopArrayFlag;
|
|
|
|
|
@Expose
|
|
|
|
|
Vector<ArrayDecl> declPlaces = new Vector<>();
|
|
|
|
|
//--шаблон---
|
|
|
|
|
@Expose
|
|
|
|
|
List<Integer> deprecateToDist = new Vector<>();
|
|
|
|
|
@Expose
|
|
|
|
|
List<Integer> mappedDims = new Vector<>();
|
|
|
|
|
@Expose
|
|
|
|
|
Vector<IntegerPairJson> sizes = new Vector<>();
|
|
|
|
|
@Expose
|
|
|
|
|
Vector<String> regions = new Vector<>();
|
|
|
|
|
|
|
|
|
|
// LinkedHashMap<BigInteger, TemplateLink> templateInfo = new LinkedHashMap<>();
|
|
|
|
|
//---
|
|
|
|
|
public String UniqKey;
|
|
|
|
|
public BigInteger address;
|
|
|
|
|
|
|
|
|
|
//--
|
|
|
|
|
public ArrayState getState() {
|
|
|
|
|
return ArrayState.fromInt(state);
|
|
|
|
|
}
|
|
|
|
|
public void setState(ArrayState state_in){
|
|
|
|
|
state = state_in.ordinal();
|
|
|
|
|
}
|
|
|
|
|
public ArrayLocation getLocation() {
|
|
|
|
|
return ArrayLocation.fromInt(location);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//только для шаблонов. для ФИЛЬТРА управления распределением измерений.
|
|
|
|
|
public Vector<TemplateDimension> dimensions = new Vector<>();
|
|
|
|
|
public int isTemplFlag;
|
|
|
|
|
public int isLoopArrayFlag;
|
|
|
|
|
//----------------------------
|
|
|
|
|
public BigInteger address;
|
|
|
|
|
//----------------------------
|
|
|
|
|
public ParallelRegion parent_region = null; //родительяская область распараллеливания.
|
|
|
|
|
//связи->
|
|
|
|
|
@@ -56,43 +93,41 @@ public class ProjectArray extends DBObject {
|
|
|
|
|
//------------------------------------------------------------------------------------------------------>
|
|
|
|
|
//<editor-fold desc="Функционал шаблона">
|
|
|
|
|
public Vector<BigInteger> regIDs = new Vector<>();
|
|
|
|
|
Vector<Pair<Integer, Integer>> sizes = new Vector<>();
|
|
|
|
|
Vector<Integer> deprecateToDist = new Vector<>();
|
|
|
|
|
Vector<Integer> mappedDims = new Vector<>();
|
|
|
|
|
LinkedHashMap<BigInteger, TemplateLink> templateInfo = new LinkedHashMap<>();
|
|
|
|
|
Vector<ArrayDecl> declPlaces = new Vector<>();
|
|
|
|
|
Vector<String> regions = new Vector<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--
|
|
|
|
|
public ProjectArray(String[] infoF, Index idx, BigInteger address_in) {
|
|
|
|
|
id = Integer.parseInt(infoF[idx.Inc()]);
|
|
|
|
|
name = infoF[idx.Inc()];
|
|
|
|
|
shortName = infoF[idx.Inc()];
|
|
|
|
|
dimSize = Integer.parseInt(infoF[idx.Inc()]);
|
|
|
|
|
typeSize = Integer.parseInt(infoF[idx.Inc()]);
|
|
|
|
|
address = address_in;
|
|
|
|
|
State = ArrayState.fromInt(Integer.parseInt(infoF[idx.Inc()]));
|
|
|
|
|
location = ArrayLocation.fromInt(Integer.parseInt(infoF[idx.Inc()]));
|
|
|
|
|
locName = infoF[idx.Inc()];
|
|
|
|
|
id = Integer.parseInt(infoF[idx.Inc()]); //+
|
|
|
|
|
name = infoF[idx.Inc()]; //+
|
|
|
|
|
shortName = infoF[idx.Inc()]; //+
|
|
|
|
|
dimSize = Integer.parseInt(infoF[idx.Inc()]); //+
|
|
|
|
|
typeSize = Integer.parseInt(infoF[idx.Inc()]); //+
|
|
|
|
|
// address = address_in;
|
|
|
|
|
state = Integer.parseInt(infoF[idx.Inc()]); //+
|
|
|
|
|
location = Integer.parseInt(infoF[idx.Inc()]); //+
|
|
|
|
|
locName = infoF[idx.Inc()]; //+
|
|
|
|
|
int sizes_size = Integer.parseInt(infoF[idx.Inc()]);
|
|
|
|
|
for (int i = 0; i < sizes_size; ++i) {
|
|
|
|
|
int first = Integer.parseInt(infoF[idx.Inc()]);
|
|
|
|
|
int second = Integer.parseInt(infoF[idx.Inc()]);
|
|
|
|
|
sizes.add(new Pair<>(first, second));
|
|
|
|
|
sizes.add(new IntegerPairJson(first, second)); //+
|
|
|
|
|
}
|
|
|
|
|
sizes_size = Integer.parseInt(infoF[idx.Inc()]);
|
|
|
|
|
for (int i = 0; i < sizes_size; ++i)
|
|
|
|
|
deprecateToDist.add(Integer.parseInt(infoF[idx.Inc()]));
|
|
|
|
|
deprecateToDist.add(Integer.parseInt(infoF[idx.Inc()])); //+
|
|
|
|
|
sizes_size = Integer.parseInt(infoF[idx.Inc()]);
|
|
|
|
|
for (int i = 0; i < sizes_size; ++i)
|
|
|
|
|
mappedDims.add(Integer.parseInt(infoF[idx.Inc()]));
|
|
|
|
|
mappedDims.add(Integer.parseInt(infoF[idx.Inc()])); //+
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
String[] localSplited = infoF[idx.Inc()].split("\\|");
|
|
|
|
|
isTemplFlag = Integer.parseInt(localSplited[0]);
|
|
|
|
|
isLoopArrayFlag = Integer.parseInt(localSplited[1]);
|
|
|
|
|
isTemplFlag = Integer.parseInt(localSplited[0]); //+
|
|
|
|
|
isLoopArrayFlag = Integer.parseInt(localSplited[1]); //+
|
|
|
|
|
int numDeclPlaces = Integer.parseInt(localSplited[2]);
|
|
|
|
|
int idxPl = 3;
|
|
|
|
|
for (int i = 0; i < numDeclPlaces; ++i, idxPl += 2) {
|
|
|
|
|
@@ -100,15 +135,18 @@ public class ProjectArray extends DBObject {
|
|
|
|
|
DBProjectFile file = Global.mainModule.getProject().db.files.Data.get(declFile);
|
|
|
|
|
int declLine = Integer.parseInt(localSplited[idxPl + 1]);
|
|
|
|
|
//declPlaces.add(new Pair<>(declFile, declLine));
|
|
|
|
|
ArrayDecl decl = new ArrayDecl(shortName, location, file, declLine);
|
|
|
|
|
ArrayDecl decl = new ArrayDecl(shortName, getLocation(), file, declLine);
|
|
|
|
|
declPlaces.add(decl);
|
|
|
|
|
file.array_decls.add(decl); //--
|
|
|
|
|
file.array_decls.add(decl); //++
|
|
|
|
|
}
|
|
|
|
|
int numRegs = Integer.parseInt(localSplited[idxPl++]);
|
|
|
|
|
for (int i = 0; i < numRegs; ++i)
|
|
|
|
|
regions.add(localSplited[idxPl++]);
|
|
|
|
|
UniqKey = shortName + locName + dimSize;
|
|
|
|
|
regions.add(localSplited[idxPl++]); //++
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
public void Init(){
|
|
|
|
|
//короткое имя+ функция/модуль/комон+ размерность
|
|
|
|
|
UniqKey = shortName + locName + dimSize;
|
|
|
|
|
}
|
|
|
|
|
public static String fill_binary(int d, String binary) {
|
|
|
|
|
int delta = Math.abs(binary.length() - d);
|
|
|
|
|
@@ -150,12 +188,12 @@ public class ProjectArray extends DBObject {
|
|
|
|
|
return (isLoopArrayFlag == 0) ? ((isTemplFlag == 0) ? "МАССИВ" : "ШАБЛОН") : "ЦИКЛ";
|
|
|
|
|
}
|
|
|
|
|
public String state_symbol() {
|
|
|
|
|
return State == ArrayState.Selected ? "☑" : "☐";
|
|
|
|
|
return getState() == ArrayState.Selected ? "☑" : "☐";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String toString() {
|
|
|
|
|
return id + " " + state_symbol() + " " +
|
|
|
|
|
State + " " +
|
|
|
|
|
getState() + " " +
|
|
|
|
|
shortName + " " +
|
|
|
|
|
locName + " : " + location + " " + dimSize + " " + typeSize;
|
|
|
|
|
}
|
|
|
|
|
@@ -339,7 +377,7 @@ public class ProjectArray extends DBObject {
|
|
|
|
|
public void SaveUserState() throws Exception {
|
|
|
|
|
if (Global.mainModule.getProject().db.savedArrays.Data.containsKey(UniqKey)) {
|
|
|
|
|
DBArray sa = Global.mainModule.getProject().db.savedArrays.Data.get(UniqKey);
|
|
|
|
|
sa.State = State;
|
|
|
|
|
sa.State = getState();
|
|
|
|
|
Global.mainModule.getProject().db.Update(sa);
|
|
|
|
|
} else
|
|
|
|
|
Global.mainModule.getProject().db.Insert(new DBArray(this));
|
|
|
|
|
@@ -347,11 +385,11 @@ public class ProjectArray extends DBObject {
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isSelectionEnabled() {
|
|
|
|
|
return (State == ArrayState.Selected) || (State == ArrayState.None);
|
|
|
|
|
return (getState() == ArrayState.Selected) || (getState() == ArrayState.None);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public ImageIcon GetDisabledIcon() {
|
|
|
|
|
return Utils_.getIcon("/icons/Arrays/" + State.toString() + ".png");
|
|
|
|
|
return Utils_.getIcon("/icons/Arrays/" +getState().toString() + ".png");
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void select(boolean flag) {
|
|
|
|
|
@@ -359,7 +397,7 @@ public class ProjectArray extends DBObject {
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isSelected() {
|
|
|
|
|
return (State == ArrayState.Selected);
|
|
|
|
|
return (getState() == ArrayState.Selected);
|
|
|
|
|
}
|
|
|
|
|
//-
|
|
|
|
|
public void init_new_ac() {
|
|
|
|
|
|