no message
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Variants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.ProjectData.PredictorStatistic.PredictorStatistics_2021;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
|
||||
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class ParallelVariant extends DBObject {
|
||||
public static final long statNaN = -1;
|
||||
public static final long rankNaN = 1;
|
||||
public String UniqKey = "";
|
||||
public int dc = 0;
|
||||
public db_project_info father = null;
|
||||
public PredictorStatistics_2021 stats = null;
|
||||
public Vector<String> templates_description = new Vector<>();
|
||||
public LinkedHashMap<Pair<BigInteger, BigInteger>, Long> key = new LinkedHashMap<>();
|
||||
public ParallelVariant(db_project_info father_in, Vector<BigInteger> vector) {
|
||||
father = father_in;
|
||||
UniqKey = "";
|
||||
dc = 0;
|
||||
for (int i = 0; i < vector.size(); i += 3) {
|
||||
ProjectArray template = father.getTemplateByAddress(vector.get(i));
|
||||
long varID = vector.get(i + 1).longValue(); //тут вар ид. он обычный лонг.
|
||||
ParallelRegion region = father.parallelRegions.get(vector.get(i + 2));
|
||||
if (varID != 0)
|
||||
dc++;
|
||||
templates_description.add(template.GetShortNameForVariant(varID));
|
||||
UniqKey += template.name + "_" + varID + "_" + region.originalName;
|
||||
key.put(new Pair<>(template.address, region.regionId), varID);
|
||||
}
|
||||
load_stats();
|
||||
}
|
||||
public void load_stats() {
|
||||
stats = father.db.predictorStatistics.Data.containsKey(UniqKey) ?
|
||||
father.db.predictorStatistics.Data.get(UniqKey) : new PredictorStatistics_2021(UniqKey);
|
||||
}
|
||||
public void UpdateStats(String packed, String last_version) throws Exception {
|
||||
stats.Unpack(packed);
|
||||
stats.last_version = last_version;
|
||||
if (stats.loaded) {
|
||||
father.db.Update(stats);
|
||||
} else {
|
||||
father.db.Insert(stats);
|
||||
stats.loaded = true;
|
||||
}
|
||||
}
|
||||
public boolean Match(boolean distributed) {
|
||||
for (Pair<BigInteger, BigInteger> p : key.keySet()) {
|
||||
ProjectArray template = father.getTemplateByAddress(p.getKey());
|
||||
if (!template.CheckFilterMask(key.get(p), distributed)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public String getVector() {
|
||||
String res = "";
|
||||
int i = 0;
|
||||
for (Pair<BigInteger, BigInteger> p : key.keySet()) {
|
||||
res += p.getKey() + "|" + key.get(p) + "|" + p.getValue() + ((i < key.size() - 1) ? "|" : "");
|
||||
++i;
|
||||
}
|
||||
res = i + "|" + res;
|
||||
return res;
|
||||
}
|
||||
public String getDescription() {
|
||||
return String.join(";", templates_description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return UniqKey;
|
||||
}
|
||||
@Override
|
||||
public void Select(boolean flag) {
|
||||
super.Select(flag);
|
||||
UI.getVersionsWindow().getVariantsWindow().ShowCheckedVariantsCount();
|
||||
}
|
||||
public File project = null;
|
||||
public File restoreProject() {
|
||||
project=null;
|
||||
if (stats != null) {
|
||||
if (stats.last_version.isEmpty()) return null;
|
||||
project = Paths.get(father.Home.getAbsolutePath(), stats.last_version).toFile();
|
||||
return project.exists() ? project : null;
|
||||
}
|
||||
return project;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Variants.UI;
|
||||
import Common.Visual.Tables.MaskedIntegerValueRenderer;
|
||||
public class VariantRankRenderer extends MaskedIntegerValueRenderer {
|
||||
@Override
|
||||
public long getMask() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Variants;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
|
||||
import static Common.Visual.Tables.TableRenderers.*;
|
||||
public class VariantsSet extends DataSet<String, ParallelVariant> {
|
||||
public VariantsSet() {
|
||||
super(String.class, ParallelVariant.class);
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "варианты";
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI() {
|
||||
return new DataSetControlForm(this) {
|
||||
@Override
|
||||
public boolean hasCheckBox() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void AdditionalInitColumns() {
|
||||
columns.get(0).setVisible(false);
|
||||
columns.get(2).setRenderer(RendererMultiline);
|
||||
for (int i = 3; i < columns.size() - 3; ++i)
|
||||
columns.get(i).setRenderer(RendererMaskedInt);
|
||||
columns.get(columns.size() - 3).setRenderer(RendererVariantRank);
|
||||
columns.get(columns.size() - 2).setRenderer(RendererDate);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public String[] getUIColumnNames() {
|
||||
return new String[]{"Распределение", "PARALLEL", "REMOTE", "REDISTRIBUTE", "INTERVALS",
|
||||
"PS.REMOTE", "PS.SHADOW", "PS.REDUCTION", "PS.ACROSS", "Оценка", "Дата оценки", "Версия"};
|
||||
}
|
||||
@Override
|
||||
public Object getFieldAt(ParallelVariant object, int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 2:
|
||||
return object.templates_description;
|
||||
case 3:
|
||||
return object.stats.ParallelCount;
|
||||
case 4:
|
||||
return object.stats.RemoteCount;
|
||||
case 5:
|
||||
return object.stats.RedistributeCount;
|
||||
case 6:
|
||||
return object.stats.IntervalCount;
|
||||
case 7:
|
||||
return object.stats.PS_RemoteCount;
|
||||
case 8:
|
||||
return object.stats.PS_ShadowCount;
|
||||
case 9:
|
||||
return object.stats.PS_ReductionCount;
|
||||
case 10:
|
||||
return object.stats.PS_AcrossCount;
|
||||
case 11:
|
||||
return object.stats.Rank;
|
||||
case 12:
|
||||
return object.stats.getPredictionDate();
|
||||
case 13:
|
||||
return object.stats.last_version;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Current CurrentName() {
|
||||
return Current.ParallelVariant;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user