From a0d78392fc0a041db9803008d1a4126ec234efce Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Mon, 15 Mar 2021 22:22:14 +0100 Subject: [PATCH] Simplify check sort displaying. --- src/fr/devinsy/logar/app/Logar.java | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/fr/devinsy/logar/app/Logar.java b/src/fr/devinsy/logar/app/Logar.java index b18cfc8..620388e 100644 --- a/src/fr/devinsy/logar/app/Logar.java +++ b/src/fr/devinsy/logar/app/Logar.java @@ -351,13 +351,13 @@ public final class Logar { System.out.println("== Check sort for [" + file.getName() + "]"); LocalDateTime currentDate = null; - int count = 0; + int lineCount = 0; int badLineCount = 0; - int badGroupCount = 0; LineIterator iterator = new LineIterator(file); while (iterator.hasNext()) { String line = iterator.next(); + lineCount += 1; LocalDateTime date = getLogDate(line); if (currentDate == null) { @@ -365,34 +365,13 @@ public final class Logar } 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) { - System.out.println("Bad group count: " + badGroupCount); System.out.println("Bad line count: " + badLineCount); } }