From 760707e6fb28ab4c0b1c812101620071deb47d30 Mon Sep 17 00:00:00 2001 From: 02090095 Date: Fri, 29 Sep 2023 21:46:08 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 4 +- src/Common/Constants/Constants.java | 357 +++++++++++++++++ src/Common/Database/Database.java | 3 +- src/Common/Database/iDBObject.java | 4 +- src/Common/UI/DataSetControlForm.java | 6 +- src/Common/UI/Menus/TableMenu.java | 5 +- src/Common/UI/Tables/ColumnInfo.java | 10 +- src/Common/Utils/Utils.java | 375 +----------------- .../Utils/Validators/PathValidator.java | 3 +- src/GlobalData/Credentials/Credentials.java | 14 +- .../EnvironmentValue/EnvironmentValue.java | 5 +- src/GlobalData/Module/Module.java | 4 +- src/GlobalData/Module/ModuleAnchestor.java | 5 +- .../Module/UI/ModuleAnchestorForm.java | 4 +- .../RunConfiguration/RunConfiguration.java | 5 +- .../RunConfigurationsDBTable.java | 4 +- .../SapforProfileSetting.java | 4 +- src/GlobalData/Splitter/Splitter.java | 4 +- .../CompilationTask/CompilationTask.java | 3 +- src/GlobalData/Tasks/RunTask/RunTask.java | 7 +- .../Supervisor/Local/LocalTaskSupervisor.java | 3 +- src/GlobalData/Tasks/Task.java | 15 +- src/GlobalData/User/User.java | 4 +- src/ProjectData/Project/db_project_info.java | 35 +- src/Repository/Component/Component.java | 13 +- src/Repository/Component/Sapfor/Sapfor.java | 3 +- .../SapforTask/SapforTask.java | 6 +- .../SapforTasksPackage.java | 4 +- .../ThreadTask/ThreadTask.java | 4 +- src/TestingSystem/Tasks/TestRunTask.java | 4 +- src/TestingSystem/Tasks/TestTask.java | 4 +- src/Visual_DVM_2021/Passes/All/AddFile.java | 3 +- .../Passes/All/OpenSapforTest.java | 3 +- .../Passes/All/PerformSapforTasksPackage.java | 5 +- .../Passes/All/PerformScenario.java | 5 +- .../Passes/All/PickCompilerEnvironments.java | 4 +- .../Passes/All/Precompilation.java | 11 +- src/Visual_DVM_2021/Passes/ProcessPass.java | 5 +- .../UI/Main/ComparisonForm.java | 9 +- src/Visual_DVM_2021/UI/Main/FileForm.java | 4 +- src/Visual_DVM_2021/UI/Main/TestingForm.java | 26 +- 41 files changed, 510 insertions(+), 486 deletions(-) create mode 100644 src/Common/Constants/Constants.java diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d484f556..94a77bf8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -113,11 +113,11 @@ + + - - diff --git a/src/Common/Constants/Constants.java b/src/Common/Constants/Constants.java new file mode 100644 index 00000000..49e16ff9 --- /dev/null +++ b/src/Common/Constants/Constants.java @@ -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[]{ + // + "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" + // + }; +} diff --git a/src/Common/Database/Database.java b/src/Common/Database/Database.java index 405ea182..68ef5af1 100644 --- a/src/Common/Database/Database.java +++ b/src/Common/Database/Database.java @@ -1,4 +1,5 @@ package Common.Database; +import Common.Constants.Constants; import Common.Global; import Common.Utils.Utils; import Repository.RepositoryRefuseException; @@ -226,7 +227,7 @@ public abstract class Database { (O) (tables.get(class_in).Data.get(pk)) : null; } public O getById(Class class_in, int pk) { - return getByPK(class_in, pk, Utils.Nan); + return getByPK(class_in, pk, Constants.Nan); } public LinkedHashMap getByFKAndGroupBy(O owner, Class fk_class, String group_field, Class group_class) { LinkedHashMap res = new LinkedHashMap<>(); diff --git a/src/Common/Database/iDBObject.java b/src/Common/Database/iDBObject.java index beefc57e..2fbaa653 100644 --- a/src/Common/Database/iDBObject.java +++ b/src/Common/Database/iDBObject.java @@ -1,5 +1,5 @@ package Common.Database; -import Common.Utils.Utils; +import Common.Constants.Constants; import com.sun.org.glassfish.gmbal.Description; //автоинкрементальный ключ public class iDBObject extends DBObject { @@ -15,7 +15,7 @@ public class iDBObject extends DBObject { } @Override public Object getEmptyFK() { - return Utils.Nan; + return Constants.Nan; } //--- @Override diff --git a/src/Common/UI/DataSetControlForm.java b/src/Common/UI/DataSetControlForm.java index 9ce7165a..e527148d 100644 --- a/src/Common/UI/DataSetControlForm.java +++ b/src/Common/UI/DataSetControlForm.java @@ -1,4 +1,5 @@ package Common.UI; +import Common.Constants.Constants; import Common.Current; import Common.Database.DBObject; import Common.Database.DBTable; @@ -9,7 +10,6 @@ import Common.UI.Menus.TableMenu; import Common.UI.Tables.ColumnInfo; import Common.UI.Tables.DataTable; import Common.UI.Tables.Grid.GridAnchestor; -import Common.Utils.Utils; import GlobalData.Grid.Grid; import javax.swing.*; @@ -209,7 +209,7 @@ public class DataSetControlForm extends ControlWithCurrentForm { } }; if (CurrentName() != Current.Undefined) { - current_row_i = Utils.Nan; + current_row_i = Constants.Nan; ListSelectionModel selModel = control.getSelectionModel(); selModel.addListSelectionListener(e -> { int row = control.getSelectedRow(); @@ -227,7 +227,7 @@ public class DataSetControlForm extends ControlWithCurrentForm { } } } else { - current_row_i = Utils.Nan; + current_row_i = Constants.Nan; // System.out.println("no current row_i="+current_row_i); getDataSource().dropCurrent(); if (events_on) { diff --git a/src/Common/UI/Menus/TableMenu.java b/src/Common/UI/Menus/TableMenu.java index ab171596..3b6e06b3 100644 --- a/src/Common/UI/Menus/TableMenu.java +++ b/src/Common/UI/Menus/TableMenu.java @@ -1,10 +1,11 @@ package Common.UI.Menus; +import Common.Constants.Constants; import Common.Utils.Utils; import javax.swing.*; public class TableMenu extends StyledPopupMenu { - int row = Utils.Nan; - int column = Utils.Nan; + int row = Constants.Nan; + int column = Constants.Nan; Object target = null; //- JTable owner = null; diff --git a/src/Common/UI/Tables/ColumnInfo.java b/src/Common/UI/Tables/ColumnInfo.java index 76d2f71a..4b90788c 100644 --- a/src/Common/UI/Tables/ColumnInfo.java +++ b/src/Common/UI/Tables/ColumnInfo.java @@ -1,13 +1,13 @@ package Common.UI.Tables; -import Common.Utils.Utils; +import Common.Constants.Constants; public class ColumnInfo { private String Name = "?"; private boolean visible = true; private boolean editable = false; private TableRenderers renderer = TableRenderers.RendererDefault; private TableEditors editor = TableEditors.EditorDefault; - private int maxWidth = Utils.Nan; - private int minWidth = Utils.Nan; + private int maxWidth = Constants.Nan; + private int minWidth = Constants.Nan; //private int lastWidth = Utils.Nan; // public void setLastWidth(int width_in) { // lastWidth = width_in; @@ -72,7 +72,7 @@ public class ColumnInfo { this.maxWidth = maxWidth_in; } public boolean hasMaxWidth() { - return maxWidth != Utils.Nan; + return maxWidth != Constants.Nan; } //- public int getMinWidth() { @@ -82,7 +82,7 @@ public class ColumnInfo { this.minWidth = minWidth_in; } public boolean hasMinWidth() { - return minWidth != Utils.Nan; + return minWidth != Constants.Nan; } /* diff --git a/src/Common/Utils/Utils.java b/src/Common/Utils/Utils.java index 1355f9ca..c2a4cc45 100644 --- a/src/Common/Utils/Utils.java +++ b/src/Common/Utils/Utils.java @@ -1,4 +1,5 @@ package Common.Utils; +import Common.Constants.Constants; import Common.Global; import Common.UI.UI; import ProjectData.Files.DBProjectFile; @@ -34,367 +35,14 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; public class Utils { 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[]{ - // - "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" - // - }; - 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) { String res = word.replace("\\", "\\\\"); - for (char c : regular_metasymbols) + for (char c : Constants.regular_metasymbols) res = res.replace(String.valueOf(c), "\\" + c); return res; } 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; } return false; @@ -406,13 +54,13 @@ public class Utils { return false; } 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; return false; } public static void init() { - for (char f : forbidden_file_name_characters) - all_forbidden_characters_string += f + " "; + for (char f : Constants.forbidden_file_name_characters) + Constants.all_forbidden_characters_string += f + " "; } public static String DQuotes(Object o) { 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) { try { Thread.sleep(millis); @@ -819,7 +467,7 @@ public class Utils { res = false; } if (ContainsForbiddenName(name)) { - Log.Writeln_("Имя файла не может содержать запрещённых символов\n" + all_forbidden_characters_string); + Log.Writeln_("Имя файла не может содержать запрещённых символов\n" + Constants.all_forbidden_characters_string); res = false; } return res; @@ -851,7 +499,7 @@ public class Utils { validateProjectFolder_r(dir, files_list); if (!files_list.isEmpty()) Log.Writeln_("Имена " + filesLines.length + " файлов/подпапок содержат запрещённые символы " + - all_forbidden_characters_string + + Constants.all_forbidden_characters_string + "или кириллицу"); //нужно проверить корень на наличие хоть одной программы. return Log.isEmpty(); @@ -996,7 +644,7 @@ public class Utils { Files.copy(i, dst.toPath(), StandardCopyOption.REPLACE_EXISTING); } 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()) { log.Writeln_("введённый адрес электронной почты некорректен."); return false; @@ -1052,7 +700,6 @@ public class Utils { public static Process startScript(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception { return startScript(scriptDirectory, targetDirectory, name, scriptText, null); } - 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(); @@ -1427,7 +1074,7 @@ public class Utils { return false; } public static void copyDirectory(File src, File dst) throws Exception { - int code = Utils.Nan; + int code = Constants.Nan; String command = "xcopy " + Utils.DQuotes(src.getAbsolutePath()) + " " + Utils.DQuotes(dst.getAbsolutePath()) + " /e"; diff --git a/src/Common/Utils/Validators/PathValidator.java b/src/Common/Utils/Validators/PathValidator.java index 1b6a061d..ef2626a6 100644 --- a/src/Common/Utils/Validators/PathValidator.java +++ b/src/Common/Utils/Validators/PathValidator.java @@ -1,4 +1,5 @@ package Common.Utils.Validators; +import Common.Constants.Constants; import Common.Utils.TextLog; import Common.Utils.Utils; import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities; @@ -53,7 +54,7 @@ public class PathValidator extends Validator { Log.Writeln(string_name + ": имя файла или каталога в пути имеет неверный формат"); break; case Forbidden: - Log.Writeln(string_name + ": Составляющие путь имена содержат запрещённые символы \n" + Utils.all_forbidden_characters_string); + Log.Writeln(string_name + ": Составляющие путь имена содержат запрещённые символы \n" + Constants.all_forbidden_characters_string); break; case Name: if (spaces_count > 0) diff --git a/src/GlobalData/Credentials/Credentials.java b/src/GlobalData/Credentials/Credentials.java index 795ccc8e..20776801 100644 --- a/src/GlobalData/Credentials/Credentials.java +++ b/src/GlobalData/Credentials/Credentials.java @@ -1,18 +1,18 @@ package GlobalData.Credentials; +import Common.Constants.Constants; import Common.Database.iDBObject; -import Common.Utils.Utils; import com.sun.org.glassfish.gmbal.Description; public class Credentials extends iDBObject { @Description("DEFAULT -1") - public int machine_id = Utils.Nan; + public int machine_id = Constants.Nan; @Description("DEFAULT -1") - public int user_id = Utils.Nan; + public int user_id = Constants.Nan; @Description("DEFAULT -1") - public int compiler_id = Utils.Nan; + public int compiler_id = Constants.Nan; @Description("DEFAULT -1") - public int makefile_id = Utils.Nan; + public int makefile_id = Constants.Nan; @Description("DEFAULT -1") - public int runconfiguration_id = Utils.Nan; + public int runconfiguration_id = Constants.Nan; @Description("DEFAULT -1") - public int remotesapfor_id = Utils.Nan; + public int remotesapfor_id = Constants.Nan; } diff --git a/src/GlobalData/EnvironmentValue/EnvironmentValue.java b/src/GlobalData/EnvironmentValue/EnvironmentValue.java index 80208dda..b0448db4 100644 --- a/src/GlobalData/EnvironmentValue/EnvironmentValue.java +++ b/src/GlobalData/EnvironmentValue/EnvironmentValue.java @@ -1,12 +1,13 @@ package GlobalData.EnvironmentValue; +import Common.Constants.Constants; import Common.Current; import Common.Database.iDBObject; import Common.Utils.Utils; public class EnvironmentValue extends iDBObject { public String name = ""; public String value = ""; - public int machine_id = Utils.Nan; //для удаления машин - public int run_configuration_id = Utils.Nan; + public int machine_id = Constants.Nan; //для удаления машин + public int run_configuration_id = Constants.Nan; @Override public boolean isVisible() { return Current.HasRunConfiguration() && (run_configuration_id == Current.getRunConfiguration().id); diff --git a/src/GlobalData/Module/Module.java b/src/GlobalData/Module/Module.java index ccaadd6e..b751642b 100644 --- a/src/GlobalData/Module/Module.java +++ b/src/GlobalData/Module/Module.java @@ -1,11 +1,11 @@ package GlobalData.Module; +import Common.Constants.Constants; import Common.Current; import Common.Global; -import Common.Utils.Utils; import GlobalData.Makefile.Makefile; import ProjectData.LanguageName; public class Module extends ModuleAnchestor { - public int makefile_id = Utils.Nan; + public int makefile_id = Constants.Nan; public LanguageName language = LanguageName.n; public int on = 1; //учитывать ли модуль при сборке. указание пользователя. если файлы отсутствуют - игнорится public Module() { diff --git a/src/GlobalData/Module/ModuleAnchestor.java b/src/GlobalData/Module/ModuleAnchestor.java index fc6e88f5..a9a0e4b9 100644 --- a/src/GlobalData/Module/ModuleAnchestor.java +++ b/src/GlobalData/Module/ModuleAnchestor.java @@ -1,12 +1,13 @@ package GlobalData.Module; +import Common.Constants.Constants; import Common.Database.iDBObject; import Common.Global; import Common.Utils.Utils; import GlobalData.Compiler.Compiler; public class ModuleAnchestor extends iDBObject { //-------------------------------------------------------------------------------------- - public int machine_id = Utils.Nan; - public int compiler_id = Utils.Nan; + public int machine_id = Constants.Nan; + public int compiler_id = Constants.Nan; public String command = ""; //дополнительная команда компилятору. между вызовом и флагами. public String flags = ""; //последовательность флагов //--------------------------------------------------------------------------------------- diff --git a/src/GlobalData/Module/UI/ModuleAnchestorForm.java b/src/GlobalData/Module/UI/ModuleAnchestorForm.java index 925a7918..da9eef4b 100644 --- a/src/GlobalData/Module/UI/ModuleAnchestorForm.java +++ b/src/GlobalData/Module/UI/ModuleAnchestorForm.java @@ -1,8 +1,8 @@ package GlobalData.Module.UI; +import Common.Constants.Constants; import Common.Current; import Common.UI.UI; import Common.UI.Windows.Dialog.DBObjectDialog; -import Common.Utils.Utils; import GlobalData.Compiler.Compiler; import GlobalData.Compiler.CompilerType; import GlobalData.Makefile.Makefile; @@ -100,7 +100,7 @@ public class ModuleAnchestorForm extends DBObjectDial public void ProcessResult() { Result.machine_id = Current.getMachine().id; 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.flags = flags; } diff --git a/src/GlobalData/RunConfiguration/RunConfiguration.java b/src/GlobalData/RunConfiguration/RunConfiguration.java index 8ea3fe01..322a0ac7 100644 --- a/src/GlobalData/RunConfiguration/RunConfiguration.java +++ b/src/GlobalData/RunConfiguration/RunConfiguration.java @@ -1,4 +1,5 @@ package GlobalData.RunConfiguration; +import Common.Constants.Constants; import Common.Current; import Common.Database.iDBObject; import Common.Global; @@ -22,7 +23,7 @@ public class RunConfiguration extends iDBObject { public int machine_id; //----------------------------------------> @Description("DEFAULT -1") - public int compiler_id = Utils.Nan; + public int compiler_id = Constants.Nan; public String LauncherCall = ""; //например DVM или mpirun public String LauncherOptions = ""; //например run //-------------------------------------- @@ -175,7 +176,7 @@ public class RunConfiguration extends iDBObject { } public String getLaunchShortDescription() { String res = ""; - if (compiler_id != Utils.Nan) { + if (compiler_id != Constants.Nan) { res += getCompiler().description; if (!LauncherOptions.isEmpty()) res += " " + LauncherOptions; diff --git a/src/GlobalData/RunConfiguration/RunConfigurationsDBTable.java b/src/GlobalData/RunConfiguration/RunConfigurationsDBTable.java index f37aa7d1..13e31462 100644 --- a/src/GlobalData/RunConfiguration/RunConfigurationsDBTable.java +++ b/src/GlobalData/RunConfiguration/RunConfigurationsDBTable.java @@ -1,11 +1,11 @@ package GlobalData.RunConfiguration; +import Common.Constants.Constants; import Common.Current; import Common.Database.*; import Common.Global; import Common.UI.DataSetControlForm; import Common.UI.UI; import Common.UI.Windows.Dialog.DBObjectDialog; -import Common.Utils.Utils; import GlobalData.Compiler.Compiler; import GlobalData.Compiler.CompilerType; import GlobalData.DVMParameter.DVMParameter; @@ -68,7 +68,7 @@ public class RunConfigurationsDBTable extends iDBTable { Result.LauncherOptions = (String) fields.cbLaunchOptions.getSelectedItem(); if (fields.cbLauncherCall.getSelectedItem() instanceof Compiler) { 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.minMatrix = fields.minMatrixBar.pack(Result.dim); diff --git a/src/GlobalData/SapforProfileSetting/SapforProfileSetting.java b/src/GlobalData/SapforProfileSetting/SapforProfileSetting.java index 526a2c3e..7359201e 100644 --- a/src/GlobalData/SapforProfileSetting/SapforProfileSetting.java +++ b/src/GlobalData/SapforProfileSetting/SapforProfileSetting.java @@ -1,7 +1,7 @@ package GlobalData.SapforProfileSetting; +import Common.Constants.Constants; import Common.Current; import Common.Database.iDBObject; -import Common.Utils.Utils; import GlobalData.Settings.SettingName; import com.sun.org.glassfish.gmbal.Description; public class SapforProfileSetting extends iDBObject { @@ -10,7 +10,7 @@ public class SapforProfileSetting extends iDBObject { @Description("DEFAULT ''") public String value = ""; @Description("DEFAULT -1") - public int sapforprofile_id = Utils.Nan; + public int sapforprofile_id = Constants.Nan; @Override public boolean isVisible() { return Current.HasSapforProfile() && Current.getSapforProfile().id == sapforprofile_id; diff --git a/src/GlobalData/Splitter/Splitter.java b/src/GlobalData/Splitter/Splitter.java index a967e78e..c6b47fce 100644 --- a/src/GlobalData/Splitter/Splitter.java +++ b/src/GlobalData/Splitter/Splitter.java @@ -1,6 +1,6 @@ package GlobalData.Splitter; +import Common.Constants.Constants; import Common.Database.DBObject; -import Common.Utils.Utils; import com.sun.org.glassfish.gmbal.Description; import javax.swing.*; @@ -8,7 +8,7 @@ public class Splitter extends DBObject { @Description("PRIMARY KEY, UNIQUE") public String name = ""; @Description("DEFAULT -1") - public int position = Utils.Nan; + public int position = Constants.Nan; public Splitter() { } public Splitter(JSplitPane splitPane) { diff --git a/src/GlobalData/Tasks/CompilationTask/CompilationTask.java b/src/GlobalData/Tasks/CompilationTask/CompilationTask.java index ae9ee31c..2e94ab26 100644 --- a/src/GlobalData/Tasks/CompilationTask/CompilationTask.java +++ b/src/GlobalData/Tasks/CompilationTask/CompilationTask.java @@ -1,4 +1,5 @@ package GlobalData.Tasks.CompilationTask; +import Common.Constants.Constants; import Common.Current; import Common.Global; import Common.Utils.Utils; @@ -15,7 +16,7 @@ import org.apache.commons.io.FileUtils; import java.io.File; import java.util.LinkedHashMap; public class CompilationTask extends Task { - public int makefile_id = Utils.Nan; + public int makefile_id = Constants.Nan; public String binary_name = ""; //исполняемый файл. //--------------------------------------------------- @Description("DEFAULT ''") diff --git a/src/GlobalData/Tasks/RunTask/RunTask.java b/src/GlobalData/Tasks/RunTask/RunTask.java index a15a923f..d5d4a293 100644 --- a/src/GlobalData/Tasks/RunTask/RunTask.java +++ b/src/GlobalData/Tasks/RunTask/RunTask.java @@ -1,4 +1,5 @@ package GlobalData.Tasks.RunTask; +import Common.Constants.Constants; import Common.Current; import Common.Global; import Common.Utils.StringTemplate; @@ -17,8 +18,8 @@ import java.io.File; import java.nio.file.Paths; import java.util.List; public class RunTask extends Task { - public int compilation_task_id = Utils.Nan; //нужна для бинарника - public int run_configuration_id = Utils.Nan; + public int compilation_task_id = Constants.Nan; //нужна для бинарника + public int run_configuration_id = Constants.Nan; @Description("DEFAULT ''") public String last_sts_name = ""; @Description("DEFAULT 0") @@ -152,7 +153,7 @@ public class RunTask extends Task { public boolean hasDVMPar() { RunConfiguration config = getRunConfiguration(); return - config.compiler_id != Utils.Nan && + config.compiler_id != Constants.Nan && config.getCompiler().type.equals(CompilerType.dvm) && !config.getParList().isEmpty() ; diff --git a/src/GlobalData/Tasks/Supervisor/Local/LocalTaskSupervisor.java b/src/GlobalData/Tasks/Supervisor/Local/LocalTaskSupervisor.java index 7b0a9772..b4a94e4e 100644 --- a/src/GlobalData/Tasks/Supervisor/Local/LocalTaskSupervisor.java +++ b/src/GlobalData/Tasks/Supervisor/Local/LocalTaskSupervisor.java @@ -1,4 +1,5 @@ package GlobalData.Tasks.Supervisor.Local; +import Common.Constants.Constants; import Common.Global; import Common.Utils.Utils; import GlobalData.Tasks.RunTask.RunTask; @@ -22,7 +23,7 @@ public abstract class LocalTaskSupervisor extends TaskSupervisor protected int exitCode; @Override protected void StartTask() throws Exception { - exitCode = Utils.Nan; + exitCode = Constants.Nan; taskProcess = Utils.startScript(task.getLocalWorkspace(), getProjectCopy(), "start_task_script", getScriptText(), getEnvs()); task.state = TaskState.Running; } diff --git a/src/GlobalData/Tasks/Task.java b/src/GlobalData/Tasks/Task.java index b2275474..f5f40faf 100644 --- a/src/GlobalData/Tasks/Task.java +++ b/src/GlobalData/Tasks/Task.java @@ -1,4 +1,5 @@ package GlobalData.Tasks; +import Common.Constants.Constants; import Common.Database.iDBObject; import Common.Global; import Common.Utils.Utils; @@ -15,8 +16,8 @@ public abstract class Task extends iDBObject { // public TaskState state = TaskState.Inactive; //---------------------------------- - public int machine_id = Utils.Nan; - public int user_id = Utils.Nan; + public int machine_id = Constants.Nan; + public int user_id = Constants.Nan; //----------------------------------- public String PID = ""; public String project_path;// путь к проекту. @@ -28,9 +29,9 @@ public abstract class Task extends iDBObject { public long EndDate = 0;//дата окончания выполнения //--------------------------------- @Description("IGNORE") - public int progressStep = Utils.Nan; + public int progressStep = Constants.Nan; @Description("IGNORE") - public int progressAll = Utils.Nan; + public int progressAll = Constants.Nan; public boolean belongsToProject(db_project_info project) { return this.project_path.equalsIgnoreCase(project.Home.getAbsolutePath()); } @@ -107,11 +108,11 @@ public abstract class Task extends iDBObject { progressAll = progressAll_in; } public void dropProgress() { - progressStep = Utils.Nan; - progressAll = Utils.Nan; + progressStep = Constants.Nan; + progressAll = Constants.Nan; } 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 { diff --git a/src/GlobalData/User/User.java b/src/GlobalData/User/User.java index bf4dcb41..4075de05 100644 --- a/src/GlobalData/User/User.java +++ b/src/GlobalData/User/User.java @@ -1,7 +1,7 @@ package GlobalData.User; +import Common.Constants.Constants; import Common.Current; import Common.Database.iDBObject; -import Common.Utils.Utils; import GlobalData.Machine.Machine; import TestingSystem.UserConnection; import Visual_DVM_2021.Passes.SSH.ConnectionPass; @@ -12,7 +12,7 @@ import java.nio.file.Paths; public class User extends iDBObject { public String login; public String password = ""; - public int machine_id = Utils.Nan; + public int machine_id = Constants.Nan; public UserAuthentication authentication = UserAuthentication.password; public String workspace = ""; //рабочая папка визуализатора пользователя на машине. полный путь. public UserState state = UserState.initial; diff --git a/src/ProjectData/Project/db_project_info.java b/src/ProjectData/Project/db_project_info.java index e8a57c03..53f3f99c 100644 --- a/src/ProjectData/Project/db_project_info.java +++ b/src/ProjectData/Project/db_project_info.java @@ -1,4 +1,5 @@ package ProjectData.Project; +import Common.Constants.Constants; import Common.Current; import Common.Database.DBObject; import Common.Global; @@ -82,7 +83,7 @@ public class db_project_info extends DBObject { public String Log = "";//текст выдаваемый сапфором //----------------------------------------------- @Description("DEFAULT -1") - public long creationDate = Utils.Nan; //--------------------------------------------------NEW. + public long creationDate = Constants.Nan; //--------------------------------------------------NEW. @Description("DEFAULT ''") public String compilation_output = ""; @Description("DEFAULT ''") @@ -105,19 +106,19 @@ public class db_project_info extends DBObject { public int maxdim = 0; // @Description("DEFAULT -1") - public int numLines = Utils.Nan; + public int numLines = Constants.Nan; @Description("DEFAULT -1") - public int numSPF = Utils.Nan; + public int numSPF = Constants.Nan; @Description("DEFAULT -1") - public int numDVM = Utils.Nan; + public int numDVM = Constants.Nan; @Description("DEFAULT -1") - public int numArrays = Utils.Nan; + public int numArrays = Constants.Nan; @Description("DEFAULT -1") - public int numLoops = Utils.Nan; + public int numLoops = Constants.Nan; @Description("DEFAULT -1") - public int numFunctions = Utils.Nan; + public int numFunctions = Constants.Nan; @Description("DEFAULT -1") - public int numAddicted = Utils.Nan; + public int numAddicted = Constants.Nan; //------------------------------------- //параметры графа функций. храним для каждого проекта. @Description("DEFAULT 500") @@ -435,13 +436,13 @@ public class db_project_info extends DBObject { allIncludes.clear(); files_order.clear(); functionsGraph.Clear(); - numLines = Utils.Nan; - numSPF = Utils.Nan; - numDVM = Utils.Nan; - numArrays = Utils.Nan; - numFunctions = Utils.Nan; - numAddicted = Utils.Nan; - numLoops = Utils.Nan; + numLines = Constants.Nan; + numSPF = Constants.Nan; + numDVM = Constants.Nan; + numArrays = Constants.Nan; + numFunctions = Constants.Nan; + numAddicted = Constants.Nan; + numLoops = Constants.Nan; Log = ""; Scenario = ""; 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); } 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() { - 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() { try { diff --git a/src/Repository/Component/Component.java b/src/Repository/Component/Component.java index 3296e02c..dcc0dbd1 100644 --- a/src/Repository/Component/Component.java +++ b/src/Repository/Component/Component.java @@ -1,4 +1,5 @@ package Repository.Component; +import Common.Constants.Constants; import Common.Database.DBObject; import Common.Global; import Common.Utils.Files.VFileChooser; @@ -13,9 +14,9 @@ import java.nio.file.Paths; import java.nio.file.StandardCopyOption; public abstract class Component extends DBObject implements Loggable { public String date_text = Global.dateNaN; - public long version = Utils.Nan; - public long actual_version = Utils.Nan; - public long minimal_version = Utils.Nan; + public long version = Constants.Nan; + public long actual_version = Constants.Nan; + public long minimal_version = Constants.Nan; //-- public String code = ""; public String actual_code = ""; @@ -33,7 +34,7 @@ public abstract class Component extends DBObject implements Loggable { return String.valueOf(version); } public void CheckIfNeedsUpdateOrPublish() { - if (actual_version != Utils.Nan) { + if (actual_version != Constants.Nan) { if (version < minimal_version) setState(ComponentState.Old_version); else { ComponentState new_state = @@ -47,7 +48,7 @@ public abstract class Component extends DBObject implements Loggable { setState(ComponentState.Undefined); if (getFile().exists()) { GetVersionInfo(); - if (version == Utils.Nan) + if (version == Constants.Nan) setState(ComponentState.Unknown_version); } else setState(ComponentState.Not_found); } @@ -85,7 +86,7 @@ public abstract class Component extends DBObject implements Loggable { return getComponentType(); } public boolean isValidVersion(TextLog Log, String desc) { - if (version == Utils.Nan) { + if (version == Constants.Nan) { Log.Writeln_("Не определена версия " + desc + " компонента " + Utils.Brackets(getComponentType().getDescription())); return false; } diff --git a/src/Repository/Component/Sapfor/Sapfor.java b/src/Repository/Component/Sapfor/Sapfor.java index 78e7778d..25247aba 100644 --- a/src/Repository/Component/Sapfor/Sapfor.java +++ b/src/Repository/Component/Sapfor/Sapfor.java @@ -1,4 +1,5 @@ package Repository.Component.Sapfor; +import Common.Constants.Constants; import Common.Current; import Common.Global; import Common.UI.UI; @@ -365,7 +366,7 @@ public abstract class Sapfor extends OSDComponent { //временный (?) проход, по тихому получить размерность теста, предварительно выполнив тихий парс. //тут все одноразовое. считаем что таблицы бд уже заполнены как надо. public int getTextMaxDim(File testFile, db_project_info target) { - int res = Utils.Nan; + int res = Constants.Nan; LinkedHashMap files = null; if (testFile != null) { DBProjectFile dbProjectFile = new DBProjectFile(testFile, target); diff --git a/src/SapforTestingSystem/SapforTask/SapforTask.java b/src/SapforTestingSystem/SapforTask/SapforTask.java index 9189e1dd..7e7a52ff 100644 --- a/src/SapforTestingSystem/SapforTask/SapforTask.java +++ b/src/SapforTestingSystem/SapforTask/SapforTask.java @@ -1,6 +1,6 @@ package SapforTestingSystem.SapforTask; +import Common.Constants.Constants; import Common.Database.DBObject; -import Common.Utils.Utils; import GlobalData.Tasks.TaskState; import SapforTestingSystem.Json.SapforVersion_json; import com.google.gson.annotations.Expose; @@ -11,10 +11,10 @@ public class SapforTask extends DBObject { //------------------------------------>> @Description("PRIMARY KEY, UNIQUE") @Expose - public long id = Utils.Nan; + public long id = Constants.Nan; @Description("DEFAULT '-1'") @Expose - public int sapfortaskspackage_2023_id = Utils.Nan; + public int sapfortaskspackage_2023_id = Constants.Nan; //------------------------------------->> @Description("DEFAULT ''") @Expose diff --git a/src/SapforTestingSystem/SapforTasksPackage/SapforTasksPackage.java b/src/SapforTestingSystem/SapforTasksPackage/SapforTasksPackage.java index 7a81d261..9ab9005f 100644 --- a/src/SapforTestingSystem/SapforTasksPackage/SapforTasksPackage.java +++ b/src/SapforTestingSystem/SapforTasksPackage/SapforTasksPackage.java @@ -1,8 +1,8 @@ package SapforTestingSystem.SapforTasksPackage; +import Common.Constants.Constants; import Common.Current; import Common.Database.DBObject; import Common.Database.iDBObject; -import Common.Utils.Utils; import SapforTestingSystem.SapforConfiguration.SapforConfiguration; import TestingSystem.Test.Test; import Visual_DVM_2021.Passes.PassCode_2021; @@ -10,7 +10,7 @@ import com.sun.org.glassfish.gmbal.Description; import java.util.Vector; public class SapforTasksPackage extends iDBObject { - public int sapforscenario_id = Utils.Nan; + public int sapforscenario_id = Constants.Nan; @Description("DEFAULT ''") public String sapforconfiguration_id = ""; //-- diff --git a/src/SapforTestingSystem/ThreadTask/ThreadTask.java b/src/SapforTestingSystem/ThreadTask/ThreadTask.java index 83392b9c..85ebc43a 100644 --- a/src/SapforTestingSystem/ThreadTask/ThreadTask.java +++ b/src/SapforTestingSystem/ThreadTask/ThreadTask.java @@ -1,7 +1,7 @@ package SapforTestingSystem.ThreadTask; -import Common.Utils.Utils; +import Common.Constants.Constants; public class ThreadTask { - public int id = Utils.Nan; + public int id = Constants.Nan; public Thread thread; public ThreadTask(int id_in, Runnable runnable){ id = id_in; diff --git a/src/TestingSystem/Tasks/TestRunTask.java b/src/TestingSystem/Tasks/TestRunTask.java index baa162d6..9a5839ef 100644 --- a/src/TestingSystem/Tasks/TestRunTask.java +++ b/src/TestingSystem/Tasks/TestRunTask.java @@ -1,6 +1,6 @@ package TestingSystem.Tasks; +import Common.Constants.Constants; import Common.Database.DBObject; -import Common.Utils.Utils; import GlobalData.Tasks.TaskState; import ProjectData.LanguageName; import TestingSystem.Configuration.Configuration; @@ -16,7 +16,7 @@ public class TestRunTask extends TestTask { return TestRunTaskInterface.isVisible(this); } //-- - public long testcompilationtask_id = Utils.Nan; + public long testcompilationtask_id = Constants.Nan; public String matrix = ""; @Description("DEFAULT ''") public String args = ""; diff --git a/src/TestingSystem/Tasks/TestTask.java b/src/TestingSystem/Tasks/TestTask.java index 990f15c0..b3a735d2 100644 --- a/src/TestingSystem/Tasks/TestTask.java +++ b/src/TestingSystem/Tasks/TestTask.java @@ -1,6 +1,6 @@ package TestingSystem.Tasks; +import Common.Constants.Constants; import Common.Database.DBObject; -import Common.Utils.Utils; import GlobalData.Tasks.TaskState; import TestingSystem.Configuration.Configuration; import TestingSystem.Group.Group; @@ -13,7 +13,7 @@ import java.util.Vector; //тут все поля должны быть текстовыми. никаких ссылок по ид. мало ли, группу удалят public class TestTask extends DBObject { @Description("PRIMARY KEY, UNIQUE") - public long id = Utils.Nan; + public long id = Constants.Nan; @Description("DEFAULT ''") public String taskspackage_id = ""; @Description("DEFAULT ''") diff --git a/src/Visual_DVM_2021/Passes/All/AddFile.java b/src/Visual_DVM_2021/Passes/All/AddFile.java index 769c907d..9770669c 100644 --- a/src/Visual_DVM_2021/Passes/All/AddFile.java +++ b/src/Visual_DVM_2021/Passes/All/AddFile.java @@ -1,4 +1,5 @@ package Visual_DVM_2021.Passes.All; +import Common.Constants.Constants; import Common.Current; import Common.UI.UI; import Common.UI.Windows.Dialog.Text.FileNameForm; @@ -30,7 +31,7 @@ public class AddFile extends ChangeFilePass { if (Utils.ContainsForbiddenName(fileName)) { Log.Writeln_("Имя файла " + Utils.Brackets(fileName) + " содержит запрещенные символы." + - "\n" + Utils.all_forbidden_characters_string); + "\n" + Constants.all_forbidden_characters_string); return false; } } else { diff --git a/src/Visual_DVM_2021/Passes/All/OpenSapforTest.java b/src/Visual_DVM_2021/Passes/All/OpenSapforTest.java index ac9d777d..7d2fd46a 100644 --- a/src/Visual_DVM_2021/Passes/All/OpenSapforTest.java +++ b/src/Visual_DVM_2021/Passes/All/OpenSapforTest.java @@ -1,4 +1,5 @@ package Visual_DVM_2021.Passes.All; +import Common.Constants.Constants; import Common.Current; import Common.Utils.Utils; import ProjectData.Files.DBProjectFile; @@ -43,7 +44,7 @@ public class OpenSapforTest extends Pass_2021 { public MessageError unpackMessage(String line_in) throws Exception { MessageError res = new MessageError(); res.file = ""; - res.line = Utils.Nan; + res.line = Constants.Nan; res.value = ""; String line = line_in.substring(9); System.out.println(line); diff --git a/src/Visual_DVM_2021/Passes/All/PerformSapforTasksPackage.java b/src/Visual_DVM_2021/Passes/All/PerformSapforTasksPackage.java index c017d57c..4ac87c16 100644 --- a/src/Visual_DVM_2021/Passes/All/PerformSapforTasksPackage.java +++ b/src/Visual_DVM_2021/Passes/All/PerformSapforTasksPackage.java @@ -1,4 +1,5 @@ package Visual_DVM_2021.Passes.All; +import Common.Constants.Constants; import Common.Utils.Utils; import ProjectData.Project.db_project_info; import SapforTestingSystem.Json.SapforVersion_json; @@ -22,7 +23,7 @@ public class PerformSapforTasksPackage extends Pass_2021 { File task; //--- Process process = null; - int exit_code = Utils.Nan; + int exit_code = Constants.Nan; //---- File outputFile = null; File errorsFile = null; @@ -75,7 +76,7 @@ public class PerformSapforTasksPackage extends Pass_2021 { } protected boolean performSapforScript(String name, File workspace, String flags, String command, String outName, String errName) throws Exception { process = null; - exit_code = Utils.Nan; + exit_code = Constants.Nan; //--- File data_workspace = new File(workspace, db_project_info.data); Utils.CheckDirectory(data_workspace); diff --git a/src/Visual_DVM_2021/Passes/All/PerformScenario.java b/src/Visual_DVM_2021/Passes/All/PerformScenario.java index 5abd5cc1..6e3f5a40 100644 --- a/src/Visual_DVM_2021/Passes/All/PerformScenario.java +++ b/src/Visual_DVM_2021/Passes/All/PerformScenario.java @@ -1,4 +1,5 @@ package Visual_DVM_2021.Passes.All; +import Common.Constants.Constants; import Common.Global; import Common.Utils.Utils; import ProjectData.Project.db_project_info; @@ -25,7 +26,7 @@ public class PerformScenario extends Pass_2021 { File task; //--- Process process = null; - int exit_code = Utils.Nan; + int exit_code = Constants.Nan; //---- File outputFile = null; File errorsFile = null; @@ -95,7 +96,7 @@ public class PerformScenario extends Pass_2021 { } protected boolean performSapforScript(String name, File workspace, String flags, String command, String outName, String errName) throws Exception { process = null; - exit_code = Utils.Nan; + exit_code = Constants.Nan; //--- File data_workspace = new File(workspace, db_project_info.data); Utils.CheckDirectory(data_workspace); diff --git a/src/Visual_DVM_2021/Passes/All/PickCompilerEnvironments.java b/src/Visual_DVM_2021/Passes/All/PickCompilerEnvironments.java index 48535c24..47acc1d0 100644 --- a/src/Visual_DVM_2021/Passes/All/PickCompilerEnvironments.java +++ b/src/Visual_DVM_2021/Passes/All/PickCompilerEnvironments.java @@ -1,8 +1,8 @@ package Visual_DVM_2021.Passes.All; +import Common.Constants.Constants; import Common.Current; import Common.Global; import Common.UI.Windows.Dialog.Dialog; -import Common.Utils.Utils; import GlobalData.Compiler.Compiler; import GlobalData.Compiler.CompilerType; import GlobalData.CompilerEnvironment.CompilerEnvironment; @@ -29,7 +29,7 @@ public class PickCompilerEnvironments extends Pass_2021 { protected boolean canStart(Object... args) throws Exception { if (Current.Check(Log, Current.RunConfiguration)) { RunConfiguration configuration = Current.getRunConfiguration(); - if (configuration.compiler_id == Utils.Nan) { + if (configuration.compiler_id == Constants.Nan) { Log.Writeln_("Отсутвует DVM компилятор, связанный с текущей конфигурацией запуска.\n" + "Если конфигурация содержит вызов DVM компилятора, но была создана на версии 801 и ниже,\n" + "войдите в окно её редактирования,нажмите ОК, а затем повторите попытку."); diff --git a/src/Visual_DVM_2021/Passes/All/Precompilation.java b/src/Visual_DVM_2021/Passes/All/Precompilation.java index 035d231a..5fa37cfa 100644 --- a/src/Visual_DVM_2021/Passes/All/Precompilation.java +++ b/src/Visual_DVM_2021/Passes/All/Precompilation.java @@ -1,4 +1,5 @@ package Visual_DVM_2021.Passes.All; +import Common.Constants.Constants; import Common.Current; import Common.Global; import Common.UI.UI; @@ -89,7 +90,7 @@ public class Precompilation extends Pass_2021 { prepareForParse(); //----> //- performanceTime = 0; - exitCode = Utils.Nan; + exitCode = Constants.Nan; //------------------ workspace = Paths.get(Global.TempDirectory.getAbsolutePath(), Utils.getDateName("precompilation")).toFile(); FileUtils.forceMkdir(workspace); @@ -138,8 +139,8 @@ public class Precompilation extends Pass_2021 { protected static void unpackPrecompilationMessages(db_project_info target, String text) throws Exception { boolean messageStarted = false; String messageFile = ""; - int messageLine = Utils.Nan; - int messageType = Utils.Nan; + int messageLine = Constants.Nan; + int messageType = Constants.Nan; Vector messageText = new Vector<>(); String[] nw = text.split("\n"); for (String S : nw) { @@ -155,7 +156,7 @@ public class Precompilation extends Pass_2021 { messageText.add(S.substring(6)); 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); messageStarted = false; } else { @@ -170,7 +171,7 @@ public class Precompilation extends Pass_2021 { if (data.length > 1) { messageFile = name; messageLine = Integer.parseInt(data[1]); - messageType = Utils.Nan; + messageType = Constants.Nan; messageText = new Vector<>(); messageStarted = true; } diff --git a/src/Visual_DVM_2021/Passes/ProcessPass.java b/src/Visual_DVM_2021/Passes/ProcessPass.java index 59bc0d65..72e1e307 100644 --- a/src/Visual_DVM_2021/Passes/ProcessPass.java +++ b/src/Visual_DVM_2021/Passes/ProcessPass.java @@ -1,4 +1,5 @@ package Visual_DVM_2021.Passes; +import Common.Constants.Constants; import Common.Global; import Common.Utils.Utils; @@ -10,13 +11,13 @@ import java.util.LinkedHashMap; import java.util.Vector; public abstract class ProcessPass extends Pass_2021 { public Process process = null; - public int exit_code = Utils.Nan; + public int exit_code = Constants.Nan; public LinkedHashMap envs = new LinkedHashMap<>(); public Vector output = new Vector<>(); protected String process_path = ""; public void CreateProcess(String exec_path_in, File workspace, String ... command) throws Exception { output.clear(); - exit_code = Utils.Nan; + exit_code = Constants.Nan; process_path = exec_path_in; ProcessBuilder procBuilder = new ProcessBuilder(process_path); //- diff --git a/src/Visual_DVM_2021/UI/Main/ComparisonForm.java b/src/Visual_DVM_2021/UI/Main/ComparisonForm.java index b1dee512..8055150e 100644 --- a/src/Visual_DVM_2021/UI/Main/ComparisonForm.java +++ b/src/Visual_DVM_2021/UI/Main/ComparisonForm.java @@ -1,4 +1,5 @@ package Visual_DVM_2021.UI.Main; +import Common.Constants.Constants; import Common.Current; import Common.Database.DBObject; import Common.Global; @@ -188,7 +189,7 @@ public abstract class ComparisonForm { //предполагаем что оба объекта есть и мы можем получить с них текст. protected void Compare() throws Exception { events_on = false; - current_diff_line = Utils.Nan; + current_diff_line = Constants.Nan; colors.clear(); //----------------------------------------------------------------------------------------------- Body.setText(""); @@ -252,7 +253,7 @@ public abstract class ComparisonForm { } public void Show() throws Exception { events_on = false; - current_diff_line = Utils.Nan; + current_diff_line = Constants.Nan; colors.clear(); //---------------------------------------------------------------------------------------------- Body.setText(""); @@ -339,7 +340,7 @@ public abstract class ComparisonForm { // slave.master = this; bPrevious.addActionListener(e -> { - if (current_diff_line != Utils.Nan) { + if (current_diff_line != Constants.Nan) { if (current_diff_line > 0) current_diff_line--; else @@ -348,7 +349,7 @@ public abstract class ComparisonForm { } }); bNext.addActionListener(e -> { - if (current_diff_line != Utils.Nan) { + if (current_diff_line != Constants.Nan) { if (current_diff_line < colors.size() - 1) current_diff_line++; else diff --git a/src/Visual_DVM_2021/UI/Main/FileForm.java b/src/Visual_DVM_2021/UI/Main/FileForm.java index 15b5f923..6ed965ef 100644 --- a/src/Visual_DVM_2021/UI/Main/FileForm.java +++ b/src/Visual_DVM_2021/UI/Main/FileForm.java @@ -1,10 +1,10 @@ package Visual_DVM_2021.UI.Main; +import Common.Constants.Constants; import Common.Global; import Common.UI.Editor.Viewer; import Common.UI.Menus_2023.FileMenuBar.FileMenuBar; import Common.UI.Trees.TreeForm; import Common.UI.UI; -import Common.Utils.Utils; import GlobalData.Settings.SettingName; import ProjectData.Files.DBProjectFile; 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 //todo _ временно - public static int current_file_line = Utils.Nan; + public static int current_file_line = Constants.Nan; private final Viewer compilationOutput; private final Viewer runOutput; private final Viewer gcovLog; diff --git a/src/Visual_DVM_2021/UI/Main/TestingForm.java b/src/Visual_DVM_2021/UI/Main/TestingForm.java index 89bbdc54..bc6f4011 100644 --- a/src/Visual_DVM_2021/UI/Main/TestingForm.java +++ b/src/Visual_DVM_2021/UI/Main/TestingForm.java @@ -1,10 +1,10 @@ package Visual_DVM_2021.UI.Main; +import Common.Constants.Constants; import Common.Current; import Common.Global; import Common.UI.Menus_2023.TasksPackagesMenuBar.TasksPackagesMenuBar; import Common.UI.TextField.StyledTextField; import Common.UI.UI; -import Common.Utils.Utils; import GlobalData.Compiler.CompilerType; import GlobalData.Credentials.Credentials; import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage; @@ -355,48 +355,48 @@ public class TestingForm implements FormWithSplitters, TestingWindow { @Override public void RestoreLastCredentials() { 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)) { Global.db.machines.ShowUI(credentials.machine_id); if (Global.db.users.containsKey(credentials.user_id)) { Global.db.users.ShowUI(credentials.user_id); } else { - credentials.user_id = Utils.Nan; + credentials.user_id = Constants.Nan; Global.db.UpdateCredentials(); } if (Global.db.compilers.containsKey(credentials.compiler_id)) { Global.db.compilers.ShowUI(credentials.compiler_id); } else { - credentials.compiler_id = Utils.Nan; + credentials.compiler_id = Constants.Nan; Global.db.UpdateCredentials(); } //- if (Global.db.makefiles.containsKey(credentials.makefile_id)) { Global.db.makefiles.ShowUI(credentials.makefile_id); } else { - credentials.makefile_id = Utils.Nan; + credentials.makefile_id = Constants.Nan; Global.db.UpdateCredentials(); } //- if (Global.db.runConfigurations.containsKey(credentials.runconfiguration_id)) { Global.db.runConfigurations.ShowUI(credentials.runconfiguration_id); } else { - credentials.runconfiguration_id = Utils.Nan; + credentials.runconfiguration_id = Constants.Nan; Global.db.UpdateCredentials(); } if (Global.db.remoteSapfors.containsKey(credentials.remotesapfor_id)) { Global.db.remoteSapfors.ShowUI(credentials.remotesapfor_id); } else { - credentials.remotesapfor_id = Utils.Nan; + credentials.remotesapfor_id = Constants.Nan; Global.db.UpdateCredentials(); } } else { - credentials.machine_id = Utils.Nan; - credentials.user_id = Utils.Nan; - credentials.compiler_id = Utils.Nan; - credentials.remotesapfor_id = Utils.Nan; - credentials.makefile_id = Utils.Nan; - credentials.runconfiguration_id = Utils.Nan; + credentials.machine_id = Constants.Nan; + credentials.user_id = Constants.Nan; + credentials.compiler_id = Constants.Nan; + credentials.remotesapfor_id = Constants.Nan; + credentials.makefile_id = Constants.Nan; + credentials.runconfiguration_id = Constants.Nan; Global.db.UpdateCredentials(); } }