рефакторинг

This commit is contained in:
2023-09-29 21:46:08 +03:00
parent 12898b07bb
commit 760707e6fb
41 changed files with 510 additions and 486 deletions

4
.idea/workspace.xml generated
View File

@@ -113,11 +113,11 @@
<recent name="C:\Users\misha\Documents\visual_dvm_2020\src\Visual_DVM_2021\Passes\All" /> <recent name="C:\Users\misha\Documents\visual_dvm_2020\src\Visual_DVM_2021\Passes\All" />
</key> </key>
<key name="MoveMembersDialog.RECENTS_KEY"> <key name="MoveMembersDialog.RECENTS_KEY">
<recent name="Common.Constants.Constants" />
<recent name="Constants" />
<recent name="Common.Utils.InterruptThread" /> <recent name="Common.Utils.InterruptThread" />
<recent name="Common.Utils.Utils" /> <recent name="Common.Utils.Utils" />
<recent name="Common.Global" /> <recent name="Common.Global" />
<recent name="Repository.BugReport.BugReportInterface" />
<recent name="TestingSystem.Tasks.TestRunTaskInterface" />
</key> </key>
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\misha\Documents\visual_dvm_2020\src\Visual_DVM_2021\Passes\UI" /> <recent name="C:\Users\misha\Documents\visual_dvm_2020\src\Visual_DVM_2021\Passes\UI" />

View File

@@ -0,0 +1,357 @@
package Common.Constants;
import java.util.regex.Pattern;
public class Constants {
public static final int Nan = -1;
public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
public static char[] forbidden_file_name_characters = new char[]{
'#', '%', '&', '{', '}',
'<', '>', '*', '?', '!',
'$', '\'', '\"', '@', '+',
'`', '|', '=', '#', ':', '/', '\\',
'~', '^'
};
public static char[] regular_metasymbols = new char[]{
'<', '>', '(', ')', '[', ']', '{', '}', '^', '-', '=', '$', '!', '|', '?', '*', '+', '.'
};
//все запретные символы через пробел.
public static String all_forbidden_characters_string = "";
//https://losst.ru/komandy-terminala-linux
public static String[] linux_system_commands = new String[]{
//<editor-fold desc="все линуксовые команды. их МНОГО">
"a2p",
"ac",
"addgroup",
"adduser",
"agrep",
"alias",
"apropos",
"apt",
"aptitude",
"ar",
"arch",
"arp",
"as",
"aspell",
"at",
"awk",
"basename",
"bash",
"bс",
"bdiff",
"bfs",
"bg",
"biff",
"break",
"bs",
"bye",
"cal",
"calendar",
"cancel",
"cat",
"cc",
"cd",
"cfdisk",
"chdir",
"checkeq",
"checknr",
"chfn",
"chgrp",
"chmod",
"chown",
"chroot",
"chsh",
"cksum",
"clear",
"cmp",
"col",
"comm",
"compress",
"continue",
"cp",
"cpio",
"crontab",
"csh",
"csplit",
"ctags",
"cu",
"curl",
"cut",
"date",
"dc",
"dd",
"delgroup",
"deluser",
"depmod",
"deroff",
"df",
"dhclient",
"dig",
"dircmp",
"dirname",
"dmesg",
"dos2unix",
"dpkg",
"dpost",
"du",
"echo",
"ed",
"edit",
"egrep",
"eject",
"elm",
"emacs",
"emerge",
"enable",
"env",
"eqn",
"ex",
"exit",
"expand",
"expr",
"fc",
"fdisk",
"fg",
"fgrep",
"file",
"find",
"findsmb",
"finger",
"fmt",
"fold",
"for",
"foreach",
"free",
"fsck",
"ftp",
"fuser",
"gawk",
"getfacl",
"gpasswd",
"gprof",
"grep",
"groupadd",
"groupdel",
"groupmod",
"gnuzip",
"gview",
"gvim",
"gzip",
"halt",
"head",
"help",
"history",
"host",
"hostid",
"hostname",
"htop",
"id",
"ifconfig",
"ifdown",
"ifquery",
"ifup",
"info",
"insmod",
"iostat",
"ip",
"iwconfig",
"jobs",
"join",
"kill",
"killall",
"ksh",
"last",
"ld",
"ldd",
"less",
"link",
"ln",
"lo",
"locate",
"login",
"logname",
"logout",
"losetup",
"ls",
"lsmod",
"lsof",
"lzcat",
"lzma",
"mach",
"mailx",
"make",
"man",
"merge",
"mesg",
"mkdir",
"mkfs",
"mkswap",
"modinfo",
"modprobe",
"more",
"mount",
"mt",
"mv",
"mysql",
"mysqldump",
"nc",
"netstat",
"newgrp",
"nice",
"niscat",
"nischmod",
"nischown",
"nischttl",
"nisdefaults",
"nistbladm",
"nl",
"nmap",
"nohup",
"nroff",
"nslookup",
"od",
"on",
"onintr",
"pack",
"pacman",
"pagesize",
"parted",
"partprobe",
"passwd",
"paste",
"pax",
"pact",
"perl",
"pg",
"pico",
"pine",
"pkill",
"poweroff",
"pr",
"printenv",
"printf",
"ps",
"pstree",
"pvs",
"pwd",
"quit",
"rcp",
"readlink",
"reboot",
"red",
"rename",
"repeat",
"replace",
"rlogin",
"rm",
"rmdir",
"rmmod",
"route",
"rpcinfo",
"rsh",
"rsync",
"s2p",
"scp",
"screen",
"script",
"sdiff",
"sed",
"sendmail",
"service",
"set",
"setfacl",
"sfdisk",
"sftp",
"sh",
"shred",
"shutdown",
"sleep",
"slogin",
"smbclient",
"sort",
"spell",
"split",
"startx",
"ss",
"ssh",
"stat",
"stop",
"strftime",
"strip",
"stty",
"su",
"sudo",
"swapoff",
"swapon",
"systemctl",
"tabs",
"tac",
"tail",
"talk",
"tar",
"tcopy",
"tcpdump",
"tcsh",
"tee",
"telnet",
"test",
"time",
"timex",
"todos",
"top",
"touch",
"traceroute",
"tree",
"tty",
"umask",
"umount",
"unalias",
"uname",
"uncompress",
"uniq",
"unlink",
"unlzma",
"unpack",
"until",
"unxz",
"unzip",
"uptime",
"useradd",
"userdel",
"usermod",
"vacation",
"vi",
"vim",
"w",
"wait",
"wall",
"wc",
"wget",
"whereis",
"which",
"while",
"who",
"whoami",
"whois",
"Xorg",
"xargs",
"xfd",
"xhost",
"xlsfonts",
"xrdb",
"xset",
"xz",
"xzcat",
"yacc",
"yes",
"yppasswd",
"yum",
"zcat",
"zipcloack",
"zipinfo",
"zipnote",
"zipsplit",
"zypper"
//</editor-fold>
};
}

View File

