удаление отладочной печати сравнения и не только

This commit is contained in:
2024-07-22 00:57:05 +03:00
parent 3374c9783b
commit 53ad5e637f
76 changed files with 78 additions and 328 deletions

View File

@@ -124,7 +124,6 @@ public class Utils {
.anyMatch(b -> b.equals(Character.UnicodeBlock.CYRILLIC));
}
public static void CheckDirectory(File dir) {
// System.out.println("check: "+dir);
if (!dir.exists()) {
try {
FileUtils.forceMkdir(dir);
@@ -134,7 +133,6 @@ public class Utils {
}
}
public static void CheckAndCleanDirectory(File dir) {
// System.out.println("check and clean: "+dir);
if (dir.exists()) {
File[] files = dir.listFiles();
if (files != null)
@@ -174,7 +172,6 @@ public class Utils {
}
public static double getFileSizeMegaBytes(File file) {
double res = file.length() / (1024 * 1024);
System.out.println(res);
return res;
}
public static void CleanDirectory(File dir) {
@@ -534,7 +531,6 @@ public class Utils {
public static ImageIcon getIcon(String path) {
URL imageUrl = Utils.class.getResource(path);
if (imageUrl == null) {
System.out.println("image: " + Brackets(path) + "not found");
return null;
}
return new ImageIcon(imageUrl);
@@ -542,7 +538,6 @@ public class Utils {
public static ImageIcon getTabIcon(String path) {
URL imageUrl = Utils.class.getResource(path);
if (imageUrl == null) {
System.out.println("image: " + Brackets(path) + "not found");
return null;
}
ImageIcon icon = new ImageIcon(imageUrl);
@@ -646,18 +641,13 @@ public class Utils {
throw new PassException("Не удалось удалить файл " + Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
}
public static byte[] packFile(File src) throws Exception {
System.out.println("pack begins: " + src.getAbsolutePath());
byte[] dst = Files.readAllBytes(src.toPath());
System.out.println("pack done: bytes:" + dst.length);
return dst;
}
public static void unpackFile(byte[] bytes, File dst) throws Exception {
FileOutputStream os = new FileOutputStream(dst);
System.out.println(dst.getAbsolutePath());
System.out.println("unpack begins: bytes:" + bytes.length);
os.write(bytes);
os.close();
System.out.println("unpack done to " + dst.getAbsolutePath());
}
public static Socket createClientSocket(InetAddress address, int port, int timeout) throws Exception {
Socket socket = new Socket();
@@ -692,8 +682,6 @@ public class Utils {
for (String ext : extensions) {
if (file_extension.equalsIgnoreCase(ext)) {
res.add(file);
// System.out.println(file.getAbsolutePath() + ":" + Utils.Brackets(file_extension));
// System.out.println("MATCH");
}
}
}
@@ -742,7 +730,6 @@ public class Utils {
InputStreamReader isrStdout = new InputStreamReader(stdout);
BufferedReader brStdout = new BufferedReader(isrStdout);
String line = brStdout.readLine();
System.out.println(line);
return line;
}
public static Vector<String> readAllLines(Process process) throws Exception {
@@ -752,7 +739,6 @@ public class Utils {
BufferedReader brStdout = new BufferedReader(isrStdout);
String line;
while ((line = brStdout.readLine()) != null) {
System.out.println(line);
output.add(line);
}
return output;
@@ -830,18 +816,15 @@ public class Utils {
// #pragma dvm array distribute[block][block], не важно
String packedLine = remove(pack(line).toLowerCase(), "\n", "\r", "\t");
if (packedLine.startsWith(prefix)) {
// System.out.println(n + ": " + packedLine);
packedLine = packedLine.substring(prefix.length());
boolean bracketOpen = false;
int pragmaMax = 0;
String distr = "";
for (int i = packedLine.indexOf('['); i < packedLine.length(); ++i) {
char c = packedLine.charAt(i);
// System.out.print(c);
if (bracketOpen) {
if (c == ']') {
bracketOpen = false;
// System.out.println("<DISTR>="+Utils.DQuotes(distr));
if (distr.equals("block"))
pragmaMax++;
distr = "";
@@ -856,7 +839,6 @@ public class Utils {
}
}
}
// System.out.println("< - " + pragmaMax);
fileMax = Math.max(fileMax, pragmaMax);
}
++n;
@@ -914,7 +896,6 @@ public class Utils {
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(text);
while (matcher.find()) res++;
System.out.println("matches=" + res);
} catch (Exception e) {
e.printStackTrace();
}
@@ -974,9 +955,7 @@ public class Utils {
Vector<File> sources = new Vector<>();
if (files != null) {
for (File file : files) {
// System.out.println(file.getAbsolutePath());
if (isSource(file)) {
// System.out.println(file.getAbsolutePath() + " is source!");
sources.add(file);
}
}
@@ -1030,7 +1009,6 @@ public class Utils {
old.sort((o1, o2) -> Long.compare(o2.lastModified(), o1.lastModified()));
for (int i = count - 1; i < old.size(); ++i) {
File file = old.get(i);
System.out.println(file.getName() + ":" + file.lastModified());
FileUtils.forceDelete(file);
}
}
@@ -1149,7 +1127,6 @@ public class Utils {
}
public static boolean checkFileCreation(File file) {
for (int i = 1; i <= 10; ++i) {
System.out.println("Проверка " + i + " существования файла " + Utils.Brackets(file.getAbsolutePath()));
if (file.exists()) return true;
else sleep(1000);
}
@@ -1192,32 +1169,25 @@ public class Utils {
boolean hasWrap = false;
int wi;
//------
//System.out.println("checking wrap...");
//с нуля потому что и уже увеличено.
for (int j = 0; (j < 6) && ((wi = i + j) < chars.length); ++j) {
char s = chars[wi];
// System.out.print(s);
if ((j == 0) && ((s == 'c') || (s == 'C') || (s == '!'))) {
// System.out.println("next line is FL comment");
break;
}
if ((j > 0) && (j < 5) && (s == '!')) {
// System.out.println("next line is comment");
break;
}
if ((j == 5) && (s != ' ')) {
hasWrap = true;
i = wi + 1;
// System.out.println("next line is WRAP");
break;
}
}
// System.out.println();
//-----
if (hasWrap)
break;
}
// System.out.println();
//добавление строки в результат.
if ((line.length() > 0) || Global.db.settings.get(SettingName.EmptyLinesOn).toBoolean()
// Global.db.settings.get(SettingName.SpacesOn).toBoolean()