@@ -43,19 +43,23 @@ public static void main(String[] args) {
43
43
unitsToCheck .stream ()
44
44
.filter (u -> !globalData .correctUnits .contains (u ))
45
45
.forEach (unit -> checkUnit (unit , globalData , ttlPrintStream ));
46
- System .out .println (
47
- String .format (
48
- "was incorrect: \n %s\n " ,
49
- globalData .wasIncorrect .stream ()
50
- .map (Unit ::getIriAbbreviated )
51
- .collect (Collectors .joining ("\n " ))));
52
- System .out .println (
53
- String .format (
54
- "was missing: \n %s\n " ,
55
- globalData .wasMissing .stream ()
56
- .map (Unit ::getIriAbbreviated )
57
- .collect (Collectors .joining ("\n " ))));
58
46
}
47
+ System .out .println (
48
+ String .format (
49
+ "# %d Units with incorrect symbol: \n %s\n " ,
50
+ globalData .wasIncorrect .size (),
51
+ globalData .wasIncorrect .stream ()
52
+ .sorted (Comparator .comparing (Unit ::getIriLocalname ))
53
+ .map (Unit ::getIriAbbreviated )
54
+ .collect (Collectors .joining ("\n # " , "\n # " , "\n " ))));
55
+ System .out .println (
56
+ String .format (
57
+ "# %d Units without symbol: \n %s\n " ,
58
+ globalData .wasMissing .size (),
59
+ globalData .wasMissing .stream ()
60
+ .sorted (Comparator .comparing (Unit ::getIriLocalname ))
61
+ .map (Unit ::getIriAbbreviated )
62
+ .collect (Collectors .joining ("\n # " , "\n #" , "\n " ))));
59
63
});
60
64
globalData .missingData .entrySet ().stream ()
61
65
.sorted (
@@ -84,7 +88,7 @@ private static Predicate<Unit> isLikelyDerivedUnit() {
84
88
}
85
89
86
90
private static void printStatements (ByteArrayOutputStream ttlOut ) {
87
- System .out .println ("STATEMENTS TO ADD:\n \n " );
91
+ System .out .println ("# STATEMENTS TO ADD:\n \n " );
88
92
System .out .println (ttlOut .toString ());
89
93
}
90
94
@@ -107,24 +111,24 @@ private static void checkUnit(Unit unit, GlobalData globalData, PrintStream ttlP
107
111
if (!globalData .trustCalculationForUnit (unit )) {
108
112
return ;
109
113
}
110
- Optional <String > calculatedSymbol =
111
- unit .getSymbol ().or (() -> unit .getFactorUnits ().getSymbol ());
114
+ Optional <String > calculatedSymbol = unit .getFactorUnits ().getSymbol ();
112
115
if (calculatedSymbol .isEmpty ()) {
113
116
return ;
114
117
} else {
115
118
if (unit .getSymbol ().isPresent ()) {
116
119
String actualSymbol = unit .getSymbol ().get ();
117
- globalData .correctUnits .add (unit );
118
120
boolean isRelevantDifference = !actualSymbol .equals (calculatedSymbol .get ());
119
121
if (isRelevantDifference ) {
120
122
commentsForTTl .println (
121
123
format (
122
- "WRONG SYMBOL? : %s - calculated from factors: %s, actual: %s\n " ,
124
+ "WRONG SYMBOL : %s - calculated from factors: %s, actual: %s\n " ,
123
125
unit .getIriAbbreviated (),
124
126
calculatedSymbol .get ().toString (),
125
127
actualSymbol .toString ()));
126
- commentsForTTl .println ("Here is the triple you might want to use instead:" );
127
- printSymbolTriple (commentsForTTl , commentsForTTl , unit , calculatedSymbol .get ());
128
+ printSymbolTriple (ttlPrintStream , commentsForTTl , unit , calculatedSymbol .get ());
129
+ globalData .wasIncorrect .add (unit );
130
+ } else {
131
+ globalData .correctUnits .add (unit );
128
132
}
129
133
} else {
130
134
commentsForTTl .println (
0 commit comments