v++
Учет настроек сравнения при сравнении пакетов сапфор
This commit is contained in:
7
.idea/workspace.xml
generated
7
.idea/workspace.xml
generated
@@ -8,9 +8,10 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Repository/Component/Visualiser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Component/Visualiser.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Repository/Component/Visualiser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Component/Visualiser.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/RemoteInitialiseUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/RemoteInitialiseUser.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforVersion_json.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforVersion_json.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/ComparisonForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/ComparisonForm.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -109,11 +110,11 @@
|
|||||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\libs" />
|
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\libs" />
|
||||||
</key>
|
</key>
|
||||||
<key name="MoveMembersDialog.RECENTS_KEY">
|
<key name="MoveMembersDialog.RECENTS_KEY">
|
||||||
|
<recent name="Common.Utils.Utils" />
|
||||||
<recent name="Repository.Component.Sapfor.Sapfor" />
|
<recent name="Repository.Component.Sapfor.Sapfor" />
|
||||||
<recent name="TestingSystem.Group.GroupsDBTable" />
|
<recent name="TestingSystem.Group.GroupsDBTable" />
|
||||||
<recent name="Common.Constants" />
|
<recent name="Common.Constants" />
|
||||||
<recent name="SapforTestingSystem.SapforTask.SapforTask" />
|
<recent name="SapforTestingSystem.SapforTask.SapforTask" />
|
||||||
<recent name="TestingSystem.TestingServer" />
|
|
||||||
</key>
|
</key>
|
||||||
<key name="MoveFile.RECENT_KEYS">
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\files" />
|
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\files" />
|
||||||
|
|||||||
@@ -1163,5 +1163,118 @@ public class Utils {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static Pair<Vector<String>, Vector<String>> getFortranLines(String text) {
|
||||||
|
Vector<String> lines = new Vector<>();
|
||||||
|
Vector<String> visible_lines = new Vector<>();
|
||||||
|
//1.прочитать весь текст.
|
||||||
|
char[] chars = text.toCharArray();
|
||||||
|
//по символам получить строки.
|
||||||
|
char c = 0; //текущий символ
|
||||||
|
int i = 0; //индекс текущего символа.
|
||||||
|
StringBuilder line = new StringBuilder(); //текущая строка
|
||||||
|
StringBuilder v_line = new StringBuilder(); //текущая строка
|
||||||
|
while (i < chars.length) {
|
||||||
|
c = chars[i];
|
||||||
|
//System.out.print("`"+c+"`");
|
||||||
|
++i;
|
||||||
|
switch (c) {
|
||||||
|
case '\r': //возврат каретки, игнор
|
||||||
|
break;
|
||||||
|
case ' ':
|
||||||
|
case '\t':
|
||||||
|
if (Global.db.settings.get(SettingName.SpacesOn).toBoolean()) line.append(c);
|
||||||
|
v_line.append(c);
|
||||||
|
break;
|
||||||
|
case '\n': //конец строки
|
||||||
|
if (Global.db.settings.get(SettingName.FortranWrapsOn).toBoolean()) {
|
||||||
|
//оракул. лезем в начало следующей строки
|
||||||
|
//и анализируем первые 5 символов
|
||||||
|
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()) {
|
||||||
|
lines.add(line.toString());
|
||||||
|
visible_lines.add(v_line.toString());
|
||||||
|
}
|
||||||
|
//сброс
|
||||||
|
line = new StringBuilder();
|
||||||
|
v_line = new StringBuilder();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
line.append(c);
|
||||||
|
v_line.append(c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((i > 0) && (c != '\n')) {
|
||||||
|
//строка оборвалась на EOF
|
||||||
|
//добавление строки в результат.
|
||||||
|
if ((line.length() > 0) || Global.db.settings.get(SettingName.EmptyLinesOn).toBoolean() && Global.db.settings.get(SettingName.SpacesOn).toBoolean()) {
|
||||||
|
lines.add(line.toString());
|
||||||
|
visible_lines.add(v_line.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Pair<>(lines, visible_lines);
|
||||||
|
}
|
||||||
|
public static boolean CompareLines(String line1_raw, String line2_raw) {
|
||||||
|
String line1 = line1_raw;
|
||||||
|
String line2 = line2_raw;
|
||||||
|
if (!Global.db.settings.get(SettingName.RegisterOn).toBoolean()) {
|
||||||
|
line1 = line1.toUpperCase();
|
||||||
|
line2 = line2.toUpperCase();
|
||||||
|
}
|
||||||
|
if (!Global.db.settings.get(SettingName.SpacesOn).toBoolean()) {
|
||||||
|
line1 = remove(line1, " ", "\t");
|
||||||
|
line2 = remove(line2, " ", "\t");
|
||||||
|
}
|
||||||
|
return line1.equals(line2);
|
||||||
|
}
|
||||||
|
public static boolean Contains(Vector<String> list, String line, int max_index) {
|
||||||
|
int last_index = -1;
|
||||||
|
for (int i = 0; i < list.size(); ++i)
|
||||||
|
if (CompareLines(list.get(i), line)) last_index = i;
|
||||||
|
return (last_index >= max_index);
|
||||||
|
}
|
||||||
|
public static boolean compareFortranTexts(String text1, String text2) {
|
||||||
|
Pair<Vector<String>, Vector<String>> p1 = getFortranLines(text1);
|
||||||
|
Pair<Vector<String>, Vector<String>> p2 = getFortranLines(text2);
|
||||||
|
Vector<String> lines1 = p1.getKey();
|
||||||
|
Vector<String> lines2 = p2.getKey();
|
||||||
|
if (lines1.size() != lines2.size())
|
||||||
|
return false;
|
||||||
|
for (int i = 0; i < lines1.size(); ++i) {
|
||||||
|
if (!CompareLines(lines1.get(i), lines2.get(i)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class Visualiser extends Component {
|
|||||||
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
|
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
|
||||||
@Override
|
@Override
|
||||||
public void GetVersionInfo() {
|
public void GetVersionInfo() {
|
||||||
version = 1102;
|
version = 1103;
|
||||||
String pattern = "MMM dd yyyy HH:mm:ss";
|
String pattern = "MMM dd yyyy HH:mm:ss";
|
||||||
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
|
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
|
||||||
date_text = df.format(getClassBuildTime());
|
date_text = df.format(getClassBuildTime());
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ public class SapforVersion_json implements Serializable {
|
|||||||
version = version_in.substring(root_in.length() + 1);
|
version = version_in.substring(root_in.length() + 1);
|
||||||
description = description_in;
|
description = description_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getFiles(File configurationRoot) {
|
public void getFiles(File configurationRoot) {
|
||||||
//--
|
//--
|
||||||
state = SapforVersionState.Empty;
|
state = SapforVersionState.Empty;
|
||||||
@@ -78,12 +77,12 @@ public class SapforVersion_json implements Serializable {
|
|||||||
out = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.out_file).toFile());
|
out = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.out_file).toFile());
|
||||||
err = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.err_file).toFile());
|
err = new ProjectFile(Paths.get(Home.getAbsolutePath(), Constants.data, Constants.err_file).toFile());
|
||||||
//--
|
//--
|
||||||
Vector<File> files = new Vector<>();
|
Vector<File> out_files = new Vector<>();
|
||||||
files.add(parse_out.file);
|
out_files.add(parse_out.file);
|
||||||
files.add(parse_err.file);
|
out_files.add(parse_err.file);
|
||||||
files.add(out.file);
|
out_files.add(out.file);
|
||||||
files.add(err.file);
|
out_files.add(err.file);
|
||||||
for (File file:files){
|
for (File file : out_files) {
|
||||||
try {
|
try {
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
Vector<String> lines = new Vector<>(FileUtils.readLines(file));
|
Vector<String> lines = new Vector<>(FileUtils.readLines(file));
|
||||||
@@ -92,8 +91,7 @@ public class SapforVersion_json implements Serializable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex){
|
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,7 +127,7 @@ public class SapforVersion_json implements Serializable {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
if (!text1.equals(text2)) {
|
if (!Utils.compareFortranTexts(text1, text2)) {
|
||||||
System.out.println("различие текста файла " + Utils.Brackets(file1.file.getName()));
|
System.out.println("различие текста файла " + Utils.Brackets(file1.file.getName()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import Common.UI.Menus_2023.VisualiserMenuBar;
|
|||||||
import Common.UI.UI;
|
import Common.UI.UI;
|
||||||
import Common.Utils.TextLog;
|
import Common.Utils.TextLog;
|
||||||
import Common.Utils.Utils;
|
import Common.Utils.Utils;
|
||||||
import GlobalData.Settings.SettingName;
|
|
||||||
import Visual_DVM_2021.Passes.Pass_2021;
|
import Visual_DVM_2021.Passes.Pass_2021;
|
||||||
import javafx.util.Pair;
|
import javafx.util.Pair;
|
||||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaHighlighter;
|
import org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaHighlighter;
|
||||||
@@ -91,104 +90,13 @@ public abstract class ComparisonForm<T> {
|
|||||||
private void ShowCurrentDiff() {
|
private void ShowCurrentDiff() {
|
||||||
Body.gotoLine_(colors.get(current_diff_line).getKey());
|
Body.gotoLine_(colors.get(current_diff_line).getKey());
|
||||||
}
|
}
|
||||||
public static boolean CompareLines(String line1_raw, String line2_raw) {
|
|
||||||
String line1 = line1_raw;
|
|
||||||
String line2 = line2_raw;
|
|
||||||
if (!Global.db.settings.get(SettingName.RegisterOn).toBoolean()) {
|
|
||||||
line1 = line1.toUpperCase();
|
|
||||||
line2 = line2.toUpperCase();
|
|
||||||
}
|
|
||||||
if (!Global.db.settings.get(SettingName.SpacesOn).toBoolean()) {
|
|
||||||
line1 = Utils.remove(line1, " ", "\t");
|
|
||||||
line2 = Utils.remove(line2, " ", "\t");
|
|
||||||
}
|
|
||||||
return line1.equals(line2);
|
|
||||||
}
|
|
||||||
public static boolean Contains(Vector<String> list, String line, int max_index) {
|
|
||||||
int last_index = -1;
|
|
||||||
for (int i = 0; i < list.size(); ++i)
|
|
||||||
if (CompareLines(list.get(i), line)) last_index = i;
|
|
||||||
return (last_index >= max_index);
|
|
||||||
}
|
|
||||||
private void getLines() {
|
private void getLines() {
|
||||||
lines.clear();
|
lines.clear();
|
||||||
visible_lines.clear();
|
visible_lines.clear();
|
||||||
//1.прочитать весь текст.
|
//--
|
||||||
char[] chars = getText().toCharArray();
|
Pair<Vector<String>, Vector<String>> p = Utils.getFortranLines(getText());
|
||||||
//по символам получить строки.
|
lines = p.getKey();
|
||||||
char c = 0; //текущий символ
|
visible_lines = p.getValue();
|
||||||
int i = 0; //индекс текущего символа.
|
|
||||||
StringBuilder line = new StringBuilder(); //текущая строка
|
|
||||||
StringBuilder v_line = new StringBuilder(); //текущая строка
|
|
||||||
while (i < chars.length) {
|
|
||||||
c = chars[i];
|
|
||||||
//System.out.print("`"+c+"`");
|
|
||||||
++i;
|
|
||||||
switch (c) {
|
|
||||||
case '\r': //возврат каретки, игнор
|
|
||||||
break;
|
|
||||||
case ' ':
|
|
||||||
case '\t':
|
|
||||||
if (Global.db.settings.get(SettingName.SpacesOn).toBoolean()) line.append(c);
|
|
||||||
v_line.append(c);
|
|
||||||
break;
|
|
||||||
case '\n': //конец строки
|
|
||||||
if (fortranWrapsOn()) {
|
|
||||||
//оракул. лезем в начало следующей строки
|
|
||||||
//и анализируем первые 5 символов
|
|
||||||
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()) {
|
|
||||||
lines.add(line.toString());
|
|
||||||
visible_lines.add(v_line.toString());
|
|
||||||
}
|
|
||||||
//сброс
|
|
||||||
line = new StringBuilder();
|
|
||||||
v_line = new StringBuilder();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
line.append(c);
|
|
||||||
v_line.append(c);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((i > 0) && (c != '\n')) {
|
|
||||||
//строка оборвалась на EOF
|
|
||||||
//добавление строки в результат.
|
|
||||||
if ((line.length() > 0) || Global.db.settings.get(SettingName.EmptyLinesOn).toBoolean() && Global.db.settings.get(SettingName.SpacesOn).toBoolean()) {
|
|
||||||
lines.add(line.toString());
|
|
||||||
visible_lines.add(v_line.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
protected void ClearText() {
|
protected void ClearText() {
|
||||||
events_on = false;
|
events_on = false;
|
||||||
@@ -212,10 +120,10 @@ public abstract class ComparisonForm<T> {
|
|||||||
int old_j = 0;
|
int old_j = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int i = 0; i < lines.size(); ++i) {
|
for (int i = 0; i < lines.size(); ++i) {
|
||||||
if (Contains(slave.lines, lines.get(i), old_j)) {
|
if (Utils.Contains(slave.lines, lines.get(i), old_j)) {
|
||||||
for (int k = old_j; k < slave.lines.size(); ++k) {
|
for (int k = old_j; k < slave.lines.size(); ++k) {
|
||||||
j = k;
|
j = k;
|
||||||
if (CompareLines(lines.get(i), slave.lines.get(k))) {
|
if (Utils.CompareLines(lines.get(i), slave.lines.get(k))) {
|
||||||
j++;
|
j++;
|
||||||
t1.add(visible_lines.get(i));
|
t1.add(visible_lines.get(i));
|
||||||
t2.add(slave.visible_lines.get(k));
|
t2.add(slave.visible_lines.get(k));
|
||||||
|
|||||||
Reference in New Issue
Block a user