@@ -1,4 +1,5 @@
package Common.Database; package Common.Database;
import Common.Constants.Constants;
import Common.Global; import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
import Repository.RepositoryRefuseException; import Repository.RepositoryRefuseException;
@@ -226,7 +227,7 @@ public abstract class Database {
(O) (tables.get(class_in).Data.get(pk)) : null; (O) (tables.get(class_in).Data.get(pk)) : null;
} }
public <O extends iDBObject> O getById(Class<O> class_in, int pk) { public <O extends iDBObject> O getById(Class<O> class_in, int pk) {
return getByPK(class_in, pk, Utils.Nan); return getByPK(class_in, pk, Constants.Nan);
} }
public <G, O extends DBObject, F extends DBObject> LinkedHashMap<G, F> getByFKAndGroupBy(O owner, Class<F> fk_class, String group_field, Class<G> group_class) { public <G, O extends DBObject, F extends DBObject> LinkedHashMap<G, F> getByFKAndGroupBy(O owner, Class<F> fk_class, String group_field, Class<G> group_class) {
LinkedHashMap<G, F> res = new LinkedHashMap<>(); LinkedHashMap<G, F> res = new LinkedHashMap<>();

View File

@@ -1,5 +1,5 @@
package Common.Database; package Common.Database;
import Common.Utils.Utils; import Common.Constants.Constants;
import com.sun.org.glassfish.gmbal.Description; import com.sun.org.glassfish.gmbal.Description;
//автоинкрементальный ключ //автоинкрементальный ключ
public class iDBObject extends DBObject { public class iDBObject extends DBObject {
@@ -15,7 +15,7 @@ public class iDBObject extends DBObject {
} }
@Override @Override
public Object getEmptyFK() { public Object getEmptyFK() {
return Utils.Nan; return Constants.Nan;
} }
//--- //---
@Override @Override

View File

@@ -1,4 +1,5 @@
package Common.UI; package Common.UI;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Database.DBTable; import Common.Database.DBTable;
@@ -9,7 +10,6 @@ import Common.UI.Menus.TableMenu;
import Common.UI.Tables.ColumnInfo; import Common.UI.Tables.ColumnInfo;
import Common.UI.Tables.DataTable; import Common.UI.Tables.DataTable;
import Common.UI.Tables.Grid.GridAnchestor; import Common.UI.Tables.Grid.GridAnchestor;
import Common.Utils.Utils;
import GlobalData.Grid.Grid; import GlobalData.Grid.Grid;
import javax.swing.*; import javax.swing.*;
@@ -209,7 +209,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
} }
}; };
if (CurrentName() != Current.Undefined) { if (CurrentName() != Current.Undefined) {
current_row_i = Utils.Nan; current_row_i = Constants.Nan;
ListSelectionModel selModel = control.getSelectionModel(); ListSelectionModel selModel = control.getSelectionModel();
selModel.addListSelectionListener(e -> { selModel.addListSelectionListener(e -> {
int row = control.getSelectedRow(); int row = control.getSelectedRow();
@@ -227,7 +227,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
} }
} }
} else { } else {
current_row_i = Utils.Nan; current_row_i = Constants.Nan;
// System.out.println("no current row_i="+current_row_i); // System.out.println("no current row_i="+current_row_i);
getDataSource().dropCurrent(); getDataSource().dropCurrent();
if (events_on) { if (events_on) {

View File

@@ -1,10 +1,11 @@
package Common.UI.Menus; package Common.UI.Menus;
import Common.Constants.Constants;
import Common.Utils.Utils; import Common.Utils.Utils;
import javax.swing.*; import javax.swing.*;
public class TableMenu extends StyledPopupMenu { public class TableMenu extends StyledPopupMenu {
int row = Utils.Nan; int row = Constants.Nan;
int column = Utils.Nan; int column = Constants.Nan;
Object target = null; Object target = null;
//- //-
JTable owner = null; JTable owner = null;

View File

@@ -1,13 +1,13 @@
package Common.UI.Tables; package Common.UI.Tables;
import Common.Utils.Utils; import Common.Constants.Constants;
public class ColumnInfo { public class ColumnInfo {
private String Name = "?"; private String Name = "?";
private boolean visible = true; private boolean visible = true;
private boolean editable = false; private boolean editable = false;
private TableRenderers renderer = TableRenderers.RendererDefault; private TableRenderers renderer = TableRenderers.RendererDefault;
private TableEditors editor = TableEditors.EditorDefault; private TableEditors editor = TableEditors.EditorDefault;
private int maxWidth = Utils.Nan; private int maxWidth = Constants.Nan;
private int minWidth = Utils.Nan; private int minWidth = Constants.Nan;
//private int lastWidth = Utils.Nan; //private int lastWidth = Utils.Nan;
// public void setLastWidth(int width_in) { // public void setLastWidth(int width_in) {
// lastWidth = width_in; // lastWidth = width_in;
@@ -72,7 +72,7 @@ public class ColumnInfo {
this.maxWidth = maxWidth_in; this.maxWidth = maxWidth_in;
} }
public boolean hasMaxWidth() { public boolean hasMaxWidth() {
return maxWidth != Utils.Nan; return maxWidth != Constants.Nan;
} }
//- //-
public int getMinWidth() { public int getMinWidth() {
@@ -82,7 +82,7 @@ public class ColumnInfo {
this.minWidth = minWidth_in; this.minWidth = minWidth_in;
} }
public boolean hasMinWidth() { public boolean hasMinWidth() {
return minWidth != Utils.Nan; return minWidth != Constants.Nan;
} }
/* /*

View File

@@ -1,4 +1,5 @@
package Common.Utils; package Common.Utils;
import Common.Constants.Constants;
import Common.Global; import Common.Global;
import Common.UI.UI; import Common.UI.UI;
import ProjectData.Files.DBProjectFile; import ProjectData.Files.DBProjectFile;
@@ -34,367 +35,14 @@ import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
public class Utils { public class Utils {
public static Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); public static Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
public static final int Nan = -1;
public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
//https://losst.ru/komandy-terminala-linux
public static String[] linux_system_commands = new String[]{
//<editor-fold desc="все линуксовые команды. их МНОГО">
"a2p",
"ac",
"addgroup",
"adduser",
"agrep",
"alias",
"apropos",
"apt",
"aptitude",
"ar",
"arch",
"arp",
"as",
"aspell",
"at",
"awk",
"basename",
"bash",
"bс",
"bdiff",
"bfs",
"bg",
"biff",
"break",
"bs",
"bye",
"cal",
"calendar",
"cancel",
"cat",
"cc",
"cd",
"cfdisk",
"chdir",
"checkeq",
"checknr",
"chfn",
"chgrp",
"chmod",
"chown",
"chroot",
"chsh",
"cksum",
"clear",
"cmp",
"col",
"comm",
"compress",
"continue",
"cp",
"cpio",
"crontab",
"csh",
"csplit",
"ctags",
"cu",
"curl",
"cut",
"date",
"dc",
"dd",
"delgroup",
"deluser",
"depmod",
"deroff",
"df",
"dhclient",
"dig",
"dircmp",
"dirname",
"dmesg",
"dos2unix",
"dpkg",
"dpost",
"du",
"echo",
"ed",
"edit",
"egrep",
"eject",
"elm",
"emacs",
"emerge",
"enable",
"env",
"eqn",
"ex",
"exit",
"expand",
"expr",
"fc",
"fdisk",
"fg",
"fgrep",
"file",
"find",
"findsmb",
"finger",
"fmt",
"fold",
"for",
"foreach",
"free",
"fsck",
"ftp",
"fuser",
"gawk",
"getfacl",
"gpasswd",
"gprof",
"grep",
"groupadd",
"groupdel",
"groupmod",
"gnuzip",
"gview",
"gvim",
"gzip",
"halt",
"head",
"help",
"history",
"host",
"hostid",
"hostname",
"htop",
"id",
"ifconfig",
"ifdown",
"ifquery",
"ifup",
"info",
"insmod",
"iostat",
"ip",
"iwconfig",
"jobs",
"join",
"kill",
"killall",
"ksh",
"last",
"ld",
"ldd",
"less",
"link",
"ln",
"lo",
"locate",
"login",
"logname",
"logout",
"losetup",
"ls",
"lsmod",
"lsof",
"lzcat",
"lzma",
"mach",
"mailx",
"make",
"man",
"merge",
"mesg",
"mkdir",
"mkfs",
"mkswap",
"modinfo",
"modprobe",
"more",
"mount",
"mt",
"mv",
"mysql",
"mysqldump",
"nc",
"netstat",
"newgrp",
"nice",
"niscat",
"nischmod",
"nischown",
"nischttl",
"nisdefaults",
"nistbladm",
"nl",
"nmap",
"nohup",
"nroff",
"nslookup",
"od",
"on",
"onintr",
"pack",
"pacman",
"pagesize",
"parted",
"partprobe",
"passwd",
"paste",
"pax",
"pact",
"perl",
"pg",
"pico",
"pine",
"pkill",
"poweroff",
"pr",
"printenv",
"printf",
"ps",
"pstree",
"pvs",
"pwd",
"quit",
"rcp",
"readlink",
"reboot",
"red",
"rename",
"repeat",
"replace",
"rlogin",
"rm",
"rmdir",
"rmmod",
"route",
"rpcinfo",
"rsh",
"rsync",
"s2p",
"scp",
"screen",
"script",
"sdiff",
"sed",
"sendmail",
"service",
"set",
"setfacl",
"sfdisk",
"sftp",
"sh",
"shred",
"shutdown",
"sleep",
"slogin",
"smbclient",
"sort",
"spell",
"split",
"startx",
"ss",
"ssh",
"stat",
"stop",
"strftime",
"strip",
"stty",
"su",
"sudo",
"swapoff",
"swapon",
"systemctl",
"tabs",
"tac",
"tail",
"talk",
"tar",
"tcopy",
"tcpdump",
"tcsh",
"tee",
"telnet",
"test",
"time",
"timex",
"todos",
"top",
"touch",
"traceroute",
"tree",
"tty",
"umask",
"umount",
"unalias",
"uname",
"uncompress",
"uniq",
"unlink",
"unlzma",
"unpack",
"until",
"unxz",
"unzip",
"uptime",
"useradd",
"userdel",
"usermod",
"vacation",
"vi",
"vim",
"w",
"wait",
"wall",
"wc",
"wget",
"whereis",
"which",
"while",
"who",
"whoami",
"whois",
"Xorg",
"xargs",
"xfd",
"xhost",
"xlsfonts",
"xrdb",
"xset",
"xz",
"xzcat",
"yacc",
"yes",
"yppasswd",
"yum",
"zcat",
"zipcloack",
"zipinfo",
"zipnote",
"zipsplit",
"zypper"
//</editor-fold>
};
public static char[] forbidden_file_name_characters = new char[]{
'#', '%', '&', '{', '}',
'<', '>', '*', '?', '!',
'$', '\'', '\"', '@', '+',
'`', '|', '=', '#', ':', '/', '\\',
'~', '^'
};
public static char[] regular_metasymbols = new char[]{
'<', '>', '(', ')', '[', ']', '{', '}', '^', '-', '=', '$', '!', '|', '?', '*', '+', '.'
};
//все запретные символы через пробел.
public static String all_forbidden_characters_string = "";
public static String hideRegularMetasymbols(String word) { public static String hideRegularMetasymbols(String word) {
String res = word.replace("\\", "\\\\"); String res = word.replace("\\", "\\\\");
for (char c : regular_metasymbols) for (char c : Constants.regular_metasymbols)
res = res.replace(String.valueOf(c), "\\" + c); res = res.replace(String.valueOf(c), "\\" + c);
return res; return res;
} }
public static boolean isLinuxSystemCommand(String text) { public static boolean isLinuxSystemCommand(String text) {
for (String command : linux_system_commands) { for (String command : Constants.linux_system_commands) {
if (text.equalsIgnoreCase(command)) return true; if (text.equalsIgnoreCase(command)) return true;
} }
return false; return false;
@@ -406,13 +54,13 @@ public class Utils {
return false; return false;
} }
public static boolean isForbidden(char c) { public static boolean isForbidden(char c) {
for (char f : forbidden_file_name_characters) for (char f : Constants.forbidden_file_name_characters)
if (c == f) return true; if (c == f) return true;
return false; return false;
} }
public static void init() { public static void init() {
for (char f : forbidden_file_name_characters) for (char f : Constants.forbidden_file_name_characters)
all_forbidden_characters_string += f + " "; Constants.all_forbidden_characters_string += f + " ";
} }
public static String DQuotes(Object o) { public static String DQuotes(Object o) {
return "\"" + o.toString() + "\""; return "\"" + o.toString() + "\"";
@@ -516,7 +164,7 @@ public class Utils {
} }
} }
} }
public static long last_ticks = Utils.Nan; public static long last_ticks = Constants.Nan;
public static void sleep(long millis) { public static void sleep(long millis) {
try { try {
Thread.sleep(millis); Thread.sleep(millis);
@@ -819,7 +467,7 @@ public class Utils {
res = false; res = false;
} }
if (ContainsForbiddenName(name)) { if (ContainsForbiddenName(name)) {
Log.Writeln_("Имя файла не может содержать запрещённых символов\n" + all_forbidden_characters_string); Log.Writeln_("Имя файла не может содержать запрещённых символов\n" + Constants.all_forbidden_characters_string);
res = false; res = false;
} }
return res; return res;
@@ -851,7 +499,7 @@ public class Utils {
validateProjectFolder_r(dir, files_list); validateProjectFolder_r(dir, files_list);
if (!files_list.isEmpty()) if (!files_list.isEmpty())
Log.Writeln_("Имена " + filesLines.length + " файлов/подпапок содержат запрещённые символы " + Log.Writeln_("Имена " + filesLines.length + " файлов/подпапок содержат запрещённые символы " +
all_forbidden_characters_string + Constants.all_forbidden_characters_string +
"или кириллицу"); "или кириллицу");
//нужно проверить корень на наличие хоть одной программы. //нужно проверить корень на наличие хоть одной программы.
return Log.isEmpty(); return Log.isEmpty();
@@ -996,7 +644,7 @@ public class Utils {
Files.copy(i, dst.toPath(), StandardCopyOption.REPLACE_EXISTING); Files.copy(i, dst.toPath(), StandardCopyOption.REPLACE_EXISTING);
} }
public static boolean validateEmail(String address, TextLog log) { public static boolean validateEmail(String address, TextLog log) {
Matcher matcher = VALID_EMAIL_ADDRESS_REGEX.matcher(address); Matcher matcher = Constants.VALID_EMAIL_ADDRESS_REGEX.matcher(address);
if (!matcher.find()) { if (!matcher.find()) {
log.Writeln_("введённый адрес электронной почты некорректен."); log.Writeln_("введённый адрес электронной почты некорректен.");
return false; return false;
@@ -1052,7 +700,6 @@ public class Utils {
public static Process startScript(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception { public static Process startScript(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception {
return startScript(scriptDirectory, targetDirectory, name, scriptText, null); return startScript(scriptDirectory, targetDirectory, name, scriptText, null);
} }
public static Process startScript_(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception { public static Process startScript_(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception {
//-> //->
File scriptFile = Paths.get(scriptDirectory.getAbsolutePath(), name + (Global.isWindows ? ".bat" : "")).toFile(); File scriptFile = Paths.get(scriptDirectory.getAbsolutePath(), name + (Global.isWindows ? ".bat" : "")).toFile();
@@ -1427,7 +1074,7 @@ public class Utils {
return false; return false;
} }
public static void copyDirectory(File src, File dst) throws Exception { public static void copyDirectory(File src, File dst) throws Exception {
int code = Utils.Nan; int code = Constants.Nan;
String command = "xcopy " + String command = "xcopy " +
Utils.DQuotes(src.getAbsolutePath()) + " " + Utils.DQuotes(src.getAbsolutePath()) + " " +
Utils.DQuotes(dst.getAbsolutePath()) + " /e"; Utils.DQuotes(dst.getAbsolutePath()) + " /e";

View File

@@ -1,4 +1,5 @@
package Common.Utils.Validators; package Common.Utils.Validators;
import Common.Constants.Constants;
import Common.Utils.TextLog; import Common.Utils.TextLog;
import Common.Utils.Utils; import Common.Utils.Utils;
import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities; import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities;
@@ -53,7 +54,7 @@ public class PathValidator extends Validator {
Log.Writeln(string_name + ": имя файла или каталога в пути имеет неверный формат"); Log.Writeln(string_name + ": имя файла или каталога в пути имеет неверный формат");
break; break;
case Forbidden: case Forbidden:
Log.Writeln(string_name + ": Составляющие путь имена содержат запрещённые символы \n" + Utils.all_forbidden_characters_string); Log.Writeln(string_name + ": Составляющие путь имена содержат запрещённые символы \n" + Constants.all_forbidden_characters_string);
break; break;
case Name: case Name:
if (spaces_count > 0) if (spaces_count > 0)

View File

@@ -1,18 +1,18 @@
package GlobalData.Credentials; package GlobalData.Credentials;
import Common.Constants.Constants;
import Common.Database.iDBObject; import Common.Database.iDBObject;
import Common.Utils.Utils;
import com.sun.org.glassfish.gmbal.Description; import com.sun.org.glassfish.gmbal.Description;
public class Credentials extends iDBObject { public class Credentials extends iDBObject {
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int machine_id = Utils.Nan; public int machine_id = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int user_id = Utils.Nan; public int user_id = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int compiler_id = Utils.Nan; public int compiler_id = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int makefile_id = Utils.Nan; public int makefile_id = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int runconfiguration_id = Utils.Nan; public int runconfiguration_id = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int remotesapfor_id = Utils.Nan; public int remotesapfor_id = Constants.Nan;
} }

View File

@@ -1,12 +1,13 @@
package GlobalData.EnvironmentValue; package GlobalData.EnvironmentValue;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Database.iDBObject; import Common.Database.iDBObject;
import Common.Utils.Utils; import Common.Utils.Utils;
public class EnvironmentValue extends iDBObject { public class EnvironmentValue extends iDBObject {
public String name = ""; public String name = "";
public String value = ""; public String value = "";
public int machine_id = Utils.Nan; //для удаления машин public int machine_id = Constants.Nan; //для удаления машин
public int run_configuration_id = Utils.Nan; public int run_configuration_id = Constants.Nan;
@Override @Override
public boolean isVisible() { public boolean isVisible() {
return Current.HasRunConfiguration() && (run_configuration_id == Current.getRunConfiguration().id); return Current.HasRunConfiguration() && (run_configuration_id == Current.getRunConfiguration().id);

View File

@@ -1,11 +1,11 @@
package GlobalData.Module; package GlobalData.Module;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.Utils.Utils;
import GlobalData.Makefile.Makefile; import GlobalData.Makefile.Makefile;
import ProjectData.LanguageName; import ProjectData.LanguageName;
public class Module extends ModuleAnchestor { public class Module extends ModuleAnchestor {
public int makefile_id = Utils.Nan; public int makefile_id = Constants.Nan;
public LanguageName language = LanguageName.n; public LanguageName language = LanguageName.n;
public int on = 1; //учитывать ли модуль при сборке. указание пользователя. если файлы отсутствуют - игнорится public int on = 1; //учитывать ли модуль при сборке. указание пользователя. если файлы отсутствуют - игнорится
public Module() { public Module() {

View File

@@ -1,12 +1,13 @@
package GlobalData.Module; package GlobalData.Module;
import Common.Constants.Constants;
import Common.Database.iDBObject; import Common.Database.iDBObject;
import Common.Global; import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
import GlobalData.Compiler.Compiler; import GlobalData.Compiler.Compiler;
public class ModuleAnchestor extends iDBObject { public class ModuleAnchestor extends iDBObject {
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
public int machine_id = Utils.Nan; public int machine_id = Constants.Nan;
public int compiler_id = Utils.Nan; public int compiler_id = Constants.Nan;
public String command = ""; //дополнительная команда компилятору. между вызовом и флагами. public String command = ""; //дополнительная команда компилятору. между вызовом и флагами.
public String flags = ""; //последовательность флагов public String flags = ""; //последовательность флагов
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------

View File

@@ -1,8 +1,8 @@
package GlobalData.Module.UI; package GlobalData.Module.UI;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.UI.UI; import Common.UI.UI;
import Common.UI.Windows.Dialog.DBObjectDialog; import Common.UI.Windows.Dialog.DBObjectDialog;
import Common.Utils.Utils;
import GlobalData.Compiler.Compiler; import GlobalData.Compiler.Compiler;
import GlobalData.Compiler.CompilerType; import GlobalData.Compiler.CompilerType;
import GlobalData.Makefile.Makefile; import GlobalData.Makefile.Makefile;
@@ -100,7 +100,7 @@ public class ModuleAnchestorForm<T extends ModuleAnchestor> extends DBObjectDial
public void ProcessResult() { public void ProcessResult() {
Result.machine_id = Current.getMachine().id; Result.machine_id = Current.getMachine().id;
Compiler compiler = (Compiler) fields.cbCompilers.getSelectedItem(); Compiler compiler = (Compiler) fields.cbCompilers.getSelectedItem();
Result.compiler_id = (compiler != null) ? compiler.id : Utils.Nan; Result.compiler_id = (compiler != null) ? compiler.id : Constants.Nan;
Result.command = command; Result.command = command;
Result.flags = flags; Result.flags = flags;
} }

View File

@@ -1,4 +1,5 @@
package GlobalData.RunConfiguration; package GlobalData.RunConfiguration;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Database.iDBObject; import Common.Database.iDBObject;
import Common.Global; import Common.Global;
@@ -22,7 +23,7 @@ public class RunConfiguration extends iDBObject {
public int machine_id; public int machine_id;
//----------------------------------------> //---------------------------------------->
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int compiler_id = Utils.Nan; public int compiler_id = Constants.Nan;
public String LauncherCall = ""; //например DVM или mpirun public String LauncherCall = ""; //например DVM или mpirun
public String LauncherOptions = ""; //например run public String LauncherOptions = ""; //например run
//-------------------------------------- //--------------------------------------
@@ -175,7 +176,7 @@ public class RunConfiguration extends iDBObject {
} }
public String getLaunchShortDescription() { public String getLaunchShortDescription() {
String res = ""; String res = "";
if (compiler_id != Utils.Nan) { if (compiler_id != Constants.Nan) {
res += getCompiler().description; res += getCompiler().description;
if (!LauncherOptions.isEmpty()) if (!LauncherOptions.isEmpty())
res += " " + LauncherOptions; res += " " + LauncherOptions;

View File

@@ -1,11 +1,11 @@
package GlobalData.RunConfiguration; package GlobalData.RunConfiguration;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Database.*; import Common.Database.*;
import Common.Global; import Common.Global;
import Common.UI.DataSetControlForm; import Common.UI.DataSetControlForm;
import Common.UI.UI; import Common.UI.UI;
import Common.UI.Windows.Dialog.DBObjectDialog; import Common.UI.Windows.Dialog.DBObjectDialog;
import Common.Utils.Utils;
import GlobalData.Compiler.Compiler; import GlobalData.Compiler.Compiler;
import GlobalData.Compiler.CompilerType; import GlobalData.Compiler.CompilerType;
import GlobalData.DVMParameter.DVMParameter; import GlobalData.DVMParameter.DVMParameter;
@@ -68,7 +68,7 @@ public class RunConfigurationsDBTable extends iDBTable<RunConfiguration> {
Result.LauncherOptions = (String) fields.cbLaunchOptions.getSelectedItem(); Result.LauncherOptions = (String) fields.cbLaunchOptions.getSelectedItem();
if (fields.cbLauncherCall.getSelectedItem() instanceof Compiler) { if (fields.cbLauncherCall.getSelectedItem() instanceof Compiler) {
Result.compiler_id = ((Compiler) (fields.cbLauncherCall.getSelectedItem())).id; Result.compiler_id = ((Compiler) (fields.cbLauncherCall.getSelectedItem())).id;
} else Result.compiler_id = Utils.Nan; } else Result.compiler_id = Constants.Nan;
//- //-
Result.dim = (int) fields.sMaxDim.getValue(); Result.dim = (int) fields.sMaxDim.getValue();
Result.minMatrix = fields.minMatrixBar.pack(Result.dim); Result.minMatrix = fields.minMatrixBar.pack(Result.dim);

View File

@@ -1,7 +1,7 @@
package GlobalData.SapforProfileSetting; package GlobalData.SapforProfileSetting;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Database.iDBObject; import Common.Database.iDBObject;
import Common.Utils.Utils;
import GlobalData.Settings.SettingName; import GlobalData.Settings.SettingName;
import com.sun.org.glassfish.gmbal.Description; import com.sun.org.glassfish.gmbal.Description;
public class SapforProfileSetting extends iDBObject { public class SapforProfileSetting extends iDBObject {
@@ -10,7 +10,7 @@ public class SapforProfileSetting extends iDBObject {
@Description("DEFAULT ''") @Description("DEFAULT ''")
public String value = ""; public String value = "";
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int sapforprofile_id = Utils.Nan; public int sapforprofile_id = Constants.Nan;
@Override @Override
public boolean isVisible() { public boolean isVisible() {
return Current.HasSapforProfile() && Current.getSapforProfile().id == sapforprofile_id; return Current.HasSapforProfile() && Current.getSapforProfile().id == sapforprofile_id;

View File

@@ -1,6 +1,6 @@
package GlobalData.Splitter; package GlobalData.Splitter;
import Common.Constants.Constants;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Utils.Utils;
import com.sun.org.glassfish.gmbal.Description; import com.sun.org.glassfish.gmbal.Description;
import javax.swing.*; import javax.swing.*;
@@ -8,7 +8,7 @@ public class Splitter extends DBObject {
@Description("PRIMARY KEY, UNIQUE") @Description("PRIMARY KEY, UNIQUE")
public String name = ""; public String name = "";
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int position = Utils.Nan; public int position = Constants.Nan;
public Splitter() { public Splitter() {
} }
public Splitter(JSplitPane splitPane) { public Splitter(JSplitPane splitPane) {

View File

@@ -1,4 +1,5 @@
package GlobalData.Tasks.CompilationTask; package GlobalData.Tasks.CompilationTask;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
@@ -15,7 +16,7 @@ import org.apache.commons.io.FileUtils;
import java.io.File; import java.io.File;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
public class CompilationTask extends Task { public class CompilationTask extends Task {
public int makefile_id = Utils.Nan; public int makefile_id = Constants.Nan;
public String binary_name = ""; //исполняемый файл. public String binary_name = ""; //исполняемый файл.
//--------------------------------------------------- //---------------------------------------------------
@Description("DEFAULT ''") @Description("DEFAULT ''")

View File

@@ -1,4 +1,5 @@
package GlobalData.Tasks.RunTask; package GlobalData.Tasks.RunTask;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.Utils.StringTemplate; import Common.Utils.StringTemplate;
@@ -17,8 +18,8 @@ import java.io.File;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.List; import java.util.List;
public class RunTask extends Task { public class RunTask extends Task {
public int compilation_task_id = Utils.Nan; //нужна для бинарника public int compilation_task_id = Constants.Nan; //нужна для бинарника
public int run_configuration_id = Utils.Nan; public int run_configuration_id = Constants.Nan;
@Description("DEFAULT ''") @Description("DEFAULT ''")
public String last_sts_name = ""; public String last_sts_name = "";
@Description("DEFAULT 0") @Description("DEFAULT 0")
@@ -152,7 +153,7 @@ public class RunTask extends Task {
public boolean hasDVMPar() { public boolean hasDVMPar() {
RunConfiguration config = getRunConfiguration(); RunConfiguration config = getRunConfiguration();
return return
config.compiler_id != Utils.Nan && config.compiler_id != Constants.Nan &&
config.getCompiler().type.equals(CompilerType.dvm) && config.getCompiler().type.equals(CompilerType.dvm) &&
!config.getParList().isEmpty() !config.getParList().isEmpty()
; ;

View File

@@ -1,4 +1,5 @@
package GlobalData.Tasks.Supervisor.Local; package GlobalData.Tasks.Supervisor.Local;
import Common.Constants.Constants;
import Common.Global; import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
import GlobalData.Tasks.RunTask.RunTask; import GlobalData.Tasks.RunTask.RunTask;
@@ -22,7 +23,7 @@ public abstract class LocalTaskSupervisor<T extends Task> extends TaskSupervisor
protected int exitCode; protected int exitCode;
@Override @Override
protected void StartTask() throws Exception { protected void StartTask() throws Exception {
exitCode = Utils.Nan; exitCode = Constants.Nan;
taskProcess = Utils.startScript(task.getLocalWorkspace(), getProjectCopy(), "start_task_script", getScriptText(), getEnvs()); taskProcess = Utils.startScript(task.getLocalWorkspace(), getProjectCopy(), "start_task_script", getScriptText(), getEnvs());
task.state = TaskState.Running; task.state = TaskState.Running;
} }

View File

@@ -1,4 +1,5 @@
package GlobalData.Tasks; package GlobalData.Tasks;
import Common.Constants.Constants;
import Common.Database.iDBObject; import Common.Database.iDBObject;
import Common.Global; import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
@@ -15,8 +16,8 @@ public abstract class Task extends iDBObject {
//</editor-fold> //</editor-fold>
public TaskState state = TaskState.Inactive; public TaskState state = TaskState.Inactive;
//---------------------------------- //----------------------------------
public int machine_id = Utils.Nan; public int machine_id = Constants.Nan;
public int user_id = Utils.Nan; public int user_id = Constants.Nan;
//----------------------------------- //-----------------------------------
public String PID = ""; public String PID = "";
public String project_path;// путь к проекту. public String project_path;// путь к проекту.
@@ -28,9 +29,9 @@ public abstract class Task extends iDBObject {
public long EndDate = 0;//дата окончания выполнения public long EndDate = 0;//дата окончания выполнения
//--------------------------------- //---------------------------------
@Description("IGNORE") @Description("IGNORE")
public int progressStep = Utils.Nan; public int progressStep = Constants.Nan;
@Description("IGNORE") @Description("IGNORE")
public int progressAll = Utils.Nan; public int progressAll = Constants.Nan;
public boolean belongsToProject(db_project_info project) { public boolean belongsToProject(db_project_info project) {
return this.project_path.equalsIgnoreCase(project.Home.getAbsolutePath()); return this.project_path.equalsIgnoreCase(project.Home.getAbsolutePath());
} }
@@ -107,11 +108,11 @@ public abstract class Task extends iDBObject {
progressAll = progressAll_in; progressAll = progressAll_in;
} }
public void dropProgress() { public void dropProgress() {
progressStep = Utils.Nan; progressStep = Constants.Nan;
progressAll = Utils.Nan; progressAll = Constants.Nan;
} }
public boolean hasProgress() { public boolean hasProgress() {
return (progressStep != Utils.Nan) && (progressAll != Utils.Nan); return (progressStep != Constants.Nan) && (progressAll != Constants.Nan);
} }
//--------------------------------- //---------------------------------
public void AnalyzeResultsTexts(db_project_info project) throws Exception { public void AnalyzeResultsTexts(db_project_info project) throws Exception {

View File

@@ -1,7 +1,7 @@
package GlobalData.User; package GlobalData.User;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Database.iDBObject; import Common.Database.iDBObject;
import Common.Utils.Utils;
import GlobalData.Machine.Machine; import GlobalData.Machine.Machine;
import TestingSystem.UserConnection; import TestingSystem.UserConnection;
import Visual_DVM_2021.Passes.SSH.ConnectionPass; import Visual_DVM_2021.Passes.SSH.ConnectionPass;
@@ -12,7 +12,7 @@ import java.nio.file.Paths;
public class User extends iDBObject { public class User extends iDBObject {
public String login; public String login;
public String password = ""; public String password = "";
public int machine_id = Utils.Nan; public int machine_id = Constants.Nan;
public UserAuthentication authentication = UserAuthentication.password; public UserAuthentication authentication = UserAuthentication.password;
public String workspace = ""; //рабочая папка визуализатора пользователя на машине. полный путь. public String workspace = ""; //рабочая папка визуализатора пользователя на машине. полный путь.
public UserState state = UserState.initial; public UserState state = UserState.initial;

View File

@@ -1,4 +1,5 @@
package ProjectData.Project; package ProjectData.Project;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Global; import Common.Global;
@@ -82,7 +83,7 @@ public class db_project_info extends DBObject {
public String Log = "";//текст выдаваемый сапфором public String Log = "";//текст выдаваемый сапфором
//----------------------------------------------- //-----------------------------------------------
@Description("DEFAULT -1") @Description("DEFAULT -1")
public long creationDate = Utils.Nan; //--------------------------------------------------NEW. public long creationDate = Constants.Nan; //--------------------------------------------------NEW.
@Description("DEFAULT ''") @Description("DEFAULT ''")
public String compilation_output = ""; public String compilation_output = "";
@Description("DEFAULT ''") @Description("DEFAULT ''")
@@ -105,19 +106,19 @@ public class db_project_info extends DBObject {
public int maxdim = 0; public int maxdim = 0;
//<editor-fold desc="Метрика"> //<editor-fold desc="Метрика">
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int numLines = Utils.Nan; public int numLines = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int numSPF = Utils.Nan; public int numSPF = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int numDVM = Utils.Nan; public int numDVM = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int numArrays = Utils.Nan; public int numArrays = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int numLoops = Utils.Nan; public int numLoops = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int numFunctions = Utils.Nan; public int numFunctions = Constants.Nan;
@Description("DEFAULT -1") @Description("DEFAULT -1")
public int numAddicted = Utils.Nan; public int numAddicted = Constants.Nan;
//------------------------------------- //-------------------------------------
//параметры графа функций. храним для каждого проекта. //параметры графа функций. храним для каждого проекта.
@Description("DEFAULT 500") @Description("DEFAULT 500")
@@ -435,13 +436,13 @@ public class db_project_info extends DBObject {
allIncludes.clear(); allIncludes.clear();
files_order.clear(); files_order.clear();
functionsGraph.Clear(); functionsGraph.Clear();
numLines = Utils.Nan; numLines = Constants.Nan;
numSPF = Utils.Nan; numSPF = Constants.Nan;
numDVM = Utils.Nan; numDVM = Constants.Nan;
numArrays = Utils.Nan; numArrays = Constants.Nan;
numFunctions = Utils.Nan; numFunctions = Constants.Nan;
numAddicted = Utils.Nan; numAddicted = Constants.Nan;
numLoops = Utils.Nan; numLoops = Constants.Nan;
Log = ""; Log = "";
Scenario = ""; Scenario = "";
declaratedArrays.clear(); declaratedArrays.clear();
@@ -565,10 +566,10 @@ public class db_project_info extends DBObject {
return numLoops == ParallelVariant.statNaN ? recommendAnalysis(PassCode_2021.SPF_GetGraphLoops) : String.valueOf(numLoops); return numLoops == ParallelVariant.statNaN ? recommendAnalysis(PassCode_2021.SPF_GetGraphLoops) : String.valueOf(numLoops);
} }
public String FunctionsCount() { public String FunctionsCount() {
return numFunctions == Utils.Nan ? recommendAnalysis(PassCode_2021.SPF_GetGraphFunctions) : String.valueOf(numFunctions); return numFunctions == Constants.Nan ? recommendAnalysis(PassCode_2021.SPF_GetGraphFunctions) : String.valueOf(numFunctions);
} }
public String AddictedCount() { public String AddictedCount() {
return numAddicted == Utils.Nan ? recommendAnalysis(PassCode_2021.SPF_GetIncludeDependencies) : String.valueOf(numAddicted); return numAddicted == Constants.Nan ? recommendAnalysis(PassCode_2021.SPF_GetIncludeDependencies) : String.valueOf(numAddicted);
} }
public boolean UpdateLinesCount() { public boolean UpdateLinesCount() {
try { try {

View File

@@ -1,4 +1,5 @@
package Repository.Component; package Repository.Component;
import Common.Constants.Constants;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Global; import Common.Global;
import Common.Utils.Files.VFileChooser; import Common.Utils.Files.VFileChooser;
@@ -13,9 +14,9 @@ import java.nio.file.Paths;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
public abstract class Component extends DBObject implements Loggable { public abstract class Component extends DBObject implements Loggable {
public String date_text = Global.dateNaN; public String date_text = Global.dateNaN;
public long version = Utils.Nan; public long version = Constants.Nan;
public long actual_version = Utils.Nan; public long actual_version = Constants.Nan;
public long minimal_version = Utils.Nan; public long minimal_version = Constants.Nan;
//-- //--
public String code = ""; public String code = "";
public String actual_code = ""; public String actual_code = "";
@@ -33,7 +34,7 @@ public abstract class Component extends DBObject implements Loggable {
return String.valueOf(version); return String.valueOf(version);
} }
public void CheckIfNeedsUpdateOrPublish() { public void CheckIfNeedsUpdateOrPublish() {
if (actual_version != Utils.Nan) { if (actual_version != Constants.Nan) {
if (version < minimal_version) setState(ComponentState.Old_version); if (version < minimal_version) setState(ComponentState.Old_version);
else { else {
ComponentState new_state = ComponentState new_state =
@@ -47,7 +48,7 @@ public abstract class Component extends DBObject implements Loggable {
setState(ComponentState.Undefined); setState(ComponentState.Undefined);
if (getFile().exists()) { if (getFile().exists()) {
GetVersionInfo(); GetVersionInfo();
if (version == Utils.Nan) if (version == Constants.Nan)
setState(ComponentState.Unknown_version); setState(ComponentState.Unknown_version);
} else setState(ComponentState.Not_found); } else setState(ComponentState.Not_found);
} }
@@ -85,7 +86,7 @@ public abstract class Component extends DBObject implements Loggable {
return getComponentType(); return getComponentType();
} }
public boolean isValidVersion(TextLog Log, String desc) { public boolean isValidVersion(TextLog Log, String desc) {
if (version == Utils.Nan) { if (version == Constants.Nan) {
Log.Writeln_("Не определена версия " + desc + " компонента " + Utils.Brackets(getComponentType().getDescription())); Log.Writeln_("Не определена версия " + desc + " компонента " + Utils.Brackets(getComponentType().getDescription()));
return false; return false;
} }

View File

@@ -1,4 +1,5 @@
package Repository.Component.Sapfor; package Repository.Component.Sapfor;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.UI.UI; import Common.UI.UI;
@@ -365,7 +366,7 @@ public abstract class Sapfor extends OSDComponent {
//временный (?) проход, по тихому получить размерность теста, предварительно выполнив тихий парс. //временный (?) проход, по тихому получить размерность теста, предварительно выполнив тихий парс.
//тут все одноразовое. считаем что таблицы бд уже заполнены как надо. //тут все одноразовое. считаем что таблицы бд уже заполнены как надо.
public int getTextMaxDim(File testFile, db_project_info target) { public int getTextMaxDim(File testFile, db_project_info target) {
int res = Utils.Nan; int res = Constants.Nan;
LinkedHashMap<String, DBProjectFile> files = null; LinkedHashMap<String, DBProjectFile> files = null;
if (testFile != null) { if (testFile != null) {
DBProjectFile dbProjectFile = new DBProjectFile(testFile, target); DBProjectFile dbProjectFile = new DBProjectFile(testFile, target);

View File

@@ -1,6 +1,6 @@
package SapforTestingSystem.SapforTask; package SapforTestingSystem.SapforTask;
import Common.Constants.Constants;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Utils.Utils;
import GlobalData.Tasks.TaskState; import GlobalData.Tasks.TaskState;
import SapforTestingSystem.Json.SapforVersion_json; import SapforTestingSystem.Json.SapforVersion_json;
import com.google.gson.annotations.Expose; import com.google.gson.annotations.Expose;
@@ -11,10 +11,10 @@ public class SapforTask extends DBObject {
//------------------------------------>> //------------------------------------>>
@Description("PRIMARY KEY, UNIQUE") @Description("PRIMARY KEY, UNIQUE")
@Expose @Expose
public long id = Utils.Nan; public long id = Constants.Nan;
@Description("DEFAULT '-1'") @Description("DEFAULT '-1'")
@Expose @Expose
public int sapfortaskspackage_2023_id = Utils.Nan; public int sapfortaskspackage_2023_id = Constants.Nan;
//------------------------------------->> //------------------------------------->>
@Description("DEFAULT ''") @Description("DEFAULT ''")
@Expose @Expose

View File

@@ -1,8 +1,8 @@
package SapforTestingSystem.SapforTasksPackage; package SapforTestingSystem.SapforTasksPackage;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Database.iDBObject; import Common.Database.iDBObject;
import Common.Utils.Utils;
import SapforTestingSystem.SapforConfiguration.SapforConfiguration; import SapforTestingSystem.SapforConfiguration.SapforConfiguration;
import TestingSystem.Test.Test; import TestingSystem.Test.Test;
import Visual_DVM_2021.Passes.PassCode_2021; import Visual_DVM_2021.Passes.PassCode_2021;
@@ -10,7 +10,7 @@ import com.sun.org.glassfish.gmbal.Description;
import java.util.Vector; import java.util.Vector;
public class SapforTasksPackage extends iDBObject { public class SapforTasksPackage extends iDBObject {
public int sapforscenario_id = Utils.Nan; public int sapforscenario_id = Constants.Nan;
@Description("DEFAULT ''") @Description("DEFAULT ''")
public String sapforconfiguration_id = ""; public String sapforconfiguration_id = "";
//-- //--

View File

@@ -1,7 +1,7 @@
package SapforTestingSystem.ThreadTask; package SapforTestingSystem.ThreadTask;
import Common.Utils.Utils; import Common.Constants.Constants;
public class ThreadTask { public class ThreadTask {
public int id = Utils.Nan; public int id = Constants.Nan;
public Thread thread; public Thread thread;
public ThreadTask(int id_in, Runnable runnable){ public ThreadTask(int id_in, Runnable runnable){
id = id_in; id = id_in;

View File

@@ -1,6 +1,6 @@
package TestingSystem.Tasks; package TestingSystem.Tasks;
import Common.Constants.Constants;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Utils.Utils;
import GlobalData.Tasks.TaskState; import GlobalData.Tasks.TaskState;
import ProjectData.LanguageName; import ProjectData.LanguageName;
import TestingSystem.Configuration.Configuration; import TestingSystem.Configuration.Configuration;
@@ -16,7 +16,7 @@ public class TestRunTask extends TestTask {
return TestRunTaskInterface.isVisible(this); return TestRunTaskInterface.isVisible(this);
} }
//-- //--
public long testcompilationtask_id = Utils.Nan; public long testcompilationtask_id = Constants.Nan;
public String matrix = ""; public String matrix = "";
@Description("DEFAULT ''") @Description("DEFAULT ''")
public String args = ""; public String args = "";

View File

@@ -1,6 +1,6 @@
package TestingSystem.Tasks; package TestingSystem.Tasks;
import Common.Constants.Constants;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Utils.Utils;
import GlobalData.Tasks.TaskState; import GlobalData.Tasks.TaskState;
import TestingSystem.Configuration.Configuration; import TestingSystem.Configuration.Configuration;
import TestingSystem.Group.Group; import TestingSystem.Group.Group;
@@ -13,7 +13,7 @@ import java.util.Vector;
//тут все поля должны быть текстовыми. никаких ссылок по ид. мало ли, группу удалят //тут все поля должны быть текстовыми. никаких ссылок по ид. мало ли, группу удалят
public class TestTask extends DBObject { public class TestTask extends DBObject {
@Description("PRIMARY KEY, UNIQUE") @Description("PRIMARY KEY, UNIQUE")
public long id = Utils.Nan; public long id = Constants.Nan;
@Description("DEFAULT ''") @Description("DEFAULT ''")
public String taskspackage_id = ""; public String taskspackage_id = "";
@Description("DEFAULT ''") @Description("DEFAULT ''")

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All; package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.UI.UI; import Common.UI.UI;
import Common.UI.Windows.Dialog.Text.FileNameForm; import Common.UI.Windows.Dialog.Text.FileNameForm;
@@ -30,7 +31,7 @@ public class AddFile extends ChangeFilePass<DBProjectFile> {
if (Utils.ContainsForbiddenName(fileName)) { if (Utils.ContainsForbiddenName(fileName)) {
Log.Writeln_("Имя файла " + Utils.Brackets(fileName) Log.Writeln_("Имя файла " + Utils.Brackets(fileName)
+ " содержит запрещенные символы." + + " содержит запрещенные символы." +
"\n" + Utils.all_forbidden_characters_string); "\n" + Constants.all_forbidden_characters_string);
return false; return false;
} }
} else { } else {

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All; package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Utils.Utils; import Common.Utils.Utils;
import ProjectData.Files.DBProjectFile; import ProjectData.Files.DBProjectFile;
@@ -43,7 +44,7 @@ public class OpenSapforTest extends Pass_2021<SapforTaskResult> {
public MessageError unpackMessage(String line_in) throws Exception { public MessageError unpackMessage(String line_in) throws Exception {
MessageError res = new MessageError(); MessageError res = new MessageError();
res.file = ""; res.file = "";
res.line = Utils.Nan; res.line = Constants.Nan;
res.value = ""; res.value = "";
String line = line_in.substring(9); String line = line_in.substring(9);
System.out.println(line); System.out.println(line);

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All; package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Utils.Utils; import Common.Utils.Utils;
import ProjectData.Project.db_project_info; import ProjectData.Project.db_project_info;
import SapforTestingSystem.Json.SapforVersion_json; import SapforTestingSystem.Json.SapforVersion_json;
@@ -22,7 +23,7 @@ public class PerformSapforTasksPackage extends Pass_2021<SapforScenario_json> {
File task; File task;
//--- //---
Process process = null; Process process = null;
int exit_code = Utils.Nan; int exit_code = Constants.Nan;
//---- //----
File outputFile = null; File outputFile = null;
File errorsFile = null; File errorsFile = null;
@@ -75,7 +76,7 @@ public class PerformSapforTasksPackage extends Pass_2021<SapforScenario_json> {
} }
protected boolean performSapforScript(String name, File workspace, String flags, String command, String outName, String errName) throws Exception { protected boolean performSapforScript(String name, File workspace, String flags, String command, String outName, String errName) throws Exception {
process = null; process = null;
exit_code = Utils.Nan; exit_code = Constants.Nan;
//--- //---
File data_workspace = new File(workspace, db_project_info.data); File data_workspace = new File(workspace, db_project_info.data);
Utils.CheckDirectory(data_workspace); Utils.CheckDirectory(data_workspace);

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All; package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Global; import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
import ProjectData.Project.db_project_info; import ProjectData.Project.db_project_info;
@@ -25,7 +26,7 @@ public class PerformScenario extends Pass_2021<SapforScenario_json> {
File task; File task;
//--- //---
Process process = null; Process process = null;
int exit_code = Utils.Nan; int exit_code = Constants.Nan;
//---- //----
File outputFile = null; File outputFile = null;
File errorsFile = null; File errorsFile = null;
@@ -95,7 +96,7 @@ public class PerformScenario extends Pass_2021<SapforScenario_json> {
} }
protected boolean performSapforScript(String name, File workspace, String flags, String command, String outName, String errName) throws Exception { protected boolean performSapforScript(String name, File workspace, String flags, String command, String outName, String errName) throws Exception {
process = null; process = null;
exit_code = Utils.Nan; exit_code = Constants.Nan;
//--- //---
File data_workspace = new File(workspace, db_project_info.data); File data_workspace = new File(workspace, db_project_info.data);
Utils.CheckDirectory(data_workspace); Utils.CheckDirectory(data_workspace);

View File

@@ -1,8 +1,8 @@
package Visual_DVM_2021.Passes.All; package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.UI.Windows.Dialog.Dialog; import Common.UI.Windows.Dialog.Dialog;
import Common.Utils.Utils;
import GlobalData.Compiler.Compiler; import GlobalData.Compiler.Compiler;
import GlobalData.Compiler.CompilerType; import GlobalData.Compiler.CompilerType;
import GlobalData.CompilerEnvironment.CompilerEnvironment; import GlobalData.CompilerEnvironment.CompilerEnvironment;
@@ -29,7 +29,7 @@ public class PickCompilerEnvironments extends Pass_2021<String> {
protected boolean canStart(Object... args) throws Exception { protected boolean canStart(Object... args) throws Exception {
if (Current.Check(Log, Current.RunConfiguration)) { if (Current.Check(Log, Current.RunConfiguration)) {
RunConfiguration configuration = Current.getRunConfiguration(); RunConfiguration configuration = Current.getRunConfiguration();
if (configuration.compiler_id == Utils.Nan) { if (configuration.compiler_id == Constants.Nan) {
Log.Writeln_("Отсутвует DVM компилятор, связанный с текущей конфигурацией запуска.\n" + Log.Writeln_("Отсутвует DVM компилятор, связанный с текущей конфигурацией запуска.\n" +
"Если конфигурация содержит вызов DVM компилятора, но была создана на версии 801 и ниже,\n" + "Если конфигурация содержит вызов DVM компилятора, но была создана на версии 801 и ниже,\n" +
"войдите в окно её редактирования,нажмите ОК, а затем повторите попытку."); "войдите в окно её редактирования,нажмите ОК, а затем повторите попытку.");

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All; package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.UI.UI; import Common.UI.UI;
@@ -89,7 +90,7 @@ public class Precompilation extends Pass_2021<db_project_info> {
prepareForParse(); //----> prepareForParse(); //---->
//- //-
performanceTime = 0; performanceTime = 0;
exitCode = Utils.Nan; exitCode = Constants.Nan;
//------------------ //------------------
workspace = Paths.get(Global.TempDirectory.getAbsolutePath(), Utils.getDateName("precompilation")).toFile(); workspace = Paths.get(Global.TempDirectory.getAbsolutePath(), Utils.getDateName("precompilation")).toFile();
FileUtils.forceMkdir(workspace); FileUtils.forceMkdir(workspace);
@@ -138,8 +139,8 @@ public class Precompilation extends Pass_2021<db_project_info> {
protected static void unpackPrecompilationMessages(db_project_info target, String text) throws Exception { protected static void unpackPrecompilationMessages(db_project_info target, String text) throws Exception {
boolean messageStarted = false; boolean messageStarted = false;
String messageFile = ""; String messageFile = "";
int messageLine = Utils.Nan; int messageLine = Constants.Nan;
int messageType = Utils.Nan; int messageType = Constants.Nan;
Vector<String> messageText = new Vector<>(); Vector<String> messageText = new Vector<>();
String[] nw = text.split("\n"); String[] nw = text.split("\n");
for (String S : nw) { for (String S : nw) {
@@ -155,7 +156,7 @@ public class Precompilation extends Pass_2021<db_project_info> {
messageText.add(S.substring(6)); messageText.add(S.substring(6));
messageType = 2; messageType = 2;
} }
if (messageType != Utils.Nan) { if (messageType != Constants.Nan) {
target.db.files.Data.get(messageFile).CreateAndAddNewMessage(messageType, String.join("\n", messageText), messageLine, Message.parser_group); target.db.files.Data.get(messageFile).CreateAndAddNewMessage(messageType, String.join("\n", messageText), messageLine, Message.parser_group);
messageStarted = false; messageStarted = false;
} else { } else {
@@ -170,7 +171,7 @@ public class Precompilation extends Pass_2021<db_project_info> {
if (data.length > 1) { if (data.length > 1) {
messageFile = name; messageFile = name;
messageLine = Integer.parseInt(data[1]); messageLine = Integer.parseInt(data[1]);
messageType = Utils.Nan; messageType = Constants.Nan;
messageText = new Vector<>(); messageText = new Vector<>();
messageStarted = true; messageStarted = true;
} }

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes; package Visual_DVM_2021.Passes;
import Common.Constants.Constants;
import Common.Global; import Common.Global;
import Common.Utils.Utils; import Common.Utils.Utils;
@@ -10,13 +11,13 @@ import java.util.LinkedHashMap;
import java.util.Vector; import java.util.Vector;
public abstract class ProcessPass<T> extends Pass_2021<T> { public abstract class ProcessPass<T> extends Pass_2021<T> {
public Process process = null; public Process process = null;
public int exit_code = Utils.Nan; public int exit_code = Constants.Nan;
public LinkedHashMap<String, String> envs = new LinkedHashMap<>(); public LinkedHashMap<String, String> envs = new LinkedHashMap<>();
public Vector<String> output = new Vector<>(); public Vector<String> output = new Vector<>();
protected String process_path = ""; protected String process_path = "";
public void CreateProcess(String exec_path_in, File workspace, String ... command) throws Exception { public void CreateProcess(String exec_path_in, File workspace, String ... command) throws Exception {
output.clear(); output.clear();
exit_code = Utils.Nan; exit_code = Constants.Nan;
process_path = exec_path_in; process_path = exec_path_in;
ProcessBuilder procBuilder = new ProcessBuilder(process_path); ProcessBuilder procBuilder = new ProcessBuilder(process_path);
//- //-

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.UI.Main; package Visual_DVM_2021.UI.Main;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Database.DBObject; import Common.Database.DBObject;
import Common.Global; import Common.Global;
@@ -188,7 +189,7 @@ public abstract class ComparisonForm<T extends DBObject> {
//предполагаем что оба объекта есть и мы можем получить с них текст. //предполагаем что оба объекта есть и мы можем получить с них текст.
protected void Compare() throws Exception { protected void Compare() throws Exception {
events_on = false; events_on = false;
current_diff_line = Utils.Nan; current_diff_line = Constants.Nan;
colors.clear(); colors.clear();
//----------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------
Body.setText(""); Body.setText("");
@@ -252,7 +253,7 @@ public abstract class ComparisonForm<T extends DBObject> {
} }
public void Show() throws Exception { public void Show() throws Exception {
events_on = false; events_on = false;
current_diff_line = Utils.Nan; current_diff_line = Constants.Nan;
colors.clear(); colors.clear();
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
Body.setText(""); Body.setText("");
@@ -339,7 +340,7 @@ public abstract class ComparisonForm<T extends DBObject> {
//</editor-fold> //</editor-fold>
slave.master = this; slave.master = this;
bPrevious.addActionListener(e -> { bPrevious.addActionListener(e -> {
if (current_diff_line != Utils.Nan) { if (current_diff_line != Constants.Nan) {
if (current_diff_line > 0) if (current_diff_line > 0)
current_diff_line--; current_diff_line--;
else else
@@ -348,7 +349,7 @@ public abstract class ComparisonForm<T extends DBObject> {
} }
}); });
bNext.addActionListener(e -> { bNext.addActionListener(e -> {
if (current_diff_line != Utils.Nan) { if (current_diff_line != Constants.Nan) {
if (current_diff_line < colors.size() - 1) if (current_diff_line < colors.size() - 1)
current_diff_line++; current_diff_line++;
else else

View File

@@ -1,10 +1,10 @@
package Visual_DVM_2021.UI.Main; package Visual_DVM_2021.UI.Main;
import Common.Constants.Constants;
import Common.Global; import Common.Global;
import Common.UI.Editor.Viewer; import Common.UI.Editor.Viewer;
import Common.UI.Menus_2023.FileMenuBar.FileMenuBar; import Common.UI.Menus_2023.FileMenuBar.FileMenuBar;
import Common.UI.Trees.TreeForm; import Common.UI.Trees.TreeForm;
import Common.UI.UI; import Common.UI.UI;
import Common.Utils.Utils;
import GlobalData.Settings.SettingName; import GlobalData.Settings.SettingName;
import ProjectData.Files.DBProjectFile; import ProjectData.Files.DBProjectFile;
import ProjectData.Files.UI.Editor.SPFEditor; import ProjectData.Files.UI.Editor.SPFEditor;
@@ -29,7 +29,7 @@ public class FileForm implements FileWindow, FormWithSplitters {
//контролы в столбцах //контролы в столбцах
//https://stackoverflow.com/questions/7137786/how-can-i-put-a-control-in-the-jtableheader-of-a-jtable //https://stackoverflow.com/questions/7137786/how-can-i-put-a-control-in-the-jtableheader-of-a-jtable
//todo _ временно //todo _ временно
public static int current_file_line = Utils.Nan; public static int current_file_line = Constants.Nan;
private final Viewer compilationOutput; private final Viewer compilationOutput;
private final Viewer runOutput; private final Viewer runOutput;
private final Viewer gcovLog; private final Viewer gcovLog;

View File

@@ -1,10 +1,10 @@
package Visual_DVM_2021.UI.Main; package Visual_DVM_2021.UI.Main;
import Common.Constants.Constants;
import Common.Current; import Common.Current;
import Common.Global; import Common.Global;
import Common.UI.Menus_2023.TasksPackagesMenuBar.TasksPackagesMenuBar; import Common.UI.Menus_2023.TasksPackagesMenuBar.TasksPackagesMenuBar;
import Common.UI.TextField.StyledTextField; import Common.UI.TextField.StyledTextField;
import Common.UI.UI; import Common.UI.UI;
import Common.Utils.Utils;
import GlobalData.Compiler.CompilerType; import GlobalData.Compiler.CompilerType;
import GlobalData.Credentials.Credentials; import GlobalData.Credentials.Credentials;
import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage; import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
@@ -355,48 +355,48 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
@Override @Override
public void RestoreLastCredentials() { public void RestoreLastCredentials() {
Credentials credentials = (Credentials) Current.get(Current.Credentials); Credentials credentials = (Credentials) Current.get(Current.Credentials);
if (credentials.machine_id != Utils.Nan) { if (credentials.machine_id != Constants.Nan) {
if (Global.db.machines.containsKey(credentials.machine_id)) { if (Global.db.machines.containsKey(credentials.machine_id)) {
Global.db.machines.ShowUI(credentials.machine_id); Global.db.machines.ShowUI(credentials.machine_id);
if (Global.db.users.containsKey(credentials.user_id)) { if (Global.db.users.containsKey(credentials.user_id)) {
Global.db.users.ShowUI(credentials.user_id); Global.db.users.ShowUI(credentials.user_id);
} else { } else {
credentials.user_id = Utils.Nan; credentials.user_id = Constants.Nan;
Global.db.UpdateCredentials(); Global.db.UpdateCredentials();
} }
if (Global.db.compilers.containsKey(credentials.compiler_id)) { if (Global.db.compilers.containsKey(credentials.compiler_id)) {
Global.db.compilers.ShowUI(credentials.compiler_id); Global.db.compilers.ShowUI(credentials.compiler_id);
} else { } else {
credentials.compiler_id = Utils.Nan; credentials.compiler_id = Constants.Nan;
Global.db.UpdateCredentials(); Global.db.UpdateCredentials();
} }
//- //-
if (Global.db.makefiles.containsKey(credentials.makefile_id)) { if (Global.db.makefiles.containsKey(credentials.makefile_id)) {
Global.db.makefiles.ShowUI(credentials.makefile_id); Global.db.makefiles.ShowUI(credentials.makefile_id);
} else { } else {
credentials.makefile_id = Utils.Nan; credentials.makefile_id = Constants.Nan;
Global.db.UpdateCredentials(); Global.db.UpdateCredentials();
} }
//- //-
if (Global.db.runConfigurations.containsKey(credentials.runconfiguration_id)) { if (Global.db.runConfigurations.containsKey(credentials.runconfiguration_id)) {
Global.db.runConfigurations.ShowUI(credentials.runconfiguration_id); Global.db.runConfigurations.ShowUI(credentials.runconfiguration_id);
} else { } else {
credentials.runconfiguration_id = Utils.Nan; credentials.runconfiguration_id = Constants.Nan;
Global.db.UpdateCredentials(); Global.db.UpdateCredentials();
} }
if (Global.db.remoteSapfors.containsKey(credentials.remotesapfor_id)) { if (Global.db.remoteSapfors.containsKey(credentials.remotesapfor_id)) {
Global.db.remoteSapfors.ShowUI(credentials.remotesapfor_id); Global.db.remoteSapfors.ShowUI(credentials.remotesapfor_id);
} else { } else {
credentials.remotesapfor_id = Utils.Nan; credentials.remotesapfor_id = Constants.Nan;
Global.db.UpdateCredentials(); Global.db.UpdateCredentials();
} }
} else { } else {
credentials.machine_id = Utils.Nan; credentials.machine_id = Constants.Nan;
credentials.user_id = Utils.Nan; credentials.user_id = Constants.Nan;
credentials.compiler_id = Utils.Nan; credentials.compiler_id = Constants.Nan;
credentials.remotesapfor_id = Utils.Nan; credentials.remotesapfor_id = Constants.Nan;
credentials.makefile_id = Utils.Nan; credentials.makefile_id = Constants.Nan;
credentials.runconfiguration_id = Utils.Nan; credentials.runconfiguration_id = Constants.Nan;
Global.db.UpdateCredentials(); Global.db.UpdateCredentials();
} }
} }