package de.duehl.vocabulary.japanese.logic.symbol.kanji.strokes.test;

import java.util.List;

import de.duehl.basics.datetime.time.watch.StopWatch;
import de.duehl.basics.text.NumberString;
import de.duehl.vocabulary.japanese.logic.symbol.kanji.strokes.own.KanjiStrokesReader;
import de.duehl.vocabulary.japanese.logic.symbol.kanji.strokes.own.data.KanjiStrokePath;
import de.duehl.vocabulary.japanese.logic.symbol.kanji.strokes.tools.CodePointTools;

public class ReadKanjiStrokesInOwnFormatForTesting {

    public static void main(String[] args) {
        StopWatch watch = new StopWatch();
        KanjiStrokesReader reader = new KanjiStrokesReader();
        reader.read();
        List<KanjiStrokePath> kanjiStrokePathes = reader.getKanjiStrokePathes();
        int codePoint = -1;
        int numberOfKanji = 0;
        for (KanjiStrokePath kanjiStrokePath : kanjiStrokePathes) {
            int actualCodePoint = kanjiStrokePath.getCodePoint();
            if (actualCodePoint != codePoint) {
                ++numberOfKanji;
                codePoint = actualCodePoint;
                if (Character.isValidCodePoint(codePoint)) {
                    String kanji = CodePointTools.codePointToCharacter(codePoint);
                    System.out.println("CodePoint " + codePoint + " -> Kanji " + kanji);
                }
                else {
                    System.out.println("Ungültiger CodePoint: " + codePoint);
                }
            }
            System.out.println(kanjiStrokePath);
        }
        System.out.println("Eingelesen wurden " + NumberString.taupu(kanjiStrokePathes.size())
                + " KanjiStrokePaths zu " + NumberString.taupu(numberOfKanji) + " Kanji.");
        System.out.println("Laufzeit: " + watch.getTime());
    }

}
