106 lines
3.9 KiB
Java
106 lines
3.9 KiB
Java
package TestingSystem.DVM.DVMConfiguration;
|
||
import Common.Database.DBObject;
|
||
import Common.Utils.Utils;
|
||
import GlobalData.RunConfiguration.RunConfiguration;
|
||
import TestingSystem.Common.Configuration;
|
||
|
||
import java.util.Vector;
|
||
//конфгурация тестирования ДВМ
|
||
public class DVMConfiguration extends Configuration {
|
||
//компиляция.
|
||
public String flags = "\n";
|
||
public int c_maxtime = 40;
|
||
//матрица
|
||
public int cube = 0; //
|
||
public int max_proc_count = 4;
|
||
public int min_dim_proc_count = 1;
|
||
public int max_dim_proc_count = 4;
|
||
//запуск
|
||
public String environments="\n";
|
||
public String usr_par = "";
|
||
//-
|
||
//под флагами понимается в данном случае набор цепочек флагов запакованных через энтер.
|
||
// скорее всего будет лишь одна цепочка. с окружением похожая ситуация.
|
||
@Override
|
||
public String getFlags() {
|
||
return flags;
|
||
}
|
||
@Override
|
||
public Vector<String> getFlagsArray() {
|
||
return Utils.unpackStrings(flags);
|
||
}
|
||
//-
|
||
public Vector<String> getEnvironments() {
|
||
return Utils.unpackStrings(environments);
|
||
}
|
||
public Vector<String> getParams() {
|
||
return Utils.unpackStrings(usr_par);
|
||
}
|
||
public Vector<String> getMatrixes(int testDim) {
|
||
Vector<Vector<Integer>> res_ = new Vector<>();
|
||
Vector<String> res = new Vector<>();
|
||
if ((max_proc_count==0) || (min_dim_proc_count == 0 && max_dim_proc_count == 0)) {
|
||
res.add("");
|
||
} else {
|
||
if (testDim > 0) {
|
||
Vector<String> min_border = new Vector<>();
|
||
Vector<String> max_border = new Vector<>();
|
||
for (int i = 1; i <= testDim; ++i) {
|
||
min_border.add(String.valueOf(min_dim_proc_count));
|
||
max_border.add(String.valueOf(max_dim_proc_count));
|
||
}
|
||
Vector<Integer> from = RunConfiguration.getBounds(String.join(" ", min_border));
|
||
Vector<Integer> to = RunConfiguration.getBounds(String.join(" ", max_border));
|
||
if (from.size() != to.size()) {
|
||
return res;
|
||
}
|
||
if (from.size() != testDim) {
|
||
return res;
|
||
}
|
||
//1 стадия. заполнение.
|
||
for (int j = from.get(0); j <= to.get(0); ++j) {
|
||
Vector<Integer> m = new Vector<>();
|
||
res_.add(m);
|
||
m.add(j);
|
||
}
|
||
//---
|
||
if (testDim > 1) RunConfiguration.gen_rec(from, to, res_, 1, testDim, cube == 1);
|
||
for (Vector<Integer> m : res_) {
|
||
Vector<String> ms = new Vector<>();
|
||
int proc = 1;
|
||
for (int i : m) {
|
||
ms.add(String.valueOf(i));
|
||
proc *= i;
|
||
}
|
||
if (proc <= max_proc_count)
|
||
res.add(String.join(" ", ms));
|
||
}
|
||
} else res.add("");
|
||
}
|
||
return res;
|
||
}
|
||
public String getParamsText() {
|
||
Vector<String> params = getParams();
|
||
if ((params.size() == 1) && params.get(0).isEmpty()) return "";
|
||
return String.join("\n", params);
|
||
}
|
||
//-
|
||
@Override
|
||
public void SynchronizeFields(DBObject src) {
|
||
super.SynchronizeFields(src);
|
||
DVMConfiguration c = (DVMConfiguration) src;
|
||
flags = c.flags;
|
||
c_maxtime=c.c_maxtime;
|
||
cube= c.cube;
|
||
max_proc_count=c.max_proc_count;
|
||
min_dim_proc_count=c.min_dim_proc_count;
|
||
max_dim_proc_count=c.max_dim_proc_count;
|
||
environments=c.environments;
|
||
usr_par=c.usr_par;
|
||
}
|
||
public DVMConfiguration(DVMConfiguration src){
|
||
this.SynchronizeFields(src);
|
||
}
|
||
public DVMConfiguration(){}
|
||
}
|