no message

This commit is contained in:
2024-10-07 14:22:52 +03:00
parent 6b1576461d
commit 61fc37b574
173 changed files with 960 additions and 1526 deletions

View File

@@ -0,0 +1,7 @@
package Common;
public class CommonConstants {
public static final int Nan = -1;
public static char[] regular_metasymbols = new char[]{
'<', '>', '(', ')', '[', ']', '{', '}', '^', '-', '=', '$', '!', '|', '?', '*', '+', '.'
};
}

View File

@@ -1,8 +1,8 @@
package Common.Database;
import Common_old.Constants;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Database.Tables.DBTable;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import Common.Database.Objects.DBObject;
import Common.Database.Tables.DataSet;
import Common.Database.Objects.iDBObject;
@@ -85,7 +85,7 @@ public abstract class Database {
public DBObject InsertS(DBObject object) throws Exception {
DBTable table = tables.get(object.getClass());
if (!(object instanceof iDBObject) && table.Data.containsKey(object.getPK()))
throw new RepositoryRefuseException("Таблица " + Utils.Brackets(table.Name) + " уже содержит объект с ключом " + Utils.Brackets(object.getPK().toString()));
throw new RepositoryRefuseException("Таблица " + CommonUtils.Brackets(table.Name) + " уже содержит объект с ключом " + CommonUtils.Brackets(object.getPK().toString()));
insert(table, object);
table.Data.put(object.getPK(), object);
return object;
@@ -112,7 +112,7 @@ public abstract class Database {
table.Data.remove(o.getPK());
return o;
} else
throw new RepositoryRefuseException("Таблица " + Utils.Brackets(table.Name) + " не содержит объект с ключом " + Utils.Brackets(to_delete.getPK().toString()));
throw new RepositoryRefuseException("Таблица " + CommonUtils.Brackets(table.Name) + " не содержит объект с ключом " + CommonUtils.Brackets(to_delete.getPK().toString()));
}
public DBObject DeleteByPK(Class object_class, Object key) throws Exception {
DBTable table = tables.get(object_class);
@@ -122,7 +122,7 @@ public abstract class Database {
table.Data.remove(key);
return o;
} else
throw new RepositoryRefuseException("Таблица " + Utils.Brackets(table.Name) + " не содержит объект с ключом " + Utils.Brackets(key.toString()));
throw new RepositoryRefuseException("Таблица " + CommonUtils.Brackets(table.Name) + " не содержит объект с ключом " + CommonUtils.Brackets(key.toString()));
}
// не работает с автоинкрементом.
public DBObject getObjectCopyByPK(Class table_class, Object pk) throws Exception {
@@ -233,7 +233,7 @@ public abstract class Database {
(O) (tables.get(class_in).Data.get(pk)) : null;
}
public <O extends iDBObject> O getById(Class<O> class_in, int pk) {
return getByPK(class_in, pk, Constants.Nan);
return getByPK(class_in, pk, CommonConstants.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) {
LinkedHashMap<G, F> res = new LinkedHashMap<>();

View File

@@ -1,7 +1,7 @@
package Common.Database.Objects;
import Common.Utils.CommonUtils;
import Common_old.UI.Selectable;
import Common.Utils.Index;
import Common_old.Utils.Utils;
import com.sun.org.glassfish.gmbal.Description;
import java.io.Serializable;
@@ -34,7 +34,7 @@ public abstract class DBObject implements Selectable, Serializable {
}
public abstract Object getPK();
public String getBDialogName() {
return Utils.Brackets(getDialogName());
return CommonUtils.Brackets(getDialogName());
}
public String getDialogName() {
return getPK().toString();

View File

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

View File

@@ -3,6 +3,7 @@ import Common.Database.Objects.DBObject;
import Common.Database.Tables.DBTable;
import Common.Database.Tables.DBTableColumn;
import Common.Database.Database;
import Common.Utils.CommonUtils;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
import Visual_DVM_2021.Passes.PassException;
@@ -116,7 +117,7 @@ public abstract class SQLiteDatabase extends Database {
Vector<String> columns_names = new Vector<>();
for (DBTableColumn column : table.columns.values())
columns_names.add(column.toString());
cmd += Utils.RBrackets(String.join(",", columns_names));
cmd += CommonUtils.RBrackets(String.join(",", columns_names));
statement.execute(cmd);
}
}
@@ -135,8 +136,8 @@ public abstract class SQLiteDatabase extends Database {
}
insertStatements.put(table.d, conn.prepareStatement(
"INSERT OR REPLACE INTO " + table.QName() + " " +
Utils.RBrackets(String.join(",", column_names)) + " " + "VALUES " +
Utils.RBrackets(String.join(",", column_values))));
CommonUtils.RBrackets(String.join(",", column_names)) + " " + "VALUES " +
CommonUtils.RBrackets(String.join(",", column_values))));
//------------------------------------------------------------------------------->>
Vector<String> new_values = new Vector();
for (DBTableColumn column : table.columns.values()) {
@@ -194,7 +195,7 @@ public abstract class SQLiteDatabase extends Database {
if (field_value != null) {
table.d.getField(column.Name).set(o, field_value);
} else
throw new PassException("Ошибка при загрузке поля " + Utils.Brackets(column.Name) + " класса " + Utils.Brackets(table.d.getSimpleName()));
throw new PassException("Ошибка при загрузке поля " + CommonUtils.Brackets(column.Name) + " класса " + CommonUtils.Brackets(table.d.getSimpleName()));
}
return new Pair<>((K) o.getPK(), o);
}

View File

@@ -1,26 +1,274 @@
package Common.Utils;
import Common.CommonConstants;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.charset.Charset;
public class CommonUtils {
//JSON
//--
// public static String jsonToPrettyFormat(String packed) {
// JsonParser parser = new JsonParser();
// JsonObject json = parser.parse(packed).getAsJsonObject();
// Gson gson = new GsonBuilder().setPrettyPrinting().create();
// return gson.toJson(json);
// }
//--
public static Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setPrettyPrinting().create();
/*
public static String jsonToPrettyFormat(String packed) {
JsonParser parser = new JsonParser();
JsonObject json = parser.parse(packed).getAsJsonObject();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
return gson.toJson(json);
}
*/
public static <T> T jsonFromFile(File file, Class<T> json_class) throws Exception {
return gson.fromJson(FileUtils.readFileToString(file, Charset.defaultCharset()), json_class);
}
public static void jsonToFile(Object json_object, File file) throws Exception {
FileUtils.writeStringToFile(file, gson.toJson(json_object));
}
//Синтаксис и регулярные выражения
public static String hideRegularMetasymbols(String word) {
String res = word.replace("\\", "\\\\");
for (char c : CommonConstants.regular_metasymbols)
res = res.replace(String.valueOf(c), "\\" + c);
return res;
}
public static String DQuotes(Object o) {
return "\"" + o.toString() + "\"";
}
public static String Quotes(Object o) {
return "'" + o.toString() + "'";
}
public static String Brackets(Object o) {
return "[" + o.toString() + "]";
}
public static String RBrackets(Object o) {
return "(" + o.toString() + ")";
}
public static String TBrackets(Object o) {
return "<" + o.toString() + ">";
}
public static boolean ContainsCyrillic(String string) {
return string.chars()
.mapToObj(Character.UnicodeBlock::of)
.anyMatch(b -> b.equals(Character.UnicodeBlock.CYRILLIC));
}
public static boolean isDigit(String s) {
try {
Integer.parseInt(s);
return true;
} catch (NumberFormatException e) {
return false;
}
}
public static boolean isEnglishLetter(char c) {
return (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')));
}
public static boolean isRussianLetter(char c) {
return ((c >= 'а') && (c <= 'я'))
|| ((c >= 'А') && (c <= 'Я'))
|| (c == 'Ё')
|| (c == 'ё');
}
public static boolean isSign(char c) {
switch (c) {
//арифметика.
case '+':
case '-':
case '*':
case '/':
case '<':
case '>':
case '&':
case '=':
case '%':
case '^':
//- обр слеш
case '\\':
//препинание
case ' ':
case '_':
case '.':
case ',':
case '!':
case '?':
case ';':
case ':':
//escape последовательности
case '\t':
case '\n':
case '\r':
//кавычки
case '\'':
case '"':
//- скобки
case '(':
case ')':
case '[':
case ']':
case '{':
case '}':
//прочее
case '~':
case '`':
case '|':
case '@':
case '$':
case '#':
case '№':
return true;
}
return false;
}
public static char Translit(char c) {
switch (c) {
case 'А':
case 'а':
case 'Я':
case 'я':
return 'A';
//
case 'Б':
case 'б':
return 'B';
//-
case 'В':
case 'в':
return 'V';
//
case 'Г':
case 'г':
return 'G';
//
case 'Д':
case 'д':
return 'D';
//
case 'Е':
case 'е':
case 'Ё':
case 'ё':
case 'Э':
case 'э':
return 'E';
//
case 'Ж':
case 'ж':
return 'J';
//
case 'З':
case 'з':
return 'Z';
//
case 'И':
case 'и':
case 'Й':
case 'й':
return 'I';
//
case 'К':
case 'к':
return 'K';
//
case 'Л':
case 'л':
return 'L';
//
case 'М':
case 'м':
return 'M';
//
case 'Н':
case 'н':
return 'N';
//
case 'О':
case 'о':
return 'O';
//
case 'П':
case 'п':
return 'P';
//
case 'Р':
case 'р':
return 'R';
//
case 'С':
case 'с':
return 'S';
case 'Т':
case 'т':
return 'T';
//
case 'У':
case 'у':
case 'Ю':
case 'ю':
return 'U';
case 'Х':
case 'х':
case 'Щ':
case 'щ':
case 'Ш':
case 'ш':
return 'H';
//
case 'Ф':
case 'ф':
return 'F';
//
case 'Ч':
case 'ч':
case 'Ц':
case 'ц':
return 'C';
//
case 'Ы':
case 'ы':
return 'Y';
//
}
return ' ';
}
public static String ending(boolean flag) {
return flag ? ")" : ",";
}
public static boolean isRBracketsBalanced(String fragment) {
int cc = 0;
for (char c : fragment.toCharArray()) {
if (c == '(')
cc++;
if (c == ')')
cc--;
if (cc < 0)
return false;
}
return (cc == 0);
}
//ФАЙЛЫ
public static String getExtension(File file) {
String fn = file.getName();
int di = fn.lastIndexOf(".");
return (di >= 0) ? fn.substring(di + 1).toLowerCase() : "";
}
public static String getExtensionFromName(String fn) {
int di = fn.lastIndexOf(".");
return (di >= 0) ? fn.substring(di + 1).toLowerCase() : "";
}
public static String getFileNameWithoutExtension(File file) {
return getNameWithoutExtension(file.getName());
}
public static String getNameWithoutExtension(String fn) {
return (fn.contains(".")) ? fn.substring(0, fn.lastIndexOf(".")).toLowerCase() : fn.toLowerCase();
}
public static String toU(String path) {
return path.replace('\\', '/');
}
public static String toW(String path) {
return path.replace('/', '\\');
}
public static double getFileSizeMegaBytes(File file) {
return ((double)file.length()) / (1024 * 1024);
}
//-
//ГЕНЕРАЦИЯ ИМЕН
}

View File

@@ -1,4 +1,5 @@
package Common.Visual;
import Common.Utils.CommonUtils;
import Common_old.UI.Menus_2023.StableMenuItem;
import Common_old.Utils.Utils;
import Common.Database.Objects.DBObject;
@@ -53,7 +54,7 @@ public abstract class DBObjectFilter<D extends DBObject> {
count = 0;
}
public void Refresh() {
menuItem.setText(description + " " + Utils.RBrackets(count));
menuItem.setText(description + " " + CommonUtils.RBrackets(count));
}
public boolean isActive() {
return active;

View File

@@ -14,14 +14,14 @@ public abstract class DataSetFilter<D extends DBObject> {
protected Vector<DBObjectFilter<D>> field_filters;
public DataSetFilter(String name, DataSet dataSet_in) {
dataSet = dataSet_in;
menu = new VisualiserMenu(name, "/icons/Filter.png", true);
menu = new VisualiserMenu(name, "/Common/icons/Filter.png", true);
field_filters = new Vector<>();
fill();
//-
for (DBObjectFilter<D> filter : field_filters)
menu.add(filter.menuItem);
menu.addSeparator();
menu.add(new StableMenuItem("Выбрать всё", "/icons/SelectAll.png") {
menu.add(new StableMenuItem("Выбрать всё", "/Common/icons/SelectAll.png") {
{
addActionListener(new ActionListener() {
@Override
@@ -32,7 +32,7 @@ public abstract class DataSetFilter<D extends DBObject> {
});
}
});
menu.add(new StableMenuItem("Отменить всё", "/icons/UnselectAll.png") {
menu.add(new StableMenuItem("Отменить всё", "/Common/icons/UnselectAll.png") {
{
addActionListener(new ActionListener() {
@Override

BIN
src/Common/icons/Filter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

View File

@@ -5,7 +5,6 @@ import Visual_DVM_2021.Passes.PassCode_2021;
import java.util.Vector;
import java.util.regex.Pattern;
public class Constants {
public static final int Nan = -1;
public static final int planner_version = 3;
//--
public static final String ComponentsDirectoryName = "Components";
@@ -52,15 +51,6 @@ public class Constants {
public static final String package_json = "package_json";
public static final String results_json = "results_json";
//--
public static final PassCode_2021[] startingSapforTestingCodes_old = new PassCode_2021[]{
PassCode_2021.SPF_InsertIncludesPass
};
public static final PassCode_2021[] terminalSapforTestingCodes_old = new PassCode_2021[]{
PassCode_2021.CreateParallelVariants,
PassCode_2021.SPF_SharedMemoryParallelization,
PassCode_2021.SPF_InsertDvmhRegions
};
//--
public static final Vector<PassCode_2021> startSapforCodes =
new Vector_<>(PassCode_2021.SPF_InsertIncludesPass);
@@ -486,9 +476,6 @@ public class Constants {
'`', '|', '=', '#', ':', '/', '\\',
'~', '^'
};
public static char[] regular_metasymbols = new char[]{
'<', '>', '(', ')', '[', ']', '{', '}', '^', '-', '=', '$', '!', '|', '?', '*', '+', '.'
};
//все запретные символы через пробел.
public static String all_forbidden_characters_string = "";
public static Vector<String> admins_mails = new Vector_<>(

View File

@@ -1,5 +1,5 @@
package Common_old.UI;
import Common_old.Constants;
import Common.CommonConstants;
import Common_old.Current;
import Common.Database.Objects.DBObject;
import Common.Database.Tables.DBTable;
@@ -207,7 +207,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
}
};
if (CurrentName() != Current.Undefined) {
current_row_i = Constants.Nan;
current_row_i = CommonConstants.Nan;
ListSelectionModel selModel = control.getSelectionModel();
selModel.addListSelectionListener(e -> {
int row = control.getSelectedRow();
@@ -224,7 +224,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
}
}
} else {
current_row_i = Constants.Nan;
current_row_i = CommonConstants.Nan;
getDataSource().dropCurrent();
if (events_on) {
try {

View File

@@ -1,4 +1,5 @@
package Common_old.UI.Menus;
import Common.Utils.CommonUtils;
import Common_old.Current;
import _VisualDVM.Global;
import Common_old.UI.Editor.CaretInfo;
@@ -218,9 +219,9 @@ public class MainEditorMenu extends TextEditorMenu {
if (!Utils.isFunctionName(selectedText)) {
String tip = "Имя процедуры может содержать только английские буквы, цифры и подчеркивания, и не может начинаться с цифры.";
//-
m_inline.setText("Невозможно подставить вызов процедуры " + Utils.Brackets(selectedText) +
m_inline.setText("Невозможно подставить вызов процедуры " + CommonUtils.Brackets(selectedText) +
" . Выделено некорректное имя.");
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + Utils.Brackets(selectedText) +
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + CommonUtils.Brackets(selectedText) +
" . Выделено некорректное имя.");
//-
m_inline.setToolTipText(tip);
@@ -228,40 +229,40 @@ public class MainEditorMenu extends TextEditorMenu {
return;
}
if (!Pass_2021.passes.get(PassCode_2021.SPF_GetGraphFunctions).isDone()) {
m_inline.setText("Невозможно подставить вызов процедуры " + Utils.Brackets(selectedText) +
m_inline.setText("Невозможно подставить вызов процедуры " + CommonUtils.Brackets(selectedText) +
" . Выполните проход \"Граф процедур \".");
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + Utils.Brackets(selectedText) +
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + CommonUtils.Brackets(selectedText) +
" . Выполните проход \"Граф процедур \"");
return;
}
if (Current.getSapfor().isIntrinsic(selectedText)) {
m_inline.setText("Невозможно подставить вызов процедуры " + Utils.Brackets(selectedText) +
m_inline.setText("Невозможно подставить вызов процедуры " + CommonUtils.Brackets(selectedText) +
" . Процедура является стандартной.");
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + Utils.Brackets(selectedText) +
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + CommonUtils.Brackets(selectedText) +
" . Процедура является стандартной.");
return;
}
call = Current.getFile().find_func_call(selectedText);
if (call == null) {
m_inline.setText("Невозможно подставить вызов процедуры " + Utils.Brackets(selectedText) +
m_inline.setText("Невозможно подставить вызов процедуры " + CommonUtils.Brackets(selectedText) +
" . Вызов не найден в текущей строке.");
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + Utils.Brackets(selectedText) +
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + CommonUtils.Brackets(selectedText) +
" . Объявление процедуры уже находится в текущей строке.");
return;
}
decl = Current.getProject().allFunctions.get(call.funcName);
if (decl.type.equals(FunctionType.NotFound)) {
m_inline.setText("Невозможно подставить вызов процедуры " + Utils.Brackets(selectedText) +
m_inline.setText("Невозможно подставить вызов процедуры " + CommonUtils.Brackets(selectedText) +
" . Объявление процедуры не найдено в проекте.");
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + Utils.Brackets(selectedText) +
m_gotoFunction.setText("Невозможно перейти к объявлению процедуры " + CommonUtils.Brackets(selectedText) +
" . Объявление процедуры не найдено в проекте.");
return;
}
//---
m_inline.setEnabled(true);
m_gotoFunction.setEnabled(true);
m_inline.setText("Подставить вызов процедуры " + Utils.Brackets(selectedText));
m_gotoFunction.setText("Перейти к объявлению процедуры " + Utils.Brackets(selectedText));
m_inline.setText("Подставить вызов процедуры " + CommonUtils.Brackets(selectedText));
m_gotoFunction.setText("Перейти к объявлению процедуры " + CommonUtils.Brackets(selectedText));
//--
}
private void checkHeader() {
@@ -280,11 +281,11 @@ public class MainEditorMenu extends TextEditorMenu {
return;
}
if (!Current.getFile().relativeHeaders.containsKey(header_)) {
m_gotoHeader.setText("Невозможно перейти к заголовочному файлу " + Utils.Brackets(header_) + " . Файл не найден среди включений текущего файла.");
m_gotoHeader.setText("Невозможно перейти к заголовочному файлу " + CommonUtils.Brackets(header_) + " . Файл не найден среди включений текущего файла.");
return;
}
header = Current.getFile().relativeHeaders.get(header_);
m_gotoHeader.setText("Переход к заголовочному файлу " + Utils.Brackets(header_));
m_gotoHeader.setText("Переход к заголовочному файлу " + CommonUtils.Brackets(header_));
m_gotoHeader.setEnabled(true);
}
}
@@ -302,7 +303,7 @@ public class MainEditorMenu extends TextEditorMenu {
return;
}
m_loop_union.setEnabled(true);
m_loop_union.setText("Объединить цикл в строке " + Utils.Brackets(loop.line) + " со следующим");
m_loop_union.setText("Объединить цикл в строке " + CommonUtils.Brackets(loop.line) + " со следующим");
}
@Override
public void CheckElementsVisibility() {

View File

@@ -1,10 +1,10 @@
package Common_old.UI.Menus;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common_old.UI.Menus_2023.StableMenuItem;
import Common_old.UI.Selectable;
import Common_old.UI.Trees.DataTree;
import Common_old.UI.Trees.SelectableTree;
import Common_old.Utils.Utils;
import javax.swing.*;
import java.awt.event.ActionEvent;
@@ -72,9 +72,9 @@ public abstract class SelectionTreeMenu extends GraphMenu<DataTree> {
if ((current != null) && (current.getClass().equals(getTargetClass()))) {
String name = ((Selectable) current).getSelectionText();
m_select_for_current.setText("Выбрать всё для " +
Utils.Brackets(name));
CommonUtils.Brackets(name));
m_unselect_for_current.setText("Отменить выбор всех для " +
Utils.Brackets(name));
CommonUtils.Brackets(name));
//-
m_select_for_current.setVisible(true);
m_unselect_for_current.setVisible(true);

View File

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

View File

@@ -1,13 +1,13 @@
package Common_old.UI.Tables;
import Common_old.Constants;
import Common.CommonConstants;
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 = Constants.Nan;
private int minWidth = Constants.Nan;
private int maxWidth = CommonConstants.Nan;
private int minWidth = CommonConstants.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 != Constants.Nan;
return maxWidth != CommonConstants.Nan;
}
//-
public int getMinWidth() {
@@ -82,7 +82,7 @@ public class ColumnInfo {
this.minWidth = minWidth_in;
}
public boolean hasMinWidth() {
return minWidth != Constants.Nan;
return minWidth != CommonConstants.Nan;
}
/*

View File

@@ -1,5 +1,5 @@
package Common_old.UI;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import javax.swing.*;
import java.util.Vector;
@@ -12,7 +12,7 @@ public class VisualiserStringList extends JList<String> {
public void fill(Vector<String> content) {
elements = new DefaultListModel<>();
for (String s : content)
elements.addElement(Utils.Brackets(s));
elements.addElement(CommonUtils.Brackets(s));
setModel(elements);
}
public String pack() {
@@ -25,7 +25,7 @@ public class VisualiserStringList extends JList<String> {
return res;
}
public void addElement(String element) {
String element_ = Utils.Brackets(element);
String element_ = CommonUtils.Brackets(element);
if (!elements.contains(element_))
elements.addElement(element_);
else UI.Info("элемент " + element_ + " уже существует.");

View File

@@ -1,9 +1,9 @@
package Common_old.UI.Windows;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common_old.UI.TextField.StyledTextField;
import Common_old.UI.Trees.StyledTree;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Pass_2021;
import javafx.util.Pair;
@@ -100,8 +100,8 @@ public class SearchReplaceForm extends Form {
}
}
public void applyParams() {
String toFind = Utils.hideRegularMetasymbols(tfFind.getText());
String toReplace = Utils.hideRegularMetasymbols(tfReplace.getText());
String toFind = CommonUtils.hideRegularMetasymbols(tfFind.getText());
String toReplace = CommonUtils.hideRegularMetasymbols(tfReplace.getText());
context.setSearchFor(toFind);
context.setMatchCase(registerOn.isSelected());
context.setWholeWord(wholeWordOn.isSelected());

View File

@@ -1,6 +1,6 @@
package Common_old.Utils.Files;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Utils.Utils;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
@@ -11,7 +11,7 @@ public class ProjectsChooser extends VFileChooser_ {
@Override
public boolean accept(File f) {
return
!Utils.ContainsCyrillic(f.getAbsolutePath()) &&
!CommonUtils.ContainsCyrillic(f.getAbsolutePath()) &&
!f.getName().equalsIgnoreCase(Constants.data)
;
}

View File

@@ -1,5 +1,5 @@
package Common_old.Utils.Files;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
@@ -9,7 +9,7 @@ public class VDirectoryChooser extends VFileChooser_ {
super(title, new FileFilter() {
@Override
public boolean accept(File f) {
return !Utils.ContainsCyrillic(f.getAbsolutePath());
return !CommonUtils.ContainsCyrillic(f.getAbsolutePath());
}
@Override
public String getDescription() {

View File

@@ -1,5 +1,5 @@
package Common_old.Utils.Files;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
@@ -20,7 +20,7 @@ public class VFileChooser extends VFileChooser_ {
fileChooser.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
return !Utils.ContainsCyrillic(f.getName())
return !CommonUtils.ContainsCyrillic(f.getName())
&& (f.isDirectory() || acceptExtensions(f));
}
@Override
@@ -36,7 +36,7 @@ public class VFileChooser extends VFileChooser_ {
}
public boolean acceptExtensions(File file) {
if (Extensions.isEmpty()) return true;
String file_ext = Utils.getExtension(file);
String file_ext = CommonUtils.getExtension(file);
for (String ext : Extensions)
if (ext.equalsIgnoreCase(file_ext)) return true;
return false;

View File

@@ -1,4 +1,6 @@
package Common_old.Utils;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Utils.Index;
import Common.Utils.StringTemplate;
import Common.Utils.TextLog;
@@ -38,13 +40,6 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Utils {
//--->>
public static String hideRegularMetasymbols(String word) {
String res = word.replace("\\", "\\\\");
for (char c : Constants.regular_metasymbols)
res = res.replace(String.valueOf(c), "\\" + c);
return res;
}
public static boolean isLinuxSystemCommand(String text) {
for (String command : Constants.linux_system_commands) {
if (text.equalsIgnoreCase(command)) return true;
@@ -72,48 +67,9 @@ public class Utils {
for (char f : Constants.forbidden_file_name_characters)
Constants.all_forbidden_characters_string += f + " ";
}
public static String DQuotes(Object o) {
return "\"" + o.toString() + "\"";
}
public static String Quotes(Object o) {
return "'" + o.toString() + "'";
}
public static String Brackets(Object o) {
return "[" + o.toString() + "]";
}
public static String Bold(Object o) {
return "<b>" + o.toString() + "</b>";
}
public static String RBrackets(Object o) {
return "(" + o.toString() + ")";
}
public static String MFVar(Object o) {
return "$(" + o.toString() + ")";
}
public static String TBrackets(Object o) {
return "<" + o.toString() + ">";
}
public static String getExtension(File file) {
String fn = file.getName();
int di = fn.lastIndexOf(".");
return (di >= 0) ? fn.substring(di + 1).toLowerCase() : "";
}
public static String getExtensionByName(String fn) {
;
int di = fn.lastIndexOf(".");
return (di >= 0) ? fn.substring(di + 1).toLowerCase() : "";
}
public static String getFileNameWithoutExtension(File file) {
return getNameWithoutExtension(file.getName());
}
public static String getNameWithoutExtension(String fn) {
return (fn.contains(".")) ? fn.substring(0, fn.lastIndexOf(".")).toLowerCase() : fn.toLowerCase();
}
public static boolean ContainsCyrillic(String string) {
return string.chars()
.mapToObj(Character.UnicodeBlock::of)
.anyMatch(b -> b.equals(Character.UnicodeBlock.CYRILLIC));
}
public static void CheckDirectory(File dir) {
if (!dir.exists()) {
try {
@@ -145,8 +101,6 @@ public class Utils {
public static Object requireNonNullElse(Object value, Object default_value) {
return (value != null) ? value : default_value;
}
//https://javadevblog.com/kak-schitat-fajl-v-string-primer-chteniya-fajla-na-java.html
//https://habr.com/ru/post/269667/
public static String ReadAllText(File file) {
try {
return new String(Files.readAllBytes(file.toPath()));
@@ -155,16 +109,6 @@ public class Utils {
}
return "";
}
public static String toU(String path) {
return path.replace('\\', '/');
}
public static String toW(String path) {
return path.replace('/', '\\');
}
public static double getFileSizeMegaBytes(File file) {
double res = file.length() / (1024 * 1024);
return res;
}
public static void CleanDirectory(File dir) {
if (dir.exists() && dir.isDirectory()) {
File[] files = dir.listFiles();
@@ -179,7 +123,7 @@ public class Utils {
}
}
}
public static long last_ticks = Constants.Nan;
public static long last_ticks = CommonConstants.Nan;
public static void sleep(long millis) {
try {
Thread.sleep(millis);
@@ -213,187 +157,6 @@ public class Utils {
StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING);
}
public static boolean isDigit(String s) {
try {
Integer.parseInt(s);
return true;
} catch (NumberFormatException e) {
return false;
}
}
public static boolean isEnglishLetter(char c) {
return (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')));
}
public static boolean isRussianLetter(char c) {
return ((c >= 'а') && (c <= 'я'))
|| ((c >= 'А') && (c <= 'Я'))
|| (c == 'Ё')
|| (c == 'ё');
}
public static boolean isSign(char c) {
switch (c) {
//арифметика.
case '+':
case '-':
case '*':
case '/':
case '<':
case '>':
case '&':
case '=':
case '%':
case '^':
//- обр слеш
case '\\':
//препинание
case ' ':
case '_':
case '.':
case ',':
case '!':
case '?':
case ';':
case ':':
//escape последовательности
case '\t':
case '\n':
case '\r':
//кавычки
case '\'':
case '"':
//- скобки
case '(':
case ')':
case '[':
case ']':
case '{':
case '}':
//прочее
case '~':
case '`':
case '|':
case '@':
case '$':
case '#':
case '№':
return true;
}
return false;
}
public static char Translit(char c) {
switch (c) {
case 'А':
case 'а':
case 'Я':
case 'я':
return 'A';
//
case 'Б':
case 'б':
return 'B';
//-
case 'В':
case 'в':
return 'V';
//
case 'Г':
case 'г':
return 'G';
//
case 'Д':
case 'д':
return 'D';
//
case 'Е':
case 'е':
case 'Ё':
case 'ё':
case 'Э':
case 'э':
return 'E';
//
case 'Ж':
case 'ж':
return 'J';
//
case 'З':
case 'з':
return 'Z';
//
case 'И':
case 'и':
case 'Й':
case 'й':
return 'I';
//
case 'К':
case 'к':
return 'K';
//
case 'Л':
case 'л':
return 'L';
//
case 'М':
case 'м':
return 'M';
//
case 'Н':
case 'н':
return 'N';
//
case 'О':
case 'о':
return 'O';
//
case 'П':
case 'п':
return 'P';
//
case 'Р':
case 'р':
return 'R';
//
case 'С':
case 'с':
return 'S';
case 'Т':
case 'т':
return 'T';
//
case 'У':
case 'у':
case 'Ю':
case 'ю':
return 'U';
case 'Х':
case 'х':
case 'Щ':
case 'щ':
case 'Ш':
case 'ш':
return 'H';
//
case 'Ф':
case 'ф':
return 'F';
//
case 'Ч':
case 'ч':
case 'Ц':
case 'ц':
return 'C';
//
case 'Ы':
case 'ы':
return 'Y';
//
}
return ' ';
}
public static String ending(boolean flag) {
return flag ? ")" : ",";
}
// http://java-online.ru/blog-archive.xhtml
public static void getFilesCountR(File dir, Index res) {
for (File f : dir.listFiles()) {
@@ -412,18 +175,6 @@ public class Utils {
DateFormat df = new SimpleDateFormat(pattern);
return df.format(date);
}
public static boolean isBracketsBalanced(String fragment) {
int cc = 0;
for (char c : fragment.toCharArray()) {
if (c == '(')
cc++;
if (c == ')')
cc--;
if (cc < 0)
return false;
}
return (cc == 0);
}
public static File CreateTempResourceFile(String res_name) throws Exception {
URL u = (Utils.class.getResource("/files/" + res_name));
InputStream i = u.openStream();
@@ -477,7 +228,7 @@ public class Utils {
Log.Writeln_("Имя файла не может быть пустым");
res = false;
}
if (ContainsCyrillic(name)) {
if (CommonUtils.ContainsCyrillic(name)) {
Log.Writeln_("Имя файла не может содержать кириллицу");
res = false;
}
@@ -491,7 +242,7 @@ public class Utils {
//идет по всем уровням файлов
public static boolean validateProjectFile(File file, TextLog Log) {
String name = file.getName();
if (ContainsCyrillic(name) || ContainsForbiddenName(name)) {
if (CommonUtils.ContainsCyrillic(name) || ContainsForbiddenName(name)) {
Log.Writeln_(file.getAbsolutePath());
return false;
}
@@ -567,11 +318,11 @@ public class Utils {
} else return;
if (file.exists()) {
attempts++;
System.out.println("файл " + Brackets(file.getAbsolutePath()) + " занят");
System.out.println("файл " + CommonUtils.Brackets(file.getAbsolutePath()) + " занят");
Thread.sleep(2000);
} else return;
}
throw new PassException("Не удалось удалить файл " + Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
throw new PassException("Не удалось удалить файл " + CommonUtils.Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
}
public static void GetVertices(float R, float r, float x0, float y0, int n, float phi) {
boolean inner = false;
@@ -625,11 +376,11 @@ public class Utils {
} else return;
if (file.exists()) {
attempts++;
Global.Log.Print("неудачная попытка удаления: файл " + Brackets(file.getAbsolutePath()) + " занят");
Global.Log.Print("неудачная попытка удаления: файл " + CommonUtils.Brackets(file.getAbsolutePath()) + " занят");
Thread.sleep(2000);
} else return;
}
throw new PassException("Не удалось удалить файл " + Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
throw new PassException("Не удалось удалить файл " + CommonUtils.Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
}
public static byte[] packFile(File src) throws Exception {
byte[] dst = Files.readAllBytes(src.toPath());
@@ -669,7 +420,7 @@ public class Utils {
if (files != null) {
for (File file : files) {
if (file.isFile()) {
String file_extension = getExtension(file);
String file_extension = CommonUtils.getExtension(file);
for (String ext : extensions) {
if (file_extension.equalsIgnoreCase(ext)) {
res.add(file);
@@ -710,7 +461,7 @@ public class Utils {
public static File createScript(File scriptDirectory, File targetDirectory, String name, String scriptText) throws Exception {
//->
File scriptFile = Paths.get(scriptDirectory.getAbsolutePath(), name + (Global.isWindows ? ".bat" : "")).toFile();
FileUtils.write(scriptFile, "cd " + Utils.DQuotes(targetDirectory.getAbsolutePath()) + "\n" + scriptText);
FileUtils.write(scriptFile, "cd " + CommonUtils.DQuotes(targetDirectory.getAbsolutePath()) + "\n" + scriptText);
if (!scriptFile.setExecutable(true)) throw new PassException("Не удалось создать исполняемый файл для скрипта");
return scriptFile;
}
@@ -847,25 +598,6 @@ public class Utils {
}
return res;
}
public static Vector<String> unpackStrings(String string, boolean brackets) {
Vector<String> res = new Vector<>();
if (string.isEmpty())
res.add(brackets ? "[]" : "");
else {
StringBuilder line = new StringBuilder();
for (char c : string.toCharArray()) {
if (c == '\n') {
res.add(brackets ? Utils.Brackets(line.toString()) : line.toString());
line = new StringBuilder();
} else
line.append(c);
}
}
return res;
}
public static Vector<String> unpackStrings(String string) {
return unpackStrings(string, false);
}
public static boolean isTimeout(long startDate, long maxtime_sec) {
Date now = new Date();
long delta = (now.getTime() - startDate) / 1000;
@@ -914,7 +646,7 @@ public class Utils {
}
protected static boolean isSource(File file) {
if (file.isFile()) {
String extension = getExtension(file).toLowerCase();
String extension = CommonUtils.getExtension(file).toLowerCase();
switch (extension) {
case "f":
case "fdv":
@@ -946,7 +678,7 @@ public class Utils {
}
}
if (sources.isEmpty()) {
if (question) return UI.Question("Папка " + Brackets(folder.getName()) + "\n" +
if (question) return UI.Question("Папка " + CommonUtils.Brackets(folder.getName()) + "\n" +
"не содержит ни одного файла, распознанного как поддерживаемый код\n" +
"Всё равно открыть её как проект");
else return false;
@@ -955,8 +687,8 @@ public class Utils {
public static void Kill(String PID, boolean force) {
if (!PID.isEmpty()) {
String killCommand =
force ? Global.isWindows ? "taskkill /PID " + Utils.DQuotes(PID) + " /F /T" : "kill -9 " + Utils.DQuotes(PID) :
Global.isWindows ? "taskkill /PID " + Utils.DQuotes(PID) : "kill -2 " + Utils.DQuotes(PID);
force ? Global.isWindows ? "taskkill /PID " + CommonUtils.DQuotes(PID) + " /F /T" : "kill -9 " + CommonUtils.DQuotes(PID) :
Global.isWindows ? "taskkill /PID " + CommonUtils.DQuotes(PID) : "kill -2 " + CommonUtils.DQuotes(PID);
System.out.println(killCommand);
try {
Process killer = Utils.startScript(Global.TempDirectory, Global.TempDirectory, "killer", killCommand);
@@ -971,12 +703,12 @@ public class Utils {
if (name.isEmpty())
return false;
char[] letters = name.toCharArray();
if (!(isEnglishLetter(letters[0]) || letters[0] == '_')) {
if (!(CommonUtils.isEnglishLetter(letters[0]) || letters[0] == '_')) {
return false;
}
//---
for (int i = 1; i < letters.length; ++i) {
if (!(isEnglishLetter(letters[i]) || letters[i] == '_' || Utils.isDigit(String.valueOf(letters[i])))) {
if (!(CommonUtils.isEnglishLetter(letters[i]) || letters[i] == '_' || CommonUtils.isDigit(String.valueOf(letters[i])))) {
return false;
}
}

View File

@@ -1,7 +1,7 @@
package Common_old.Utils.Validators;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import java.io.InputStreamReader;
import java.util.Vector;
@@ -173,7 +173,7 @@ public class ShellParser {
System.out.print(c == '\r' ? ("\\r") :
(c == '\n' ? "\\n\n" : c));
if (isCommandSymbol())
System.out.print(Utils.RBrackets(code));
System.out.print(CommonUtils.RBrackets(code));
}
}
}

View File

@@ -1,7 +1,7 @@
package GlobalData.Compiler;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common.Database.Objects.iDBObject;
import Common_old.Utils.Utils;
import Common_old.Utils.Validators.DVMHelpParser;
import GlobalData.CompilerEnvironment.CompilerEnvironmentsSet;
import GlobalData.CompilerOption.CompilerOptionsSet;
@@ -182,10 +182,10 @@ public class Compiler extends iDBObject {
return "";
}
public String getHelpCommand() {
return Utils.DQuotes(call_command) + " " + help_command;
return CommonUtils.DQuotes(call_command) + " " + help_command;
}
public String getVersionCommand() {
return Utils.DQuotes(call_command) + " " + version_command;
return CommonUtils.DQuotes(call_command) + " " + version_command;
}
public String getVersionInfo(){
return "v="+version+" r="+revision;

View File

@@ -1,4 +1,5 @@
package GlobalData.Compiler;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common_old.UI.DataSetControlForm;
import Common_old.UI.UI;
@@ -45,7 +46,7 @@ public class CompilersDBTable extends iDBTable<Compiler> {
String home = fields.tfHome.getText();
if (!home.isEmpty()) {
if (home.startsWith("/")) {
if (Utils.ContainsCyrillic(home))
if (CommonUtils.ContainsCyrillic(home))
Log.Writeln("Расположение компилятора не может содержать кириллицу");
else {
new PathValidator(home, "Расположение компилятора", Log).Validate();
@@ -58,7 +59,7 @@ public class CompilersDBTable extends iDBTable<Compiler> {
String call_command = fields.tfCallCommand.getText();
if (call_command.isEmpty())
Log.Writeln("Команда вызова компилятора не может быть пустой");
else if (Utils.ContainsCyrillic(call_command))
else if (CommonUtils.ContainsCyrillic(call_command))
Log.Writeln("Команда вызова компилятора не может содержать кириллицу");
else {
switch (call_command.charAt(0)) {
@@ -80,7 +81,7 @@ public class CompilersDBTable extends iDBTable<Compiler> {
Log.Writeln("Прямая команда вызова содержит запрещённые символы");
else {
if (Utils.isLinuxSystemCommand(call_command))
Log.Writeln(Utils.DQuotes(call_command) + " является системной командой Linux");
Log.Writeln(CommonUtils.DQuotes(call_command) + " является системной командой Linux");
}
break;
}

View File

@@ -1,6 +1,6 @@
package GlobalData.CompilerOption;
import Common.Database.Objects.DBObject;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import com.sun.org.glassfish.gmbal.Description;
import java.util.Arrays;
@@ -26,7 +26,7 @@ public class CompilerOption extends DBObject {
@Override
public String toString() {
return name + (hasParameter() ? (parameterSeparator +
(parameterValue.contains(" ") ? Utils.DQuotes(parameterValue) : parameterValue)) : "");
(parameterValue.contains(" ") ? CommonUtils.DQuotes(parameterValue) : parameterValue)) : "");
}
public void CheckParameterVariants() {
for (String line : description)
@@ -34,7 +34,7 @@ public class CompilerOption extends DBObject {
}
public boolean CheckLine(String line) {
if (hasParameter()) {
Pattern DVM_PARAM_VALUES_REGEX = Pattern.compile(Utils.TBrackets(parameterName) + "\\s*=\\s*" + "\\w+(\\|\\w+)+", Pattern.CASE_INSENSITIVE);
Pattern DVM_PARAM_VALUES_REGEX = Pattern.compile(CommonUtils.TBrackets(parameterName) + "\\s*=\\s*" + "\\w+(\\|\\w+)+", Pattern.CASE_INSENSITIVE);
Matcher matcher = DVM_PARAM_VALUES_REGEX.matcher(line);
if (matcher.find()) {
String s = line.substring(matcher.start(), matcher.end());

View File

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

View File

@@ -1,4 +1,5 @@
package GlobalData.DVMParameter;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common.Database.Tables.iDBTable;
import _VisualDVM.Global;
@@ -68,7 +69,7 @@ public class DVMParameterDBTable extends iDBTable<DVMParameter> {
}
*/
if (Utils.isLinuxSystemCommand(name))
Log.Writeln(Utils.DQuotes(name) + " является системной командой Linux,\nи не может быть задано в качестве имени переменной окружения.");
Log.Writeln(CommonUtils.DQuotes(name) + " является системной командой Linux,\nи не может быть задано в качестве имени переменной окружения.");
/*
if (value.contains("\"")) {
@@ -77,7 +78,7 @@ public class DVMParameterDBTable extends iDBTable<DVMParameter> {
*/
for (DVMParameter par : Global.db.dvmParameters.Data.values()) {
if (par.isVisible() && (Result.id != par.id) && (par.name.equals(name))) {
Log.Writeln("В конфигурации запуска уже задан параметр DVM системы с именем " + Utils.Brackets(name));
Log.Writeln("В конфигурации запуска уже задан параметр DVM системы с именем " + CommonUtils.Brackets(name));
break;
}
}

View File

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

View File

@@ -1,4 +1,5 @@
package GlobalData.EnvironmentValue;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common.Database.Tables.iDBTable;
import _VisualDVM.Global;
@@ -38,13 +39,13 @@ public class EnvironmentValuesDBTable extends iDBTable<EnvironmentValue> {
Log.Writeln("Имя переменной окружения может содержать только латинские буквы, цифры и подчёркивания");
}
if (Utils.isLinuxSystemCommand(name))
Log.Writeln(Utils.DQuotes(name) + " является системной командой Linux,\nи не может быть задано в качестве имени переменной окружения.");
Log.Writeln(CommonUtils.DQuotes(name) + " является системной командой Linux,\nи не может быть задано в качестве имени переменной окружения.");
if (value.contains("\"")) {
Log.Writeln("Значение переменной окружения не может содержать двойные кавычки");
}
for (EnvironmentValue env : Global.db.environmentValues.Data.values()) {
if (env.isVisible() && (Result.id != env.id) && (env.name.equals(name))) {
Log.Writeln("В конфигурации запуска уже задана переменная окружения с именем " + Utils.Brackets(name));
Log.Writeln("В конфигурации запуска уже задана переменная окружения с именем " + CommonUtils.Brackets(name));
break;
}
}

View File

@@ -1,7 +1,7 @@
package GlobalData.Machine;
import Common.Database.Objects.iDBObject;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import GlobalData.Compiler.Compiler;
import GlobalData.User.User;
@@ -24,7 +24,7 @@ public class Machine extends iDBObject {
}
public String getFullDescription() {
return //this.equals(Constants.repository_machine) ? "Репозиторий визуализатора" :
"Машина по адресу " + Utils.Brackets(getURL());
"Машина по адресу " + CommonUtils.Brackets(getURL());
}
public LinkedHashMap<Integer, Compiler> getCompilers() {
return Global.db.getMapByFKi(this, Compiler.class);

View File

@@ -1,4 +1,5 @@
package GlobalData.Makefile;
import Common.Utils.CommonUtils;
import Common_old.Current;
import _VisualDVM.Global;
import Common.Utils.TextLog;
@@ -37,7 +38,7 @@ public class Makefile extends ModuleAnchestor {
Vector<String> titles = new Vector<>();
Vector<String> objects = new Vector<>();
Vector<String> bodies = new Vector<>();
String binary = Utils.DQuotes("0"); // Utils.DQuotes(project.name);
String binary = CommonUtils.DQuotes("0"); // Utils.DQuotes(project.name);
for (Module module : modules.values()) {
//определить а активен ли модуль.
//выбран ли он. есть ли у него компилятор. есть ли для него программы.
@@ -61,7 +62,7 @@ public class Makefile extends ModuleAnchestor {
for (DBProjectFile program : programsToAssembly) {
//--
program.last_assembly_name = module.language.toString() + "_" + i + ".o";
String object = Utils.DQuotes(program.last_assembly_name);
String object = CommonUtils.DQuotes(program.last_assembly_name);
module_objects.add(object);
module_body +=
object + ":\n" +
@@ -78,7 +79,7 @@ public class Makefile extends ModuleAnchestor {
++i;
}
titles.add(String.join("\n",
LANG_ + "COMMAND=" + Utils.DQuotes(module_compiler.call_command) + " " + module.command,
LANG_ + "COMMAND=" + CommonUtils.DQuotes(module_compiler.call_command) + " " + module.command,
LANG_ + "FLAGS=" + module.flags,
LANG_ + "OBJECTS=" + String.join(" ", module_objects),
""
@@ -88,7 +89,7 @@ public class Makefile extends ModuleAnchestor {
}
}
return String.join("\n",
"LINK_COMMAND=" + Utils.DQuotes(linker.call_command) + " " + command,
"LINK_COMMAND=" + CommonUtils.DQuotes(linker.call_command) + " " + command,
"LINK_FLAGS=" + flags + "\n",
String.join("\n", titles),
"all: " + binary,
@@ -124,7 +125,7 @@ public class Makefile extends ModuleAnchestor {
for (DBProjectFile program : programsToAssembly) {
//--
program.last_assembly_name = module.language.toString() + "_" + i + ".o";
String object = Utils.DQuotes(program.last_assembly_name);
String object = CommonUtils.DQuotes(program.last_assembly_name);
module_objects.add(object);
module_body +=
object + ":\n" +
@@ -141,7 +142,7 @@ public class Makefile extends ModuleAnchestor {
++i;
}
titles.add(String.join("\n",
LANG_ + "COMMAND=" + Utils.DQuotes(module_compiler.call_command) + " " + module.command,
LANG_ + "COMMAND=" + CommonUtils.DQuotes(module_compiler.call_command) + " " + module.command,
LANG_ + "FLAGS=" + module.flags,
LANG_ + "OBJECTS=" + String.join(" ", module_objects),
""
@@ -178,7 +179,7 @@ public class Makefile extends ModuleAnchestor {
if (linker.type.equals(CompilerType.dvm)) {
if (!Current.getProject().languageName.getDVMLink().equals(command))
Log.Writeln("команда линковки " +
Utils.Quotes(command) +
CommonUtils.Quotes(command) +
" не соответствует языку текущего проекта "
+ Current.getProject().languageName.getDescription() + "\n" +
"Используйте команду " + Current.getProject().languageName.getDVMLink());

View File

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

View File

@@ -1,13 +1,13 @@
package GlobalData.Module;
import Common_old.Constants;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import GlobalData.Compiler.Compiler;
public class ModuleAnchestor extends iDBObject {
//--------------------------------------------------------------------------------------
public int machine_id = Constants.Nan;
public int compiler_id = Constants.Nan;
public int machine_id = CommonConstants.Nan;
public int compiler_id = CommonConstants.Nan;
public String command = ""; //дополнительная команда компилятору. между вызовом и флагами.
public String flags = ""; //последовательность флагов
//---------------------------------------------------------------------------------------
@@ -22,11 +22,11 @@ public class ModuleAnchestor extends iDBObject {
public String getDescription() {
String res = "";
if (getCompiler() != null) {
res += Utils.Brackets(getCompiler().getDescription());
res += CommonUtils.Brackets(getCompiler().getDescription());
if (!command.isEmpty())
res += " " + Utils.Brackets(command);
res += " " + CommonUtils.Brackets(command);
if (!flags.isEmpty())
res += " " + Utils.Brackets(flags);
res += " " + CommonUtils.Brackets(flags);
}
return res;
}

View File

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

View File

@@ -1,10 +1,10 @@
package GlobalData.RunConfiguration;
import Common_old.Constants;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Global;
import Common.Utils.TextLog;
import Common_old.Utils.Utils;
import GlobalData.Compiler.Compiler;
import GlobalData.DVMParameter.DVMParameter;
import GlobalData.EnvironmentValue.EnvironmentValue;
@@ -23,7 +23,7 @@ public class RunConfiguration extends iDBObject {
public int machine_id;
//---------------------------------------->
@Description("DEFAULT -1")
public int compiler_id = Constants.Nan;
public int compiler_id = CommonConstants.Nan;
public String LauncherCall = ""; //например DVM или mpirun
public String LauncherOptions = ""; //например run
//--------------------------------------
@@ -146,16 +146,16 @@ public class RunConfiguration extends iDBObject {
public String getDescription() {
String res = "";
if (!LauncherCall.isEmpty()) {
res += Utils.Brackets(LauncherCall);
res += CommonUtils.Brackets(LauncherCall);
if (!LauncherOptions.isEmpty())
res += " " + Utils.Brackets(LauncherOptions);
res += " " + CommonUtils.Brackets(LauncherOptions);
} else res = "";
return res;
}
public String getLaunchScriptText(String binary_name, String task_matrix) {
String res = "";
if (!LauncherCall.isEmpty()) {
res += Utils.DQuotes(LauncherCall);
res += CommonUtils.DQuotes(LauncherCall);
if (!LauncherOptions.isEmpty())
res += " " + LauncherOptions;
if (!task_matrix.isEmpty())
@@ -163,14 +163,14 @@ public class RunConfiguration extends iDBObject {
}
if (!res.isEmpty())
res += " ";
res += Utils.DQuotes("./" + binary_name);
res += CommonUtils.DQuotes("./" + binary_name);
if (!args.isEmpty())
res += " " + args;
return res;
}
public String getLaunchShortDescription() {
String res = "";
if (compiler_id != Constants.Nan) {
if (compiler_id != CommonConstants.Nan) {
res += getCompiler().description;
if (!LauncherOptions.isEmpty())
res += " " + LauncherOptions;

View File

@@ -1,5 +1,5 @@
package GlobalData.RunConfiguration;
import Common_old.Constants;
import Common.CommonConstants;
import Common_old.Current;
import _VisualDVM.Global;
import Common_old.UI.DataSetControlForm;
@@ -72,7 +72,7 @@ public class RunConfigurationsDBTable extends iDBTable<RunConfiguration> {
Result.LauncherOptions = (String) fields.cbLaunchOptions.getSelectedItem();
if (fields.cbLauncherCall.getSelectedItem() instanceof Compiler) {
Result.compiler_id = ((Compiler) (fields.cbLauncherCall.getSelectedItem())).id;
} else Result.compiler_id = Constants.Nan;
} else Result.compiler_id = CommonConstants.Nan;
//-
Result.dim = (int) fields.sMaxDim.getValue();
Result.minMatrix = fields.minMatrixBar.pack(Result.dim);

View File

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

View File

@@ -1,5 +1,6 @@
package GlobalData.Settings;
import Common.Database.Objects.DBObject;
import Common.Utils.CommonUtils;
import Common_old.UI.Menus_2023.StableMenuItem;
import Common_old.Utils.Utils;
import Repository.Component.ComponentType;
@@ -70,7 +71,7 @@ public class DBSetting extends DBObject {
getMenuItem().setText(Name.getDescription() + " : " + this + "%");
break;
case StringField:
String valueToShow = Value.isEmpty()? "не задано":Utils.Quotes(toString());
String valueToShow = Value.isEmpty()? "не задано": CommonUtils.Quotes(toString());
getMenuItem().setText(Name.getDescription() + " : " + valueToShow);
break;
case IntField:

View File

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

View File

@@ -1,8 +1,8 @@
package GlobalData.Tasks.CompilationTask;
import Common_old.Constants;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Current;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import GlobalData.Makefile.Makefile;
import GlobalData.Module.Module;
import GlobalData.Tasks.RunTask.RunTask;
@@ -16,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 = Constants.Nan;
public int makefile_id = CommonConstants.Nan;
public String binary_name = ""; //исполняемый файл.
//---------------------------------------------------
@Description("DEFAULT ''")
@@ -100,7 +100,7 @@ public class CompilationTask extends Task {
String errors = getErrors();
for (DBProjectFile file : project.db.files.Data.values()) {
if (!file.last_assembly_name.isEmpty()) {
String replacement = file.last_assembly_name + " " + Utils.RBrackets(file.name);
String replacement = file.last_assembly_name + " " + CommonUtils.RBrackets(file.name);
output = output.replace(file.last_assembly_name, replacement);
errors = errors.replace(file.last_assembly_name, replacement);
}

View File

@@ -1,5 +1,5 @@
package GlobalData.Tasks.QueueSystem;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import GlobalData.Tasks.Task;
import GlobalData.Tasks.TaskState;
public class QueueSystem {
@@ -28,9 +28,9 @@ public class QueueSystem {
}
}
public String getCheckTaskCommand(Task task) {
return check_command + " " + Utils.DQuotes(task.PID);
return check_command + " " + CommonUtils.DQuotes(task.PID);
}
public String getCancelTaskCommand(Task task) {
return cancel_command + " " + Utils.DQuotes(task.PID);
return cancel_command + " " + CommonUtils.DQuotes(task.PID);
}
}

View File

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

View File

@@ -1,4 +1,5 @@
package GlobalData.Tasks.Supervisor.Local.Linux;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Utils.Utils;
import GlobalData.Tasks.Supervisor.Local.LocalTaskSupervisor;
@@ -23,10 +24,10 @@ public abstract class LinuxLocalTaskSupervisor<T extends Task> extends LocalTask
User user = task.getUser();
return
String.join(" ",
Utils.DQuotes(user.getStarterFile()),
Utils.DQuotes(user.getLauncherFile()),
CommonUtils.DQuotes(user.getStarterFile()),
CommonUtils.DQuotes(user.getLauncherFile()),
String.valueOf(task.maxtime),
Utils.DQuotes(getCoupDeGrace()),
CommonUtils.DQuotes(getCoupDeGrace()),
task.getFullCommand()
);
}
@@ -47,7 +48,7 @@ public abstract class LinuxLocalTaskSupervisor<T extends Task> extends LocalTask
if (task.PID.isEmpty())
throw new PassException("Ошибка при старте : идентификатор задачи не определен.");
task.StartDate = (new Date()).getTime();
pass.ShowMessage1("Задача активна, идентификатор " + Utils.Brackets(task.PID));
pass.ShowMessage1("Задача активна, идентификатор " + CommonUtils.Brackets(task.PID));
RefreshProgress();
do {
Thread.sleep(getTaskCheckPeriod() * 1000L);

View File

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

View File

@@ -1,4 +1,5 @@
package GlobalData.Tasks.Supervisor.Local.Windows;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import GlobalData.Makefile.Makefile;
@@ -18,7 +19,7 @@ public class WindowsLocalCompilationSupervisor extends WindowsLocalTaskSuperviso
}
@Override
protected String getScriptText() {
return Utils.DQuotes(Global.db.settings.get(SettingName.LocalMakePathWindows).Value) + " 1>out.txt 2>err.txt";
return CommonUtils.DQuotes(Global.db.settings.get(SettingName.LocalMakePathWindows).Value) + " 1>out.txt 2>err.txt";
}
//скорее всего как то выделить подготовку к компиляции как метод предка.
@Override

View File

@@ -1,6 +1,6 @@
package GlobalData.Tasks.Supervisor.Remote;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common_old.Utils.Utils;
import GlobalData.RemoteFile.RemoteFile;
import GlobalData.Tasks.QueueSystem.MVS;
import GlobalData.Tasks.TaskState;
@@ -32,7 +32,7 @@ public class MVSRunSupervisor extends ServerRunSupervisor {
String env = String.join(" ", Current.getRunConfiguration().getEnvList());
mvs_time = (task.maxtime / 60); //в минутах
if (task.maxtime % 60 > 0) mvs_time += 1;
String res = "maxtime=" + Utils.DQuotes(mvs_time) + " ./run";
String res = "maxtime=" + CommonUtils.DQuotes(mvs_time) + " ./run";
if (!env.isEmpty())
res = env + " " + res;
/*

View File

@@ -1,6 +1,6 @@
package GlobalData.Tasks.Supervisor.Remote;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Utils.Utils;
import GlobalData.RemoteFile.RemoteFile;
import GlobalData.Tasks.Supervisor.TaskSupervisor;
import GlobalData.Tasks.Task;
@@ -77,10 +77,10 @@ public abstract class RemoteTaskSupervisor<T extends Task> extends TaskSuperviso
protected String getStartCommand() {
String res =
String.join(" ",
Utils.DQuotes(getStarter()),
Utils.DQuotes(getLauncher()),
CommonUtils.DQuotes(getStarter()),
CommonUtils.DQuotes(getLauncher()),
String.valueOf(task.maxtime),
Utils.DQuotes(getCoupDeGrace()),
CommonUtils.DQuotes(getCoupDeGrace()),
task.getFullCommand()
);
return res;

View File

@@ -1,4 +1,5 @@
package GlobalData.Tasks.Supervisor;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import GlobalData.Tasks.Task;
@@ -96,7 +97,7 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass_2021> {
task.state = TaskState.AbortedByUser;
ShowTaskState();
}
pass.ShowMessage1("Задача " + Utils.Brackets(task.state.getDescription()));
pass.ShowMessage1("Задача " + CommonUtils.Brackets(task.state.getDescription()));
task.EndDate = (new Date()).getTime();
pass.ShowMessage2("Получение результатов");
AchieveResults();
@@ -119,7 +120,7 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass_2021> {
if (task.PID.isEmpty())
throw new PassException("Ошибка при старте : идентификатор задачи не определен.");
task.StartDate = (new Date()).getTime();
pass.ShowMessage1("Задача активна, идентификатор " + Utils.Brackets(task.PID));
pass.ShowMessage1("Задача активна, идентификатор " + CommonUtils.Brackets(task.PID));
RefreshProgress();
do {
Thread.sleep(getTaskCheckPeriod() * 1000);

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
package ProjectData.Files;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Current;
import _VisualDVM.Global;
@@ -85,7 +86,7 @@ public class DBProjectFile extends ProjectFile {
if (data.length > 1) {
String[] data1 = data[1].split(":");
if (data1.length > 0) {
file = Utils.toW(data1[0]);//.substring(1));
file = CommonUtils.toW(data1[0]);//.substring(1));
//первый символ тут всегда пробел. слеши всегда виндовые.
}
}
@@ -156,7 +157,7 @@ public class DBProjectFile extends ProjectFile {
String default_options = "";
switch (languageName) {
case fortran:
default_options += " -spf -noProject -o " + Utils.DQuotes(getDepFile().getAbsolutePath());
default_options += " -spf -noProject -o " + CommonUtils.DQuotes(getDepFile().getAbsolutePath());
switch (style) {
case free:
default_options += " -f90";
@@ -390,10 +391,10 @@ public class DBProjectFile extends ProjectFile {
father.db.Update(this);
}
public String getUnixName() {
return Utils.toU(name);
return CommonUtils.toU(name);
}
public String getQObjectName() {
return Utils.DQuotes(getUnixName() + ".o");
return CommonUtils.DQuotes(getUnixName() + ".o");
}
@Override
@@ -401,7 +402,7 @@ public class DBProjectFile extends ProjectFile {
return name;
}
public String getProjectNameWithoutExtension() {
String extension = Utils.getExtension(file);
String extension = CommonUtils.getExtension(file);
return name.substring(0, name.length() - (extension.length() + 1));
}
public void importSettings(DBProjectFile parent, boolean sapforStyle) throws Exception {

View File

@@ -1,7 +1,7 @@
package ProjectData.Files;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common.Database.Objects.DBObject;
import Common_old.Utils.Utils;
import ProjectData.LanguageName;
import javax.swing.*;
@@ -48,7 +48,7 @@ public class ProjectFile extends DBObject {
}
}
//-
switch (Utils.getExtensionByName(name_in)) {
switch (CommonUtils.getExtensionFromName(name_in)) {
case "f":
case "fdv":
case "for":
@@ -87,7 +87,7 @@ public class ProjectFile extends DBObject {
fileType = FileType.forbidden;
break;
case "":
if (Utils.isDigit(name_in)) {
if (CommonUtils.isDigit(name_in)) {
fileType = FileType.forbidden;
} else {
state = FileState.Excluded;
@@ -130,14 +130,14 @@ public class ProjectFile extends DBObject {
return new ImageIcon(imageUrl);
}
public String getUnixName() {
return Utils.toU(file.getName());
return CommonUtils.toU(file.getName());
}
@Override
public String toString() {
return file.getName();
}
public String getQSourceName() {
return Utils.DQuotes(getUnixName());
return CommonUtils.DQuotes(getUnixName());
}
public String getStyleOptions() {
if (languageName == LanguageName.fortran) {

View File

@@ -1,6 +1,6 @@
package ProjectData.Files.UI.Editor.AutoComplete.SAPFOR.Directives;
import Common.Utils.CommonUtils;
import Common_old.UI.Editor.CaretInfo;
import Common_old.Utils.Utils;
import ProjectData.Files.UI.Editor.AutoComplete.SAPFOR.Providers.BaseProvider;
import ProjectData.Files.UI.Editor.AutoComplete.SAPFOR.SapforAutoComplete;
import org.fife.ui.autocomplete.BasicCompletion;
@@ -18,7 +18,7 @@ public class BaseDirective extends BasicCompletion {
getCaretInfo().suffix_word.isEmpty() &&
name.getText().startsWith(getCaretInfo().prefix_word)
&& (!name.getText().equals(getCaretInfo().prefix_word))
&& !Utils.isBracketsBalanced(getCaretInfo().before);
&& !CommonUtils.isRBracketsBalanced(getCaretInfo().before);
}
//итоговая функция, определяющая наличие директивы в автозаполнении
public boolean Check() {

View File

@@ -1,4 +1,5 @@
package ProjectData.Messages;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Current;
import _VisualDVM.Global;
@@ -396,7 +397,7 @@ public class Message extends FileObject {
if (sum != splited.length && !message.equals("")) {
Utils.CopyToClipboard(message);
throw new PassException("Ошибка при декодировании сообщений на русском языке\n" +
"message=" + Utils.Brackets(message));
"message=" + CommonUtils.Brackets(message));
}
idx = 0;
String result = "";

View File

@@ -1,6 +1,6 @@
package ProjectData.Messages.Recommendations;
import Common.Database.Objects.iDBObject;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import GlobalData.Settings.SettingName;
import Visual_DVM_2021.Passes.PassCode_2021;
import com.sun.org.glassfish.gmbal.Description;
@@ -19,18 +19,18 @@ public class MessageRecommendation extends iDBObject {
public MessageRecommendation(PassCode_2021 passCode_in) {
type = RecommendationType.Transformation;
argName = passCode_in.toString();
text = "Выполните преобразование " + Utils.Quotes(passCode_in.getDescription());
text = "Выполните преобразование " + CommonUtils.Quotes(passCode_in.getDescription());
}
public MessageRecommendation(SettingName settingName_in, String settingValue_in) {
type = RecommendationType.Setting;
argName = settingName_in.toString();
argValue = settingValue_in;
if (argValue.equals("1"))
text = "Включите настройку SAPFOR " + Utils.Quotes(settingName_in.getDescription());
text = "Включите настройку SAPFOR " + CommonUtils.Quotes(settingName_in.getDescription());
else if (argValue.equals("0"))
text = "Отключите настройку SAPFOR " + Utils.Quotes(settingName_in.getDescription());
text = "Отключите настройку SAPFOR " + CommonUtils.Quotes(settingName_in.getDescription());
else
text = "Задайте значение " + Utils.DQuotes(argValue) + " для настройки SAPFOR " + Utils.Quotes(settingName_in.getDescription());
text = "Задайте значение " + CommonUtils.DQuotes(argValue) + " для настройки SAPFOR " + CommonUtils.Quotes(settingName_in.getDescription());
}
public MessageRecommendation(String text_in) {
type = RecommendationType.Text;

View File

@@ -1,4 +1,6 @@
package ProjectData.Project;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Current;
import Common.Database.Objects.DBObject;
@@ -65,7 +67,7 @@ public class db_project_info extends DBObject {
public String Log = "";//текст выдаваемый сапфором
//-----------------------------------------------
@Description("DEFAULT -1")
public long creationDate = Constants.Nan; //--------------------------------------------------NEW.
public long creationDate = CommonConstants.Nan; //--------------------------------------------------NEW.
@Description("DEFAULT ''")
public String compilation_output = "";
@Description("DEFAULT ''")
@@ -88,19 +90,19 @@ public class db_project_info extends DBObject {
public int maxdim = 0;
//<editor-fold desc="Метрика">
@Description("DEFAULT -1")
public int numLines = Constants.Nan;
public int numLines = CommonConstants.Nan;
@Description("DEFAULT -1")
public int numSPF = Constants.Nan;
public int numSPF = CommonConstants.Nan;
@Description("DEFAULT -1")
public int numDVM = Constants.Nan;
public int numDVM = CommonConstants.Nan;
@Description("DEFAULT -1")
public int numArrays = Constants.Nan;
public int numArrays = CommonConstants.Nan;
@Description("DEFAULT -1")
public int numLoops = Constants.Nan;
public int numLoops = CommonConstants.Nan;
@Description("DEFAULT -1")
public int numFunctions = Constants.Nan;
public int numFunctions = CommonConstants.Nan;
@Description("DEFAULT -1")
public int numAddicted = Constants.Nan;
public int numAddicted = CommonConstants.Nan;
//-------------------------------------
//параметры графа функций. храним для каждого проекта.
@Description("DEFAULT 500")
@@ -309,10 +311,10 @@ public class db_project_info extends DBObject {
}
public boolean IsMCopy() {
String lname = name.toLowerCase();
return (lname.startsWith("m") && Utils.isDigit(lname.substring(1)));
return (lname.startsWith("m") && CommonUtils.isDigit(lname.substring(1)));
}
public String getTitle() {
return name + " " + Utils.DQuotes(description);
return name + " " + CommonUtils.DQuotes(description);
}
public File getProjFile() {
return Paths.get(Home.getAbsolutePath(), Constants.data, Constants.spf).toFile();
@@ -398,13 +400,13 @@ public class db_project_info extends DBObject {
allIncludes.clear();
files_order.clear();
functionsGraph.Clear();
numLines = Constants.Nan;
numSPF = Constants.Nan;
numDVM = Constants.Nan;
numArrays = Constants.Nan;
numFunctions = Constants.Nan;
numAddicted = Constants.Nan;
numLoops = Constants.Nan;
numLines = CommonConstants.Nan;
numSPF = CommonConstants.Nan;
numDVM = CommonConstants.Nan;
numArrays = CommonConstants.Nan;
numFunctions = CommonConstants.Nan;
numAddicted = CommonConstants.Nan;
numLoops = CommonConstants.Nan;
Log = "";
Scenario = "";
declaratedArrays.clear();
@@ -528,10 +530,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 == Constants.Nan ? recommendAnalysis(PassCode_2021.SPF_GetGraphFunctions) : String.valueOf(numFunctions);
return numFunctions == CommonConstants.Nan ? recommendAnalysis(PassCode_2021.SPF_GetGraphFunctions) : String.valueOf(numFunctions);
}
public String AddictedCount() {
return numAddicted == Constants.Nan ? recommendAnalysis(PassCode_2021.SPF_GetIncludeDependencies) : String.valueOf(numAddicted);
return numAddicted == CommonConstants.Nan ? recommendAnalysis(PassCode_2021.SPF_GetIncludeDependencies) : String.valueOf(numAddicted);
}
public boolean UpdateLinesCount() {
try {
@@ -673,8 +675,8 @@ public class db_project_info extends DBObject {
public boolean FolderNotExists(File new_directory, File subdir, TextLog passLog) {
for (File pf : getSubdirectoriesSimple(subdir)) {
if (pf.getName().equals(new_directory.getName())) {
passLog.Writeln("В папке " + Utils.Brackets(subdir.getAbsolutePath()) + "\n" +
"уже существует папка с именем " + Utils.Brackets(new_directory.getName()));
passLog.Writeln("В папке " + CommonUtils.Brackets(subdir.getAbsolutePath()) + "\n" +
"уже существует папка с именем " + CommonUtils.Brackets(new_directory.getName()));
return false;
}
}
@@ -713,8 +715,8 @@ public class db_project_info extends DBObject {
}
public boolean CheckAttachmentFile(File f, TextLog Log) {
Utils.validateFileShortNewName(f.getName(), Log);
if (Utils.getFileSizeMegaBytes(f) > 2)
Log.Writeln_("Размер вложения " + Utils.Brackets(f.getName()) + " превышает 2 Мb");
if (CommonUtils.getFileSizeMegaBytes(f) > 2)
Log.Writeln_("Размер вложения " + CommonUtils.Brackets(f.getName()) + " превышает 2 Мb");
return Log.isEmpty();
}
public boolean CheckAllAttachments(TextLog Log) {
@@ -843,7 +845,7 @@ public class db_project_info extends DBObject {
for (String key_ : versions.keySet()) {
String[] data_ = key_.split(letter);
String last = data_[data_.length - 1];
if (Utils.isDigit(last)) {
if (CommonUtils.isDigit(last)) {
int vn = Integer.parseInt(last);
if (vn > max_vn)
max_vn = vn;
@@ -1123,7 +1125,7 @@ public class db_project_info extends DBObject {
String[] splited = packed_messages.split("\\|");
int numberOfFiles = Integer.parseInt(splited[idx++]);
for (int i = 0; i < numberOfFiles; ++i) {
String message_file = Utils.toW(splited[idx++]); //для ключа.
String message_file = CommonUtils.toW(splited[idx++]); //для ключа.
int numberOfMessages = Integer.parseInt(splited[idx++]);
if (!db.files.Data.containsKey(message_file)) {
throw new PassException("Ошибка при распаковке сообщений: файл: [" +

View File

@@ -1,5 +1,5 @@
package ProjectData.SapforData.Arrays;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import ProjectData.Files.DBProjectFile;
import ProjectData.SapforData.FileObjectWithMessages;
// это то что отображается в боковом графе файла. не путать с сапфоровским ProjectArray
@@ -13,6 +13,6 @@ public class ArrayDecl extends FileObjectWithMessages {
}
@Override
public String Description() {
return array_loc.getDescription() + " массив " + Utils.Brackets(array_name);
return array_loc.getDescription() + " массив " + CommonUtils.Brackets(array_name);
}
}

View File

@@ -1,4 +1,5 @@
package ProjectData.SapforData.Arrays;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common.Database.Objects.DBObject;
import Common.Utils.Index;
@@ -103,7 +104,7 @@ public class ProjectArray extends DBObject {
int numDeclPlaces = Integer.parseInt(localSplited[2]);
int idxPl = 3;
for (int i = 0; i < numDeclPlaces; ++i, idxPl += 2) {
String declFile = Utils.toW(localSplited[idxPl]);
String declFile = CommonUtils.toW(localSplited[idxPl]);
DBProjectFile file = Current.getProject().db.files.Data.get(declFile);
int declLine = Integer.parseInt(localSplited[idxPl + 1]);
//declPlaces.add(new Pair<>(declFile, declLine));
@@ -318,7 +319,7 @@ public class ProjectArray extends DBObject {
default:
break;
}
res += Utils.ending(i == binary.length() - 1);
res += CommonUtils.ending(i == binary.length() - 1);
}
}
return res;

View File

@@ -1,8 +1,8 @@
package ProjectData.SapforData;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common.Database.Objects.iDBObject;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
import ProjectData.Files.DBProjectFile;
import com.sun.org.glassfish.gmbal.Description;
//объект принадлежащий файлу и относящийся к его строке.
@@ -18,7 +18,7 @@ public abstract class FileObject extends iDBObject {
}
@Override
public String getSelectionText() {
return "файл " + Utils.Brackets(file) + " строка: " + line;
return "файл " + CommonUtils.Brackets(file) + " строка: " + line;
}
public DBProjectFile getFather() {
return Current.getProject().db.files.Data.get(file);

View File

@@ -1,6 +1,6 @@
package ProjectData.SapforData.Functions;
import Common.Utils.CommonUtils;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
import ProjectData.Files.DBProjectFile;
import ProjectData.SapforData.FileObjectWithMessages;
import Visual_DVM_2021.Passes.PassCode_2021;
@@ -25,14 +25,14 @@ public class FuncCall extends FileObjectWithMessages {
}
@Override
public String Description() {
return "вызов " + Utils.Brackets(funcName);
return "вызов " + CommonUtils.Brackets(funcName);
}
@Override
public void Select(boolean flag) {
if (Pass_2021.passes.get(PassCode_2021.SPF_GetGraphFunctions).isDone()) {
super.Select(flag);
} else {
UI.Info("Для подстановки функций требуется выполнить проход " + Utils.DQuotes(PassCode_2021.SPF_GetGraphFunctions.getDescription()));
UI.Info("Для подстановки функций требуется выполнить проход " + CommonUtils.DQuotes(PassCode_2021.SPF_GetGraphFunctions.getDescription()));
}
}
}

View File

@@ -1,6 +1,6 @@
package ProjectData.SapforData.Functions;
import Common.Utils.CommonUtils;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Pass_2021;
@@ -29,7 +29,7 @@ public class FuncCallH extends FuncCall {
}
@Override
public String getSelectionText() {
return "вызов " + Utils.Brackets(funcName) + " в строке " + line;
return "вызов " + CommonUtils.Brackets(funcName) + " в строке " + line;
}
@Override
public void SelectAllChildren(boolean select) {
@@ -41,7 +41,7 @@ public class FuncCallH extends FuncCall {
if (Pass_2021.passes.get(PassCode_2021.SPF_GetGraphFunctions).isDone()) {
super.Select(flag);
} else {
UI.Info("Для подстановки функций требуется выполнить проход " + Utils.DQuotes(PassCode_2021.SPF_GetGraphFunctions.getDescription()));
UI.Info("Для подстановки функций требуется выполнить проход " + CommonUtils.DQuotes(PassCode_2021.SPF_GetGraphFunctions.getDescription()));
}
}
}

View File

@@ -1,4 +1,5 @@
package ProjectData.SapforData.Functions;
import Common.Utils.CommonUtils;
import Common.Utils.Index;
import Common_old.Utils.Utils;
import ProjectData.Files.DBProjectFile;
@@ -52,7 +53,7 @@ public class FuncInfo extends FileObjectWithMessages {
//--
@Override
public String getSelectionText() {
return type.getDescription() + " " + Utils.Brackets(funcName);
return type.getDescription() + " " + CommonUtils.Brackets(funcName);
}
public boolean isMain() {
return type.equals(FunctionType.Main);
@@ -77,6 +78,6 @@ public class FuncInfo extends FileObjectWithMessages {
}
@Override
public String Description() {
return type.getDescription() + " " + Utils.Brackets(funcName);
return type.getDescription() + " " + CommonUtils.Brackets(funcName);
}
}

View File

@@ -1,9 +1,9 @@
package ProjectData.SapforData.Functions.UI.Graph;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common_old.UI.Menus.VisualiserMenuItem;
import Common_old.UI.Menus.StyledPopupMenu;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
import Visual_DVM_2021.Passes.All.SPF_GetGraphFunctionPositions;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Pass_2021;
@@ -32,7 +32,7 @@ public class FunctionsGraphMenu extends StyledPopupMenu {
@Override
public void CheckElementsVisibility() {
if (Current.HasSelectedFunction()) {
changeCurrent.setText("Назначить процедуру " + Utils.DQuotes(Current.getSelectionFunction().funcName) + " текущей.");
changeCurrent.setText("Назначить процедуру " + CommonUtils.DQuotes(Current.getSelectionFunction().funcName) + " текущей.");
changeCurrent.setEnabled(true);
} else {
changeCurrent.setText("Невозможно назначить текущую процедуру: узел графа не выбран");

View File

@@ -1,7 +1,7 @@
package ProjectData.SapforData.Functions.UI.Graph;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
import ProjectData.SapforData.Functions.FuncCoordinates;
import ProjectData.SapforData.Functions.FuncInfo;
import ProjectData.SapforData.Functions.FunctionType;
@@ -243,7 +243,7 @@ public class FunctionsGraphUI extends mxGraph {
break;
case Standard:
case NotFound:
UI.Info("процедура " + Utils.Brackets(func_name) + " " + fi.type.getDescription());
UI.Info("процедура " + CommonUtils.Brackets(func_name) + " " + fi.type.getDescription());
break;
}
break;

View File

@@ -1,5 +1,5 @@
package ProjectData.SapforData.Functions.UI.Graph;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import com.mxgraph.swing.mxGraphComponent;
import javafx.util.Pair;
@@ -44,7 +44,7 @@ public class GraphInfo {
Vector<String> edges = new Vector<>();
for (String name : vertexMap.keySet()) {
for (String neighbor : vertexMap.get(name)) {
edges.add(Utils.Brackets(name + "," + neighbor));
edges.add(CommonUtils.Brackets(name + "," + neighbor));
}
}
}

View File

@@ -1,5 +1,5 @@
package ProjectData.SapforData.Includes;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import ProjectData.SapforData.FileObject;
public class DependencyInfo extends FileObject {
public DependencyInfo(String file_in) {
@@ -7,7 +7,7 @@ public class DependencyInfo extends FileObject {
}
@Override
public String getSelectionText() {
return "включение: " + Utils.Brackets(file);
return "включение: " + CommonUtils.Brackets(file);
}
//мб на будущее расширить, в какой строке находится команда икнлудить файл.
// но это уже к Сапфору

View File

@@ -1,8 +1,8 @@
package ProjectData.SapforData.Regions;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common.Database.Objects.DBObject;
import Common.Utils.Index;
import Common_old.Utils.Utils;
import ProjectData.Files.DBProjectFile;
import ProjectData.SapforData.Arrays.Distribution.AlignRule;
import ProjectData.SapforData.Arrays.Distribution.DataDirective;
@@ -39,7 +39,7 @@ public class ParallelRegion extends DBObject {
//распаковка Lines -----------------------------------------------
//---------------------------------------------------------------
for (int i = 0; i < lines_size; ++i) {
String line_file = Utils.toW(localSplited[1]);
String line_file = CommonUtils.toW(localSplited[1]);
int line_list_size = Integer.parseInt(localSplited[2]);
Vector<Pair<Integer, Integer>> current_lines = new Vector<>(line_list_size);
for (int k = 0; k < line_list_size; ++k) {

View File

@@ -1,8 +1,8 @@
package Repository.BugReport;
import Common.Utils.CommonUtils;
import Common_old.Current;
import _VisualDVM.Global;
import Common.Utils.TextLog;
import Common_old.Utils.Utils;
import Repository.RepositoryServer;
import Repository.Subscribes.Subscriber;
@@ -61,7 +61,7 @@ public class BugReportInterface {
return true;
}
public static String getMailTitlePrefix(BugReport object) {
return "Ошибка " + Utils.Brackets(object.id) + ", автор " + Utils.Brackets(object.sender_name) + " : ";
return "Ошибка " + CommonUtils.Brackets(object.id) + ", автор " + CommonUtils.Brackets(object.sender_name) + " : ";
}
public static Vector<String> getRecipients(BugReport object) {
Vector<String> res = new Vector<>();

View File

@@ -1,4 +1,6 @@
package Repository.Component;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
@@ -14,9 +16,9 @@ import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
public abstract class Component extends DBObject implements Loggable {
public String date_text = Constants.dateNaN;
public long version = Constants.Nan;
public long actual_version = Constants.Nan;
public long minimal_version = Constants.Nan;
public long version = CommonConstants.Nan;
public long actual_version = CommonConstants.Nan;
public long minimal_version = CommonConstants.Nan;
//--
public String code = "";
public String actual_code = "";
@@ -26,7 +28,7 @@ public abstract class Component extends DBObject implements Loggable {
VFileChooser fileChooser = null; ///для ручной установки.
public VFileChooser getFileChooser() {
return (fileChooser == null) ? (fileChooser = new VFileChooser("выбор файла для компонента " +
Utils.Brackets(getComponentType().getDescription()), Utils.getExtension(getFile())))
CommonUtils.Brackets(getComponentType().getDescription()), CommonUtils.getExtension(getFile())))
: fileChooser;
}
//--
@@ -34,7 +36,7 @@ public abstract class Component extends DBObject implements Loggable {
return String.valueOf(version);
}
public void CheckIfNeedsUpdateOrPublish() {
if (actual_version != Constants.Nan) {
if (actual_version != CommonConstants.Nan) {
if (version < minimal_version) setState(ComponentState.Old_version);
else {
ComponentState new_state =
@@ -48,7 +50,7 @@ public abstract class Component extends DBObject implements Loggable {
setState(ComponentState.Undefined);
if (getFile().exists()) {
GetVersionInfo();
if (version == Constants.Nan)
if (version == CommonConstants.Nan)
setState(ComponentState.Unknown_version);
} else setState(ComponentState.Not_found);
}
@@ -84,8 +86,8 @@ public abstract class Component extends DBObject implements Loggable {
return getComponentType();
}
public boolean isValidVersion(TextLog Log, String desc) {
if (version == Constants.Nan) {
Log.Writeln_("Не определена версия " + desc + " компонента " + Utils.Brackets(getComponentType().getDescription()));
if (version == CommonConstants.Nan) {
Log.Writeln_("Не определена версия " + desc + " компонента " + CommonUtils.Brackets(getComponentType().getDescription()));
return false;
}
return true;

View File

@@ -1,4 +1,5 @@
package Repository.Component.PerformanceAnalyzer;
import Common.Utils.CommonUtils;
import Common_old.Current;
import _VisualDVM.Global;
import analyzer.common.MessageJtoJ;
@@ -102,7 +103,7 @@ public class PerformanceAnalyzer extends Component {
return null;
});
Utils.startScript(Global.TempDirectory, Global.ComponentsDirectory, "analyzer",
"java -jar -Dprism.order=sw "+ Utils.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort()+ " --version" );
"java -jar -Dprism.order=sw "+ CommonUtils.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort()+ " --version" );
//-
server_thread.join();
} catch (Exception ex) {
@@ -124,7 +125,7 @@ public class PerformanceAnalyzer extends Component {
try {
Utils.startScript(Global.TempDirectory, Global.ComponentsDirectory, "analyzer",
"java -jar -Dprism.order=sw "+ Utils.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort());
"java -jar -Dprism.order=sw "+ CommonUtils.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort());
//-
} catch (Exception ex) {
ex.printStackTrace();

View File

@@ -1,4 +1,6 @@
package Repository.Component.Sapfor;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Current;
import _VisualDVM.Global;
@@ -137,7 +139,7 @@ public abstract class Sapfor extends OSDComponent {
Visualizer_2.UnpackVersionInfo(this, getResult());
} catch (Exception e) {
Global.Log.PrintException(e);
UI.Error("Не удалось получить версию компонента " + Utils.DQuotes(getComponentType().getDescription()));
UI.Error("Не удалось получить версию компонента " + CommonUtils.DQuotes(getComponentType().getDescription()));
}
}
public abstract String getUpdateCommand();
@@ -165,9 +167,9 @@ public abstract class Sapfor extends OSDComponent {
RunAnalysis("SPF_StatisticAnalyzer",
-1,
"",
Utils.DQuotes(src.getAbsolutePath()) +
CommonUtils.DQuotes(src.getAbsolutePath()) +
" "
+ Utils.DQuotes(dst.getAbsolutePath())
+ CommonUtils.DQuotes(dst.getAbsolutePath())
);
}
public void Restart() throws Exception {
@@ -181,7 +183,7 @@ public abstract class Sapfor extends OSDComponent {
public void cd(File directory_in) throws Exception {
if (RunAnalysis("SPF_ChangeDirectory", -1, directory_in.getAbsolutePath(), "") != 0)
throw new PassException("Sapfor: Не удалось перейти в папку "
+ Utils.Brackets(directory_in.getAbsolutePath()) +
+ CommonUtils.Brackets(directory_in.getAbsolutePath()) +
"\n" + "Код возврата: " + getErrorCode());
}
public String getResult() {
@@ -253,7 +255,7 @@ public abstract class Sapfor extends OSDComponent {
}
} else if (z == 1) file_text = sub;
else if (z == 2) {
ModifiedFiles.put(Utils.toW(sub), file_text);
ModifiedFiles.put(CommonUtils.toW(sub), file_text);
file_text = null;
}
codeIdx += count;
@@ -444,7 +446,7 @@ public abstract class Sapfor extends OSDComponent {
Vector<String> resultLines
) throws Exception {
Process process = null;
int exit_code = Constants.Nan;
int exit_code = CommonConstants.Nan;
//---
File data_workspace = new File(workspace, Constants.data);
Utils.CheckDirectory(data_workspace);
@@ -455,14 +457,14 @@ public abstract class Sapfor extends OSDComponent {
//---
File file = new File(data_workspace, name + (Global.isWindows ? ".bat" : ".sh"));
FileUtils.write(file,
Utils.DQuotes(sapfor_drv)
CommonUtils.DQuotes(sapfor_drv)
+ (flags.isEmpty() ? "" : (" " + flags))
+ " -noLogo"
+ " " + command +
" 1>" +
Utils.DQuotes(outputFile.getAbsolutePath()) +
CommonUtils.DQuotes(outputFile.getAbsolutePath()) +
" 2>" +
Utils.DQuotes(errorsFile.getAbsolutePath()),
CommonUtils.DQuotes(errorsFile.getAbsolutePath()),
Charset.defaultCharset());
if (!file.setExecutable(true))
throw new Exception("Не удалось сделать файл скрипта " + name + " исполняемым!");
@@ -557,7 +559,7 @@ public abstract class Sapfor extends OSDComponent {
return false;
}
public static int readVersionFromCode(File versionFile) {
int res = Constants.Nan;
int res = CommonConstants.Nan;
if (versionFile.exists()) {
try {
List<String> data = FileUtils.readLines(versionFile);

View File

@@ -1,4 +1,5 @@
package Repository.Component;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.UI.UI;
import Common_old.Utils.Utils;
@@ -119,7 +120,7 @@ public class Visualizer_2 extends OSDComponent {
case "NOT_FOUND":
case "WRONG":
case "SEG_FAULT":
throw new PassException("Команда серверу SAPFOR вернула " + Utils.Brackets(response));
throw new PassException("Команда серверу SAPFOR вернула " + CommonUtils.Brackets(response));
default:
break;
}

View File

@@ -1,4 +1,5 @@
package Repository;
import Common.Utils.CommonUtils;
import Common_old.Utils.Utils;
import Repository.Server.ServerCode;
import Repository.Server.ServerExchangeUnit_2021;
@@ -21,7 +22,7 @@ public abstract class RepositoryClient {
try {
if (isPrintOn()) {
FileWriter testLog = new FileWriter(getClass().getSimpleName() + "_Log.txt", true);
String dmessage = Utils.Brackets(new Date()) + " " + message;
String dmessage = CommonUtils.Brackets(new Date()) + " " + message;
System.out.println(dmessage);
testLog.write(dmessage + "\n");
testLog.close();
@@ -59,7 +60,7 @@ public abstract class RepositoryClient {
return ServerCommand(code_in, "", null);
}
protected void ServerConnectionError(ServerCode code_in, String logText) throws Exception {
throw new PassException(Utils.Brackets(new Date().toString())+" Ошибка взаимодействия с сервером " + code_in);
throw new PassException(CommonUtils.Brackets(new Date().toString())+" Ошибка взаимодействия с сервером " + code_in);
}
public abstract void perform() throws Exception;
public void Perform(){

View File

@@ -1,4 +1,5 @@
package Repository;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common.Database.Objects.DBObject;
import Common.Database.Database;
@@ -73,7 +74,7 @@ public abstract class RepositoryServer<D extends Database> {
if (printOn) {
try {
Log = new FileWriter("Log.txt", true);
String dmessage = Utils.Brackets("SESSION -> ") + new Date() +
String dmessage = CommonUtils.Brackets("SESSION -> ") + new Date() +
" " + message;
Log.write(dmessage + "\n");
Log.close();
@@ -150,7 +151,7 @@ public abstract class RepositoryServer<D extends Database> {
Transport.send(message);
done = true;
} catch (Exception ex) {
System.out.println("Исключение во время отправки сообщения абоненту " + Utils.Brackets(target));
System.out.println("Исключение во время отправки сообщения абоненту " + CommonUtils.Brackets(target));
ex.printStackTrace();
Utils.sleep(1000);
} finally {
@@ -209,17 +210,17 @@ public abstract class RepositoryServer<D extends Database> {
switch (code) {
//<editor-fold desc="файлы и почта">
case ReadFile:
Print("Отправить клиенту текст файла по пути " + Utils.Brackets(request.arg));
Print("Отправить клиенту текст файла по пути " + CommonUtils.Brackets(request.arg));
response = new ServerExchangeUnit_2021(ServerCode.OK, "", Utils.ReadAllText(new File(request.arg)));
break;
case SendFile:
//нам пришел файл.
Print("Получить от клиента файл, и распаковать его по пути " + Utils.Brackets(request.arg));
Print("Получить от клиента файл, и распаковать его по пути " + CommonUtils.Brackets(request.arg));
request.Unpack(); //распаковка идет по его аргу-пути назначения
response = new ServerExchangeUnit_2021(ServerCode.OK);
break;
case ReceiveFile:
Print("Отправить клиенту файл по пути " + Utils.Brackets(request.arg));
Print("Отправить клиенту файл по пути " + CommonUtils.Brackets(request.arg));
response = new ServerExchangeUnit_2021(ServerCode.OK);
File file = new File(request.arg);
response.object = file.exists() ? Utils.packFile(file) : null;

View File

@@ -1,5 +1,6 @@
package Repository.Server;
import Common.Database.Objects.DBObject;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import GlobalData.Account.Account;
@@ -307,14 +308,14 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
File program = Paths.get(project.getAbsolutePath(), fileName).toFile();
//--
File convertedProgram = Paths.get(program.getParent(),
Utils.getFileNameWithoutExtension(program) + ".DVMH." +
CommonUtils.getFileNameWithoutExtension(program) + ".DVMH." +
(projectLanguage.equals(LanguageName.fortran) ? "f" : "c")
).toFile();
String command =
Utils.DQuotes(server_dvm_drv) + " " +
CommonUtils.DQuotes(server_dvm_drv) + " " +
projectLanguage.getDVMCompile() + "dv " +
options + " "
+ Utils.DQuotes(program.getName());
+ CommonUtils.DQuotes(program.getName());
//--
File fileWorkspace = program.getParentFile();
Process process = Utils.startScript(workspace, fileWorkspace, Utils.getDateName("convert_script"), command);

View File

@@ -1,4 +1,5 @@
package Repository.Server;
import Common.Utils.CommonUtils;
import Common_old.Utils.Utils;
import java.io.File;
@@ -35,7 +36,7 @@ public class ServerExchangeUnit_2021 implements Serializable {
Utils.unpackFile((byte[]) object, file);
}
public void Print() {
System.out.println("codeName=" + Utils.Brackets(codeName));
System.out.println("codeName=" + CommonUtils.Brackets(codeName));
System.out.println(arg);
}
}

View File

@@ -1,4 +1,5 @@
package Repository.Subscribes.UI;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.UI.UI;
import Common_old.UI.Windows.Dialog.DBObjectDialog;
@@ -25,7 +26,7 @@ public class SubscriberForm extends DBObjectDialog<Subscriber, SubscriberFields>
if (fields.tfAddress.getText().isEmpty())
Log.Writeln_("Адрес электронной почты не может быть пустым");
if (!title_text.equals("Регистрация") && (fields.tfAddress.isEditable() && Global.componentsServer.db.subscribers.Data.containsKey(fields.tfAddress.getText()))) {
Log.Writeln_("Адрес электронной почты " + Utils.Brackets(fields.tfAddress.getText()) + " уже есть в списке.");
Log.Writeln_("Адрес электронной почты " + CommonUtils.Brackets(fields.tfAddress.getText()) + " уже есть в списке.");
}
}
@Override

View File

@@ -1,4 +1,5 @@
package TestingSystem.Common.Group;
import Common.Utils.CommonUtils;
import Common_old.Current;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.riDBObject;
@@ -65,7 +66,7 @@ public class Group extends riDBObject {
int i = 1;
for (ProjectFile program : programs.get(language)) {
//--
String object = Utils.DQuotes(language + "_" + i + ".o");
String object = CommonUtils.DQuotes(language + "_" + i + ".o");
module_objects.add(object);
module_body +=
object + ":\n" +
@@ -82,7 +83,7 @@ public class Group extends riDBObject {
++i;
}
titles.add(String.join("\n",
LANG_ + "COMMAND=" + Utils.DQuotes(dvm_drv) + " " +
LANG_ + "COMMAND=" + CommonUtils.DQuotes(dvm_drv) + " " +
language.getDVMCompile(),
LANG_ + "FLAGS=" + flags_in,
LANG_ + "OBJECTS=" + String.join(" ", module_objects),
@@ -98,12 +99,12 @@ public class Group extends riDBObject {
Vector<String> titles = new Vector<>();
Vector<String> objects = new Vector<>();
Vector<String> bodies = new Vector<>();
String binary = Utils.DQuotes("0");
String binary = CommonUtils.DQuotes("0");
//----->>
generateForLanguage(dvm_drv, programs, language, titles, objects, bodies, flags_in);
//----->>
return String.join("\n",
"LINK_COMMAND=" + Utils.DQuotes(dvm_drv) + " " +
"LINK_COMMAND=" + CommonUtils.DQuotes(dvm_drv) + " " +
language.getDVMLink(),
"LINK_FLAGS=" + flags_in + "\n",
String.join("\n", titles),

View File

@@ -1,4 +1,5 @@
package TestingSystem.Common.MachineProcess;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Current;
@@ -15,7 +16,7 @@ import java.util.Vector;
public class MachineProcess extends DBObject {
public String id = "";
public String machineAddress = "";
public int machinePort = Constants.Nan;
public int machinePort = CommonConstants.Nan;
public String userName = "";
public String userPassword = "";
public String userWorkspace = "";
@@ -104,13 +105,13 @@ public class MachineProcess extends DBObject {
Current.Mode.MachineQueue;
CommonUtils.jsonToFile(properties, new File(workspace, "properties"));
Vector<String> args = new Vector<>();
args.add(Utils.DQuotes(machineAddress));
args.add(Utils.DQuotes(machinePort));
args.add(Utils.DQuotes(userName));
args.add(Utils.DQuotes(userPassword));
args.add(Utils.DQuotes(userWorkspace));
args.add(Utils.DQuotes(testingSystemRoot));
args.add(Utils.DQuotes(Global.testingServer.name));
args.add(CommonUtils.DQuotes(machineAddress));
args.add(CommonUtils.DQuotes(machinePort));
args.add(CommonUtils.DQuotes(userName));
args.add(CommonUtils.DQuotes(userPassword));
args.add(CommonUtils.DQuotes(userWorkspace));
args.add(CommonUtils.DQuotes(testingSystemRoot));
args.add(CommonUtils.DQuotes(Global.testingServer.name));
//--
Utils.startScript(workspace, workspace,
"start",

View File

@@ -1,5 +1,5 @@
package TestingSystem.Common.Test;
import Common_old.Constants;
import Common.CommonConstants;
import Common_old.Current;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.riDBObject;
@@ -27,7 +27,7 @@ public class Test extends riDBObject {
@Description("DEFAULT ''")
public String args = ""; //аргументы командной строки. на всякий случай поле зарезервирую. пусть будут.
@Description("DEFAULT -1")
public int group_id = Constants.Nan;
public int group_id = CommonConstants.Nan;
@Override
public void SynchronizeFields(DBObject src) {
super.SynchronizeFields(src);

View File

@@ -1,8 +1,8 @@
package TestingSystem.Common.TestingPackageToKill;
import Common_old.Constants;
import Common.CommonConstants;
import Common.Database.Objects.iDBObject;
public class TestingPackageToKill extends iDBObject {
public int packageId = Constants.Nan;
public int packageId = CommonConstants.Nan;
public int type = 0; // 0 - dvm /1 - sapfor
public TestingPackageToKill() {
}

View File

@@ -1,4 +1,6 @@
package TestingSystem.Common;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common_old.Current;
import _VisualDVM.Global;
@@ -62,7 +64,7 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
if (testingPackage.needsEmail == 1) {
EmailMessage message = new EmailMessage();
message.subject = "Состояние пакета тестирования "+packageDescription()+ " "+
Utils.Brackets(testingPackage.id) + " изменилось на " + Utils.Brackets(testingPackage.state.getDescription());
CommonUtils.Brackets(testingPackage.id) + " изменилось на " + CommonUtils.Brackets(testingPackage.state.getDescription());
message.text = testingPackage.description;
message.targets.add(testingPackage.sender_address);
ServerCommand(ServerCode.Email, message);
@@ -108,7 +110,7 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
try {
if (Connect()) {
int ptk_id = (int) ServerCommand(getCheckIfNeedsKillCode(), testingPackage.id);
if (ptk_id != Constants.Nan) {
if (ptk_id != CommonConstants.Nan) {
Print("package " + testingPackage.id + " NEEDS TO KILL");
Kill();
UpdatePackageState(TasksPackageState.Aborted);
@@ -215,12 +217,12 @@ public abstract class TestingPlanner<P extends TestingPackage> extends Repositor
machine = new Machine(machineAddress, machineAddress, machinePort, MachineType.Server);
user = new User(userName, userPassword, userWorkspace);
//---
Print("machineAddress=" + Utils.Brackets(machineAddress));
Print("machinePort=" + Utils.Brackets(String.valueOf(machinePort)));
Print("userName=" + Utils.Brackets(userName));
Print("userPassword=" + Utils.Brackets(userPassword));
Print("userWorkspace=" + Utils.Brackets(userWorkspace));
Print("root=" + Utils.Brackets(Global.Home));
Print("machineAddress=" + CommonUtils.Brackets(machineAddress));
Print("machinePort=" + CommonUtils.Brackets(String.valueOf(machinePort)));
Print("userName=" + CommonUtils.Brackets(userName));
Print("userPassword=" + CommonUtils.Brackets(userPassword));
Print("userWorkspace=" + CommonUtils.Brackets(userWorkspace));
Print("root=" + CommonUtils.Brackets(Global.Home));
Print("serverName=" + serverName);
Print("=====");
//----

View File

@@ -1,4 +1,5 @@
package TestingSystem.Common;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common.Database.Objects.DBObject;
@@ -127,7 +128,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
public TestingServer() {
super(TestsDatabase.class);
name = Utils.getDateName("testingServer");
System.out.println("ServerName=" + Utils.Brackets(name));
System.out.println("ServerName=" + CommonUtils.Brackets(name));
}
//основа
@Override
@@ -178,7 +179,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
EmailMessage message = Log.isEmpty() ?
new EmailMessage(
"Запущено автоматическое тестирование версии " + request.arg + " системы SAPFOR",
"Пакет "+ Utils.Brackets(autoPackage.id), new Vector<>()) :
"Пакет "+ CommonUtils.Brackets(autoPackage.id), new Vector<>()) :
new EmailMessage(
"Не удалось запустить автоматическое тестирование версии " + request.arg + " системы SAPFOR",
Log.toString(),
@@ -295,7 +296,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
pathname.isFile()
&& !pathname.getName().equals("settings")
&& !pathname.getName().equals("test-analyzer.sh")
&& Utils.getExtension(pathname).startsWith(languageName.getDVMCompile()));
&& CommonUtils.getExtension(pathname).startsWith(languageName.getDVMCompile()));
;
if (files != null) {
groupFiles = new Vector<>(Arrays.asList(files));
@@ -392,7 +393,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
}
private void DVMPackageNeedsKill() {
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = Constants.Nan;
response.object = CommonConstants.Nan;
int packageId = (int) request.object;
for (TestingPackageToKill packageToKill : db.testingPackagesToKill.Data.values()) {
if ((packageToKill.packageId == packageId) && (packageToKill.type == 0)) {
@@ -403,7 +404,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
}
private void SapforPackageNeedsKill() throws Exception {
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = Constants.Nan;
response.object = CommonConstants.Nan;
int packageId = (int) request.object;
for (TestingPackageToKill packageToKill : db.testingPackagesToKill.Data.values()) {
if ((packageToKill.packageId == packageId) && (packageToKill.type == 1)) {
@@ -483,11 +484,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
Vector<DVMPackage_json> jsons = new Vector<>();
for (int package_id : packages_ids) {
if (!db.dvmPackages.containsKey(package_id))
throw new RepositoryRefuseException("Пакета задач DVM " + Utils.Brackets(package_id) + " не существует.");
throw new RepositoryRefuseException("Пакета задач DVM " + CommonUtils.Brackets(package_id) + " не существует.");
DVMPackage dvmPackage = db.dvmPackages.get(package_id);
File json = dvmPackage.getJsonFile();
if (!json.exists())
throw new RepositoryRefuseException("Не найден JSON файл для пакета задач DVM " + Utils.Brackets(package_id));
throw new RepositoryRefuseException("Не найден JSON файл для пакета задач DVM " + CommonUtils.Brackets(package_id));
jsons.add((DVMPackage_json) CommonUtils.jsonFromFile(json, DVMPackage_json.class));
}
response = new ServerExchangeUnit_2021(ServerCode.OK);
@@ -498,11 +499,11 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
Vector<SapforPackage_json> jsons = new Vector<>();
for (int package_id : packages_ids) {
if (!db.sapforPackages.containsKey(package_id))
throw new RepositoryRefuseException("Пакета задач SAPFOR " + Utils.Brackets(package_id) + " не существует.");
throw new RepositoryRefuseException("Пакета задач SAPFOR " + CommonUtils.Brackets(package_id) + " не существует.");
SapforPackage sapforPackage = db.sapforPackages.get(package_id);
File json = sapforPackage.getJsonFile();
if (!json.exists())
throw new RepositoryRefuseException("Не найден JSON файл для пакета задач SAPFOR " + Utils.Brackets(package_id));
throw new RepositoryRefuseException("Не найден JSON файл для пакета задач SAPFOR " + CommonUtils.Brackets(package_id));
jsons.add((SapforPackage_json) CommonUtils.jsonFromFile(json, SapforPackage_json.class));
}
response = new ServerExchangeUnit_2021(ServerCode.OK);
@@ -562,7 +563,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
Global.TempDirectory,
"get_version",
"wget --user dvmhuser --password dvmh2013 -P " +
Utils.DQuotes(Global.TempDirectory.getAbsolutePath()) +
CommonUtils.DQuotes(Global.TempDirectory.getAbsolutePath()) +
" http://svn.dvm-system.org/svn/dvmhrepo/sapfor/experts/Sapfor_2017/_src/Utils/version.h"
).waitFor();
if (!versionFile.exists())
@@ -582,7 +583,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
Global.TempDirectory,
"get_version",
"wget --user dvmhuser --password dvmh2013 -P " +
Utils.DQuotes(Global.TempDirectory.getAbsolutePath()) +
CommonUtils.DQuotes(Global.TempDirectory.getAbsolutePath()) +
" http://svn.dvm-system.org/svn/dvmhrepo/sapfor/experts/Sapfor_2017/_src/Utils/version.h"
).waitFor();
if (!versionFile.exists())

View File

@@ -1,4 +1,6 @@
package TestingSystem.Common;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import Common.Database.SQLITE.SQLiteDatabase;
import _VisualDVM.Global;
@@ -194,7 +196,7 @@ public class TestsDatabase extends SQLiteDatabase {
if (Sapfor.getMinMaxDim(Sapfor.getTempCopy(new File(sapfor.call_command)), tempProject, test)) {
Update(test);
} else
throw new RepositoryRefuseException("Не удалось определить размерность теста " + Utils.Brackets(test.description));
throw new RepositoryRefuseException("Не удалось определить размерность теста " + CommonUtils.Brackets(test.description));
break;
case c:
test.max_dim = Utils.getCTestMaxDim(testFile);
@@ -222,12 +224,12 @@ public class TestsDatabase extends SQLiteDatabase {
if (oldGroup == null) {
Insert(group);
for (File file : files) {
String testDescription = Utils.getNameWithoutExtension(file.getName()) + "_" + group.language.getDVMCompile();
String testDescription = CommonUtils.getNameWithoutExtension(file.getName()) + "_" + group.language.getDVMCompile();
CreateTestFromSingleFile(account, sapfor, group, file, testDescription);
}
} else {
for (File file : files) {
String testDescription = Utils.getNameWithoutExtension(file.getName()) + "_" + group.language.getDVMCompile();
String testDescription = CommonUtils.getNameWithoutExtension(file.getName()) + "_" + group.language.getDVMCompile();
Test oldTest = tests.getTestByDescription(oldGroup.id, testDescription);
if (oldTest == null) {
CreateTestFromSingleFile(account, sapfor, oldGroup, file, testDescription);
@@ -287,10 +289,10 @@ public class TestsDatabase extends SQLiteDatabase {
}
public Integer getInstalledSapforMaxVersion() {
int max_version = Constants.Nan;
int max_version = CommonConstants.Nan;
for (ServerSapfor sapfor : serverSapfors.Data.values()) {
if (sapfor.state.equals(ServerSapforState.Done)) {
int version = Constants.Nan;
int version = CommonConstants.Nan;
try {
version = Integer.parseInt(sapfor.version);
} catch (Exception ex) {

View File

@@ -1,5 +1,5 @@
package TestingSystem.DVM.DVMPackage;
import Common_old.Constants;
import Common.CommonConstants;
import Common_old.Current;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
@@ -38,7 +38,7 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
Compiler compiler,
Vector<DVMConfiguration> configurations,
int neeedsEmail_in) {
id = Constants.Nan;
id = CommonConstants.Nan;
//-
sender_name = account.name;
sender_address = account.email;

View File

@@ -1,5 +1,5 @@
package TestingSystem.DVM.DVMTasks;
import Common_old.Utils.Utils;
import Common.Utils.CommonUtils;
import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Test.Test;
import TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
@@ -36,9 +36,9 @@ public class DVMCompilationTask extends DVMTask {
public static String checkEnvironments(String environmentsSet_in) {
if (!environmentsSet_in.contains("DVMH_NO_DIRECT_COPY")) {
if (environmentsSet_in.isEmpty())
return "DVMH_NO_DIRECT_COPY=" + Utils.DQuotes("1");
return "DVMH_NO_DIRECT_COPY=" + CommonUtils.DQuotes("1");
else
return environmentsSet_in + " " + "DVMH_NO_DIRECT_COPY=" + Utils.DQuotes("1");
return environmentsSet_in + " " + "DVMH_NO_DIRECT_COPY=" + CommonUtils.DQuotes("1");
} else
return environmentsSet_in;
}

View File

@@ -1,4 +1,5 @@
package TestingSystem.DVM.DVMTasks;
import Common.CommonConstants;
import Common_old.Constants;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
@@ -16,7 +17,7 @@ import java.nio.file.Paths;
import java.util.Vector;
public class DVMRunTask extends DVMTask {
@Expose
public int dvmcompilationtask_id = Constants.Nan;
public int dvmcompilationtask_id = CommonConstants.Nan;
@Expose
public String matrix = "";
@Expose

View File

@@ -1,4 +1,5 @@
package TestingSystem.DVM.DVMTasks;
import Common.CommonConstants;
import Common_old.Constants;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.iDBObject;
@@ -17,13 +18,13 @@ import java.nio.file.Paths;
import java.util.Vector;
public class DVMTask extends iDBObject {
@Expose
public int dvm_package_id = Constants.Nan;
public int dvm_package_id = CommonConstants.Nan;
@Expose
public int group_id = Constants.Nan;
public int group_id = CommonConstants.Nan;
@Expose
public String group_description = "";
@Expose
public int test_id = Constants.Nan;
public int test_id = CommonConstants.Nan;
@Expose
public String test_description = "";
@Expose
@@ -85,7 +86,7 @@ public class DVMTask extends iDBObject {
}
public String getResultFile(File resultFile) {
String res = "";
if (dvm_package_id == Constants.Nan) res = "задача ещё не выполнялась";
if (dvm_package_id == CommonConstants.Nan) res = "задача ещё не выполнялась";
else {
if (resultFile.exists()) {
try {

View File

@@ -1,4 +1,5 @@
package TestingSystem.DVM;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
import GlobalData.Tasks.TaskState;
@@ -61,12 +62,12 @@ public abstract class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
int i = 1;
for (ProjectFile program : language_programs) {
//--
String object = Utils.DQuotes(language + "_" + i + ".o");
String object = CommonUtils.DQuotes(language + "_" + i + ".o");
module_objects.add(object);
module_body += object + ":\n" + "\t" + String.join(" ", Utils.MFVar(LANG_ + "COMMAND"), Utils.MFVar(LANG_ + "FLAGS"), program.getStyleOptions(), "-c", program.getQSourceName(), "-o", object + "\n\n");
++i;
}
titles.add(String.join("\n", LANG_ + "COMMAND=" + Utils.DQuotes(dvm_drv) + " " + language.getDVMCompile(), LANG_ + "FLAGS=" + flags, LANG_ + "OBJECTS=" + String.join(" ", module_objects), ""));
titles.add(String.join("\n", LANG_ + "COMMAND=" + CommonUtils.DQuotes(dvm_drv) + " " + language.getDVMCompile(), LANG_ + "FLAGS=" + flags, LANG_ + "OBJECTS=" + String.join(" ", module_objects), ""));
objects.add(Utils.MFVar(LANG_ + "OBJECTS"));
bodies.add(module_body);
}
@@ -77,13 +78,13 @@ public abstract class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
Vector<String> titles = new Vector<>();
Vector<String> objects = new Vector<>();
Vector<String> bodies = new Vector<>();
String binary = Utils.DQuotes("0");
String binary = CommonUtils.DQuotes("0");
//----->>
for (LanguageName languageName : programs.keySet()) {
generateForLanguage(dvm_drv, languageName, programs.get(languageName), titles, objects, bodies, flags);
}
//----->>
return String.join("\n", "LINK_COMMAND=" + Utils.DQuotes(dvm_drv) + " " + test_language.getDVMLink(), "LINK_FLAGS=" + flags + "\n", String.join("\n", titles), "all: " + binary, binary + " : " + String.join(" ", objects), "\t" + Utils.MFVar("LINK_COMMAND") + " " + Utils.MFVar("LINK_FLAGS") + " " + String.join(" ", objects) + " -o " + binary, String.join(" ", bodies));
return String.join("\n", "LINK_COMMAND=" + CommonUtils.DQuotes(dvm_drv) + " " + test_language.getDVMLink(), "LINK_FLAGS=" + flags + "\n", String.join("\n", titles), "all: " + binary, binary + " : " + String.join(" ", objects), "\t" + Utils.MFVar("LINK_COMMAND") + " " + Utils.MFVar("LINK_FLAGS") + " " + String.join(" ", objects) + " -o " + binary, String.join(" ", bodies));
}
public void getTasksInfo(List<? extends DVMTask> tasks, String file_name) throws Exception {
LinkedHashMap<Integer, DVMTask> sorted_tasks = new LinkedHashMap<>();
@@ -137,16 +138,16 @@ public abstract class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
public void perform() throws Exception {
Print("Проверка сервера...");
String currentServerName = (String) ServerCommand(ServerCode.GetServerName);
Print("имя текущего сервера " + Utils.Brackets(currentServerName));
Print("имя сервера, создавшего нить " + Utils.Brackets(serverName));
Print("имя текущего сервера " + CommonUtils.Brackets(currentServerName));
Print("имя сервера, создавшего нить " + CommonUtils.Brackets(serverName));
if (!serverName.equals(currentServerName)) {
Finalize("Несоответствующий сервер");
}
Print("Запрос активных пакетов для машины " + Utils.Brackets(machine.getURL()));
Print("Запрос активных пакетов для машины " + CommonUtils.Brackets(machine.getURL()));
testingPackage = null;
Vector<DVMPackage> activePackages = (Vector<DVMPackage>) ServerCommand(getActivePackagesCode(), machine.getURL(), null);
if (activePackages.isEmpty())
Finalize("Не найдено активных пакетов для машины " + Utils.Brackets(machine.getURL()));
Finalize("Не найдено активных пакетов для машины " + CommonUtils.Brackets(machine.getURL()));
for (DVMPackage activePackage : activePackages)
PerformPackage(activePackage);
}

View File

@@ -1,4 +1,5 @@
package TestingSystem.DVM;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
@@ -171,11 +172,11 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
@Override
protected void PackageStart() throws Exception {
String plannerStartCommand = String.join(" ",
Utils.DQuotes(getPlanner()),
Utils.DQuotes(user.workspace),
Utils.DQuotes(packageRemoteWorkspace.full_name),
Utils.DQuotes(testingPackage.kernels),
Utils.DQuotes(testingPackage.drv));
CommonUtils.DQuotes(getPlanner()),
CommonUtils.DQuotes(user.workspace),
CommonUtils.DQuotes(packageRemoteWorkspace.full_name),
CommonUtils.DQuotes(testingPackage.kernels),
CommonUtils.DQuotes(testingPackage.drv));
user.connection.startShellProcess(packageRemoteWorkspace, "planner_output",
"ulimit -s unlimited", plannerStartCommand);
//---
@@ -186,7 +187,7 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
}
testingPackage.PID = user.connection.readFromFile(PID).replace("\n", "").replace("\r", "");
//---
System.out.println("PID=" + Utils.Brackets(testingPackage.PID));
System.out.println("PID=" + CommonUtils.Brackets(testingPackage.PID));
RemoteFile STARTED = new RemoteFile(packageRemoteWorkspace, "STARTED");
while (!user.connection.Exists(STARTED)) {
Print("waiting for package start...");
@@ -233,7 +234,7 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
Utils.CheckDirectory(packageLocalWorkspace);
RemoteFile remote_results_archive = new RemoteFile(packageRemoteWorkspace, "results.zip");
File results_archive = new File(packageLocalWorkspace, "results.zip");
user.connection.performScript(packageRemoteWorkspace, "zip -r " + Utils.DQuotes("results.zip") + " " + Utils.DQuotes("results"));
user.connection.performScript(packageRemoteWorkspace, "zip -r " + CommonUtils.DQuotes("results.zip") + " " + CommonUtils.DQuotes("results"));
//---
if (user.connection.Exists(remote_results_archive)) {
user.connection.getSingleFile(remote_results_archive.full_name, results_archive.getAbsolutePath());

View File

@@ -1,4 +1,6 @@
package TestingSystem.DVM;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
@@ -118,7 +120,7 @@ public class UserConnection {
if ((maxSize == 0) || getFileKBSize(src.full_name) <= maxSize) {
getSingleFile(src.full_name, dst.getAbsolutePath());
} else {
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + Utils.Brackets(src.full_name));
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + CommonUtils.Brackets(src.full_name));
}
}
public void putSingleFile(File src, RemoteFile dst) throws Exception {
@@ -131,8 +133,8 @@ public class UserConnection {
//-
public void RMDIR(String dir) throws Exception {
if (!dir.isEmpty() && !dir.equals("/") && !dir.equals("\\") && !dir.equals("*")) {
Command("rm -rf " + Utils.DQuotes(dir));
} else throw new PassException("Недопустимый путь для удаления папки " + Utils.DQuotes(dir));
Command("rm -rf " + CommonUtils.DQuotes(dir));
} else throw new PassException("Недопустимый путь для удаления папки " + CommonUtils.DQuotes(dir));
}
//-
public void SynchronizeSubDirsR(File local_dir, RemoteFile remote_dir) throws Exception {
@@ -220,9 +222,9 @@ public class UserConnection {
sftpChannel.rm(file.full_name);
}
//--
writeToFile("cd " + Utils.DQuotes(directory.full_name) + "\n" + String.join("\n", commands), script_file);
writeToFile("cd " + CommonUtils.DQuotes(directory.full_name) + "\n" + String.join("\n", commands), script_file);
//--
Command(Utils.DQuotes(script_file.full_name) + " 1>" + Utils.DQuotes(out.full_name) + " 2>" + Utils.DQuotes(err.full_name));
Command(CommonUtils.DQuotes(script_file.full_name) + " 1>" + CommonUtils.DQuotes(out.full_name) + " 2>" + CommonUtils.DQuotes(err.full_name));
return new Pair<>(out, err);
}
public void putResource(RemoteFile dstDirectory, String resource_name) throws Exception {
@@ -232,7 +234,7 @@ public class UserConnection {
}
boolean compileModule(RemoteFile modulesDirectory, String module_name) throws Exception {
String flags = module_name.equals("planner") ? getAvailibleCPPStandard(modulesDirectory) : "";
String command = "g++ -O3 " + flags + " " + Utils.DQuotes(module_name + ".cpp") + " -o " + Utils.DQuotes(module_name);
String command = "g++ -O3 " + flags + " " + CommonUtils.DQuotes(module_name + ".cpp") + " -o " + CommonUtils.DQuotes(module_name);
RemoteFile binary = new RemoteFile(modulesDirectory, module_name);
//--
if (Exists(binary))
@@ -302,7 +304,7 @@ public class UserConnection {
getSingleFile(src.full_name, dst.getAbsolutePath());
return true;
} else {
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + Utils.Brackets(src.full_name));
Utils.WriteToFile(dst, "Размер файла превышает " + maxSize + " KB.\n" + "Файл не загружен. Его можно просмотреть на машине по адресу\n" + CommonUtils.Brackets(src.full_name));
}
}
return false;
@@ -379,7 +381,7 @@ public class UserConnection {
BufferedReader in = new BufferedReader(new InputStreamReader(execChannel.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(Utils.Brackets(line));
System.out.println(CommonUtils.Brackets(line));
}
}
execChannel.disconnect();
@@ -466,10 +468,10 @@ public class UserConnection {
}
public String startShellProcess(RemoteFile directory, String outFileName, String... commands) throws Exception {
Vector<String> commands_ = new Vector<>();
commands_.add("cd " + Utils.DQuotes(directory.full_name));
commands_.add("cd " + CommonUtils.DQuotes(directory.full_name));
for (int i = 0; i < commands.length; ++i) {
if (i == commands.length - 1) {
commands_.add(commands[i] + " 1>" + Utils.DQuotes(outFileName));
commands_.add(commands[i] + " 1>" + CommonUtils.DQuotes(outFileName));
} else {
commands_.add(commands[i]);
}
@@ -478,7 +480,7 @@ public class UserConnection {
if (Exists(script_file))
sftpChannel.rm(script_file.full_name);
writeToFile(String.join("\n", commands_), script_file);
String start_command = Utils.DQuotes(script_file.full_name);
String start_command = CommonUtils.DQuotes(script_file.full_name);
//--
RemoteFile outFile = new RemoteFile(directory, outFileName);
if (Exists(outFile))
@@ -522,7 +524,7 @@ public class UserConnection {
public String CheckModulesVersion() throws Exception {
RemoteFile modulesDirectory = new RemoteFile(user.workspace, "modules");
RemoteFile version = new RemoteFile(modulesDirectory, "version.h");
int current_version = Constants.Nan;
int current_version = CommonConstants.Nan;
int actual_version = Constants.planner_version;
if (Exists(version)) {
try {

View File

@@ -1,5 +1,5 @@
package TestingSystem.SAPFOR.Json;
import Common_old.Constants;
import Common.CommonConstants;
import TestingSystem.SAPFOR.SapforSettings.SapforSettings;
import Visual_DVM_2021.Passes.PassCode_2021;
import com.google.gson.annotations.Expose;
@@ -10,7 +10,7 @@ import java.util.Vector;
//на самом деле уже settings. конфиграция = группы + параметры
public class SapforConfiguration_json implements Serializable {
@Expose
public int id = Constants.Nan;
public int id = CommonConstants.Nan;
@Expose
public String name = "";
@Expose

View File

@@ -1,5 +1,5 @@
package TestingSystem.SAPFOR.Json;
import Common_old.Constants;
import Common.CommonConstants;
import Common_old.UI.VisualCache.SapforConfigurationCache;
import Common_old.UI.VisualCache.VisualCaches;
import TestingSystem.Common.Test.Test;
@@ -13,7 +13,7 @@ import java.util.List;
import java.util.Vector;
public class SapforTestingSet_json implements Serializable {
@Expose
public int id = Constants.Nan;
public int id = CommonConstants.Nan;
@Expose
public List<SapforTest_json> tests = new Vector<>();
@Expose

View File

@@ -1,4 +1,6 @@
package TestingSystem.SAPFOR.Json;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
@@ -54,7 +56,7 @@ public class SapforVersion_json implements Serializable {
state = SapforVersionState.Empty;
comparisonState = VersionComparisonState.Unknown;
//--
String relativePath = Global.isWindows ? Utils.toW(version) : version;
String relativePath = Global.isWindows ? CommonUtils.toW(version) : version;
Home = Paths.get(configurationRoot.getAbsolutePath(), relativePath).toFile();
files = new LinkedHashMap<>();
//--
@@ -133,7 +135,7 @@ public class SapforVersion_json implements Serializable {
public MessageError unpackMessage(String line_in) throws Exception {
MessageError res = new MessageError();
res.file = "";
res.line = Constants.Nan;
res.line = CommonConstants.Nan;
res.value = "";
String line = line_in.substring(9);
int i = 0;
@@ -250,7 +252,7 @@ public class SapforVersion_json implements Serializable {
//--
public void createProject(File rootHome) throws Exception {
project = null;
String version_ = Global.isWindows ? Utils.toW(version) : Utils.toU(version);
String version_ = Global.isWindows ? CommonUtils.toW(version) : CommonUtils.toU(version);
project = new db_project_info();
project.Home = Paths.get(rootHome.getAbsolutePath(), version_).toFile();
project.name = project.Home.getName();
@@ -303,6 +305,6 @@ public class SapforVersion_json implements Serializable {
}
@Override
public String toString() {
return Home.getName() + " : " + Utils.Brackets(description) + " файлы: " + files.size();
return Home.getName() + " : " + CommonUtils.Brackets(description) + " файлы: " + files.size();
}
}

View File

@@ -1,4 +1,5 @@
package TestingSystem.SAPFOR;
import Common.Utils.CommonUtils;
import Common_old.Constants;
import _VisualDVM.Global;
import Common_old.Utils.Utils;
@@ -71,7 +72,7 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
"transformation",
sapfor_drv,
parentTask,
code.getTestingCommand() + " -F " + Utils.DQuotes(task.getAbsolutePath()),
code.getTestingCommand() + " -F " + CommonUtils.DQuotes(task.getAbsolutePath()),
target.flags,
Constants.out_file,
Constants.err_file

View File

@@ -1,5 +1,5 @@
package TestingSystem.SAPFOR.SapforPackage;
import Common_old.Constants;
import Common.CommonConstants;
import Common_old.Current;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
@@ -21,7 +21,7 @@ import java.io.File;
import java.util.LinkedHashMap;
import java.util.Vector;
public class SapforPackage extends TestingPackage<SapforPackage_json> {
public int sapforId = Constants.Nan; // так как сапфор на машине.
public int sapforId = CommonConstants.Nan; // так как сапфор на машине.
//--------------
public SapforPackage() {
}
@@ -62,7 +62,7 @@ public class SapforPackage extends TestingPackage<SapforPackage_json> {
public SapforPackage(Account account, ServerSapfor serverSapfor, Vector<SapforConfiguration> configurations,
int neeedsEmail_in,
TextLog Log) throws Exception {
id = Constants.Nan;
id = CommonConstants.Nan;
sender_name = account.name;
sender_address = account.email;
//-

View File

@@ -1,8 +1,8 @@
package TestingSystem.SAPFOR.SapforSettings;
import Common.Database.Objects.DBObject;
import Common.Utils.CommonUtils;
import _VisualDVM.Global;
import Common.Utils.TextLog;
import Common_old.Utils.Utils;
import TestingSystem.Common.Settings.Settings;
import TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand;
import Visual_DVM_2021.Passes.PassCode_2021;
@@ -79,7 +79,7 @@ public class SapforSettings extends Settings {
if (code.isSapforStart()) {
if (i > first) {
Log.Writeln_("Неверные настройки:" + id + ": проход" +
Utils.Brackets(code.getDescription()) +
CommonUtils.Brackets(code.getDescription()) +
" может быть только первым!");
res=false;
}
@@ -87,14 +87,14 @@ public class SapforSettings extends Settings {
if (code.isSapforTerminal()) {
if (i < last) {
Log.Writeln_("Неверные настройки:" + id + ": проход " +
Utils.Brackets(code.getDescription()) +
CommonUtils.Brackets(code.getDescription()) +
" может быть только последним!");
res= false;
}
}
if (matches.contains(code)) {
Log.Writeln_("Неверные настройки:" + id + ": проход " +
Utils.Brackets(code.getDescription()) +
CommonUtils.Brackets(code.getDescription()) +
" запрещено применять более одного раза!");
res=false;
} else matches.add(code);

View File

@@ -1,5 +1,5 @@
package TestingSystem.SAPFOR.SapforSettingsCommand;
import Common_old.Constants;
import Common.CommonConstants;
import Common_old.Current;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.riDBObject;
@@ -7,7 +7,7 @@ import Visual_DVM_2021.Passes.PassCode_2021;
import com.sun.org.glassfish.gmbal.Description;
public class SapforSettingsCommand extends riDBObject {
@Description("DEFAULT -1")
public int sapforsettings_id = Constants.Nan;
public int sapforsettings_id = CommonConstants.Nan;
public PassCode_2021 passCode = PassCode_2021.SPF_RemoveDvmDirectives;
@Override
public boolean isVisible() {

Some files were not shown because too many files have changed in this diff Show More