2025-03-04 14:19:04 +03:00
|
|
|
package _VisualDVM.ServerObjectsCache;
|
|
|
|
|
import Common.Utils.Utils_;
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsJson;
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsSetJson;
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsJson;
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsSetJson;
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMSettings.DVMSettings;
|
2025-03-04 16:30:32 +03:00
|
|
|
import javafx.util.Pair;
|
2025-03-04 14:19:04 +03:00
|
|
|
|
2025-03-04 16:30:32 +03:00
|
|
|
import java.util.LinkedHashMap;
|
2025-03-04 14:19:04 +03:00
|
|
|
import java.util.Vector;
|
|
|
|
|
public class DVMSettingsCache extends VisualCache {
|
|
|
|
|
public OptionsSetJson optionsSetJson=null;
|
|
|
|
|
public EnvironmentsSetJson environmentsSetJson=null;
|
|
|
|
|
//--
|
|
|
|
|
public String optionsSummary = null;
|
|
|
|
|
public String environmentsSummary = null;
|
|
|
|
|
//--
|
|
|
|
|
public DVMSettingsCache(DVMSettings dvmSettings) {
|
|
|
|
|
//-->>
|
|
|
|
|
if (dvmSettings.packedCompilationOptionsJson.isEmpty())
|
|
|
|
|
optionsSetJson = new OptionsSetJson();
|
|
|
|
|
else
|
|
|
|
|
optionsSetJson = Utils_.gson.fromJson(dvmSettings.packedCompilationOptionsJson, OptionsSetJson.class);
|
|
|
|
|
//-->>
|
|
|
|
|
if (dvmSettings.packedRunEnvironmentValuesJson.isEmpty())
|
|
|
|
|
environmentsSetJson = new EnvironmentsSetJson();
|
|
|
|
|
else
|
|
|
|
|
environmentsSetJson = Utils_.gson.fromJson(dvmSettings.packedRunEnvironmentValuesJson, EnvironmentsSetJson.class);
|
|
|
|
|
//--
|
|
|
|
|
Vector<String> optionsSummary_=new Vector<>();
|
|
|
|
|
for (OptionsJson optionsJson: optionsSetJson.values){
|
|
|
|
|
optionsSummary_.add(optionsJson.toLine());
|
|
|
|
|
}
|
2025-03-04 16:30:32 +03:00
|
|
|
optionsSummary = String.join(";\n", optionsSummary_);
|
2025-03-04 14:19:04 +03:00
|
|
|
Vector<String> environmentsSummary_ = new Vector<>();
|
|
|
|
|
for (EnvironmentsJson environmentsJson: environmentsSetJson.values){
|
|
|
|
|
environmentsSummary_.add(environmentsJson.toLine());
|
|
|
|
|
}
|
2025-03-04 16:30:32 +03:00
|
|
|
environmentsSummary = String.join(";\n", environmentsSummary_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Vector<Pair<String, String>> getTasksParameters(){
|
|
|
|
|
//уравниваем количество наборов опций и окружений и сопоставляем 1 к 1
|
|
|
|
|
Vector<Pair<String, String>> res = new Vector<>();
|
|
|
|
|
for (int i=0;i< optionsSetJson.values.size(); ++i){
|
|
|
|
|
String optionsLine = optionsSetJson.values.get(i).toLine();
|
|
|
|
|
String environmentsLine = (i< environmentsSetJson.values.size())?
|
|
|
|
|
environmentsSetJson.values.get(i).toLine() : "";
|
|
|
|
|
res.add(new Pair<>(
|
|
|
|
|
optionsLine,
|
|
|
|
|
environmentsLine));
|
|
|
|
|
}
|
|
|
|
|
if (optionsSetJson.values.size()<environmentsSetJson.values.size()){
|
|
|
|
|
for (int i= optionsSetJson.values.size(); i<environmentsSetJson.values.size(); ++i){
|
|
|
|
|
res.add(new Pair<>(
|
|
|
|
|
"",
|
|
|
|
|
environmentsSetJson.values.get(i).toLine()
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return res;
|
2025-03-04 14:19:04 +03:00
|
|
|
}
|
|
|
|
|
}
|