Simplify check sort displaying.

This commit is contained in:
Christian P. MOMON 2021-03-15 22:22:14 +01:00
parent e324aef88d
commit a0d78392fc
1 changed files with 4 additions and 25 deletions

View File

@ -351,13 +351,13 @@ public final class Logar
{ {
System.out.println("== Check sort for [" + file.getName() + "]"); System.out.println("== Check sort for [" + file.getName() + "]");
LocalDateTime currentDate = null; LocalDateTime currentDate = null;
int count = 0; int lineCount = 0;
int badLineCount = 0; int badLineCount = 0;
int badGroupCount = 0;
LineIterator iterator = new LineIterator(file); LineIterator iterator = new LineIterator(file);
while (iterator.hasNext()) while (iterator.hasNext())
{ {
String line = iterator.next(); String line = iterator.next();
lineCount += 1;
LocalDateTime date = getLogDate(line); LocalDateTime date = getLogDate(line);
if (currentDate == null) if (currentDate == null)
{ {
@ -365,34 +365,13 @@ public final class Logar
} }
else if (date.isBefore(currentDate)) else if (date.isBefore(currentDate))
{ {
count += 1; System.out.println(String.format("detected line: %d %s", lineCount, currentDate.toString()));
badLineCount += 1;
} }
else
{
currentDate = date;
if (count != 0)
{
System.out.println(String.format("detected lines: %d %s", count, currentDate.toString()));
badLineCount += count;
badGroupCount += 1;
count = 0;
}
}
}
if (count != 0)
{
System.out.println(String.format("detected lines: %d %s", count, currentDate.toString()));
badLineCount += count;
badGroupCount += 1;
count = 0;
} }
if (badLineCount > 0) if (badLineCount > 0)
{ {
System.out.println("Bad group count: " + badGroupCount);
System.out.println("Bad line count: " + badLineCount); System.out.println("Bad line count: " + badLineCount);
} }
} }