2121 * (:32-339).
2222 *
2323 * <p><strong>It evaluates the assembled document, not the database.</strong> Legacy validates its
24- * loaded domain object, so this takes the same input — which means Check Status sees exactly what the
25- * GET serves, needs no queries of its own, and can be unit-tested from a hand-built document. It also
26- * puts the derived totals within reach: several rules check {@code Total Costs}, {@code Total} and
27- * {@code $/km}, which exist only as derived values.
24+ * loaded domain object, so this takes the same input — which means Check Status sees exactly what
25+ * the GET serves, needs no queries of its own, and can be unit-tested from a hand-built document.
26+ * It also puts the derived totals within reach: several rules check {@code Total Costs}, {@code
27+ * Total} and {@code $/km}, which exist only as derived values.
2828 *
2929 * <p><strong>Emission order is contractual.</strong> Rules run page-by-page, and within a page the
3030 * three page-level rules come before the per-road ones, in the order legacy declares them. The
3131 * ordinals that appear in the composed text are positional, so a reordering would silently renumber
3232 * the user's error list.
3333 *
3434 * <p>This class resolves no text. It emits bundle keys plus pre-formatted arguments and the label
35- * prefix; the controller performs the single concatenation {@code label + ": " + resolvedText}, so the
36- * verbatim byte composition lives in exactly one place.
35+ * prefix; the controller performs the single concatenation {@code label + ": " + resolvedText}, so
36+ * the verbatim byte composition lives in exactly one place.
3737 *
3838 * <p><strong>Legacy quirks preserved deliberately</strong> — each is reproduced, not corrected:
3939 * <ul>
40- * <li>{@code Road Name} and {@code Sub Zone} are titled with the PAGE label only, so on a page with
41- * several roads the user cannot tell which road is at fault.</li>
42- * <li>{@code Sub Zone} has no control anywhere on the screen; it is populated only on read from the
43- * catalogue row.</li>
44- * <li>{@code Material Type Total (%)} is reported whenever the five percentages do not total 100 —
45- * including when all five are blank, because the legacy total coerces nulls to zero and is
40+ * <li>{@code Road Name} and {@code Sub Zone} are titled with the PAGE label only, so on a page
41+ * with several roads the user cannot tell which road is at fault.</li>
42+ * <li>{@code Sub Zone} has no control anywhere on the screen; it is populated only on read from
43+ * the catalogue row.</li>
44+ * <li>{@code Material Type Total (%)} is reported whenever the five percentages do not total 100
45+ * — including when all five are blank, because the legacy total coerces nulls to zero and is
4646 * therefore never absent.</li>
47- * <li>Additional-stabilizing transfers are checked against a floor of ZERO here while the entry form
48- * accepts negatives, so a value the form allowed can be reported as out of range.</li>
49- * <li>{@code Region}, {@code Road Type} and {@code Ballast Method Code} are required on the form but
50- * checked NOWHERE here.</li>
51- * <li>End Haul and Overland figures are checked nowhere — those rules are commented out in legacy.</li>
52- * <li>Both range bounds are formatted with the LOWER bound's pattern; legacy accepts an upper pattern
53- * and then ignores it.</li>
54- * <li>Label drift against the screen is kept as legacy writes it: {@code Ripple Rock} for the screen's
55- * "Rippable Rock", {@code Less Landing} singular, {@code Less Other Eng}, and a lower-case
56- * {@code total} in one stabilizing label.</li>
47+ * <li>Additional-stabilizing transfers are checked against a floor of ZERO here while the entry
48+ * form accepts negatives, so a value the form allowed can be reported as out of range.</li>
49+ * <li>{@code Region}, {@code Road Type} and {@code Ballast Method Code} are required on the form
50+ * but checked NOWHERE here.</li>
51+ * <li>End Haul and Overland figures are checked nowhere — those rules are commented out in
52+ * legacy.</li>
53+ * <li>Both range bounds are formatted with the LOWER bound's pattern; legacy accepts an upper
54+ * pattern and then ignores it.</li>
55+ * <li>Label drift against the screen is kept as legacy writes it: {@code Ripple Rock} for the
56+ * screen's "Rippable Rock", {@code Less Landing} singular, {@code Less Other Eng}, and a
57+ * lower-case {@code total} in one stabilizing label.</li>
5758 * </ul>
5859 *
5960 * <p>Two deliberate departures: the Boulder Area rule is dropped, because that field is removed by
@@ -78,8 +79,8 @@ final class Schedule10CheckStatus {
7879 /** Ballast method requiring the additional-stabilizing figures and a material type. */
7980 private static final String BALLAST_CRUSHED = "C" ;
8081
81- // Legacy number patterns, transcribed per rule. Formatting is applied mechanically so the rendered
82- // bounds are whatever the pattern produces, exactly as legacy renders them.
82+ // Legacy number patterns, transcribed per rule. Formatting is applied mechanically so the
83+ // rendered bounds are whatever the pattern produces, exactly as legacy renders them.
8384 private static final String FMT_INT = "###" ;
8485 private static final String FMT_3DP = "###.###" ;
8586 private static final String FMT_1DP = "###.#" ;
@@ -97,7 +98,9 @@ final class Schedule10CheckStatus {
9798 private Schedule10CheckStatus () {
9899 }
99100
100- /** One outstanding requirement: the machine field, its label prefix, and an unresolved message. */
101+ /**
102+ * One outstanding requirement: the machine field, its label prefix, and an unresolved message.
103+ */
101104 record Issue (String field , String label , String messageKey , List <String > args ) {
102105 }
103106
@@ -182,8 +185,8 @@ static DetailOutcome evaluateRoadDetail(
182185 requirePresent (
183186 issues , "subzone" , pagePrefix + " Sub Zone" , bec == null ? null : bec .subzone ());
184187
185- // Legacy dereferences the classification and its id without a guard, so one road detail holding a
186- // null foreign key aborts the entire check before any message is emitted. Reported instead.
188+ // Legacy dereferences the classification and its id without a guard, so one road detail holding
189+ // a null foreign key aborts the entire check before any message is emitted. Reported instead.
187190 if (bec == null || !allowableBec .contains (bec .biogeoclimaticCatalogueId ())) {
188191 issues .add (new Issue ("becClassification" , prefix + " BEC Zone" , MSG_BEC , List .of ()));
189192 }
@@ -217,12 +220,14 @@ static DetailOutcome evaluateRoadDetail(
217220 requireRange (issues , "subGradeActualCost" , prefix + " Sub-Grade: Actual Cost ($)" ,
218221 field (subGrade , SubGrade ::actualCost ), ZERO , FMT_MONEY , SEVEN_DIGITS , false );
219222 requireRange (issues , "subGradeTtTransfer" , prefix + " Sub-Grade: TtT Transfer ($)" ,
220- field (subGrade , SubGrade ::ttTransfer ), SEVEN_DIGITS .negate (), FMT_MONEY , SEVEN_DIGITS , false );
223+ field (subGrade , SubGrade ::ttTransfer ), SEVEN_DIGITS .negate (), FMT_MONEY , SEVEN_DIGITS ,
224+ false );
221225 requireRange (issues , "subGradeOtherTransfer" , prefix + " Sub-Grade: Other Transfer ($)" ,
222226 field (subGrade , SubGrade ::otherTransfer ), SEVEN_DIGITS .negate (), FMT_MONEY , SEVEN_DIGITS ,
223227 false );
224228 requireRange (issues , "subGradeTotalCosts" , prefix + " Sub-Grade: Total Costs ($)" ,
225- field (subGrade , SubGrade ::totalCosts ), EIGHT_DIGITS .negate (), FMT_MONEY , EIGHT_DIGITS , false );
229+ field (subGrade , SubGrade ::totalCosts ), EIGHT_DIGITS .negate (), FMT_MONEY , EIGHT_DIGITS ,
230+ false );
226231 requireRange (issues , "lessBridges" , prefix + " Sub-Grade: Less Bridges ($)" ,
227232 field (subGrade , SubGrade ::lessBridges ), ZERO , FMT_MONEY , SEVEN_DIGITS , false );
228233 requireRange (issues , "lessCulverts" , prefix + " Sub-Grade: Less Culverts ($)" ,
@@ -236,13 +241,15 @@ static DetailOutcome evaluateRoadDetail(
236241 requireRange (issues , "lessOtherEng" , prefix + " Sub-Grade: Less Other Eng ($)" ,
237242 field (subGrade , SubGrade ::lessOtherEng ), ZERO , FMT_MONEY , SEVEN_DIGITS , false );
238243 requireRange (issues , "subGradeTotal" , prefix + " Sub-Grade: Total ($)" ,
239- field (subGrade , SubGrade ::total ), EIGHT_DIGITS .negate (), FMT_MONEY_2DP , EIGHT_DIGITS , false );
240- requireRange (issues , "subGradeCostPerLength" , prefix + " Sub-Grade: $/km" ,
241- field (subGrade , SubGrade ::costPerLength ), EIGHT_DIGITS .negate (), FMT_MONEY_2DP , EIGHT_DIGITS ,
244+ field (subGrade , SubGrade ::total ), EIGHT_DIGITS .negate (), FMT_MONEY_2DP , EIGHT_DIGITS ,
242245 false );
246+ requireRange (issues , "subGradeCostPerLength" , prefix + " Sub-Grade: $/km" ,
247+ field (subGrade , SubGrade ::costPerLength ), EIGHT_DIGITS .negate (), FMT_MONEY_2DP ,
248+ EIGHT_DIGITS , false );
243249
244250 Stabilizing stabilizing = detail .stabilizing ();
245- boolean crushed = stabilizing != null && BALLAST_CRUSHED .equals (stabilizing .ballastMethodCode ());
251+ boolean crushed =
252+ stabilizing != null && BALLAST_CRUSHED .equals (stabilizing .ballastMethodCode ());
246253
247254 requireRange (issues , "stabilizingLength" , prefix + " Additional Stabilizing: Length (km)" ,
248255 field (stabilizing , Stabilizing ::length ), ZERO , FMT_3DP , new BigDecimal ("999.999" ), crushed );
@@ -251,7 +258,8 @@ static DetailOutcome evaluateRoadDetail(
251258 field (stabilizing , Stabilizing ::surfaceWidth ), ZERO , FMT_1DP , new BigDecimal ("999.9" ),
252259 crushed );
253260 requireRange (issues , "stabilizingDepth" , prefix + " Additional Stabilizing: Depth (m)" ,
254- field (stabilizing , Stabilizing ::depth ), ZERO , FMT_2DP_SMALL , new BigDecimal ("99.9" ), crushed );
261+ field (stabilizing , Stabilizing ::depth ), ZERO , FMT_2DP_SMALL , new BigDecimal ("99.9" ),
262+ crushed );
255263 requireRange (issues , "stabilizingDistanceToSource" ,
256264 prefix + " Additional Stabilizing: Distance to Source (km)" ,
257265 field (stabilizing , Stabilizing ::distanceToSource ), ZERO , FMT_1DP , new BigDecimal ("999.9" ),
@@ -267,8 +275,8 @@ static DetailOutcome evaluateRoadDetail(
267275 requireRange (issues , "stabilizingActualCost" ,
268276 prefix + " Additional Stabilizing: Actual Cost ($)" ,
269277 stabilizing .actualCost (), ZERO , FMT_MONEY , SEVEN_DIGITS , true );
270- // Floor of ZERO, while the entry form accepts down to -9,999,999 for both transfers. A value the
271- // form allowed is therefore reported here. Legacy carries the same disagreement.
278+ // Floor of ZERO, while the entry form accepts down to -9,999,999 for both transfers. A value
279+ // the form allowed is therefore reported here. Legacy carries the same disagreement.
272280 requireRange (issues , "stabilizingTtTransfer" ,
273281 prefix + " Additional Stabilizing: TtT Transfer ($)" ,
274282 stabilizing .ttTransfer (), ZERO , FMT_MONEY , SEVEN_DIGITS , true );
@@ -292,13 +300,13 @@ private static void requirePresent(
292300 }
293301
294302 /**
295- * The legacy numeric rule: an absent optional value passes, an absent required value is reported as
296- * missing, and otherwise the value must sit inside the inclusive range.
303+ * The legacy numeric rule: an absent optional value passes, an absent required value is reported
304+ * as missing, and otherwise the value must sit inside the inclusive range.
297305 *
298306 * <p>When both bounds are identical the must-equal message is used with a single argument. Legacy
299307 * reaches that branch by comparing the two bounds by REFERENCE, which happens to work for the one
300- * rule that uses it because small boxed integers are cached; numeric equality is used here instead,
301- * which agrees for every rule in this schedule and does not depend on that accident.
308+ * rule that uses it because small boxed integers are cached; numeric equality is used here
309+ * instead, which agrees for every rule in this schedule and does not depend on that accident.
302310 */
303311 private static void requireRange (
304312 List <Issue > issues , String field , String label , BigDecimal value ,
@@ -324,8 +332,8 @@ private static void requireRange(
324332 * Renders a bound with its pattern.
325333 *
326334 * <p>Both bounds use the LOWER bound's pattern: legacy accepts an upper pattern and then never
327- * applies it. Symbols are pinned to a fixed locale so the rendered separators cannot drift with the
328- * server's default.
335+ * applies it. Symbols are pinned to a fixed locale so the rendered separators cannot drift with
336+ * the server's default.
329337 */
330338 private static String format (BigDecimal bound , String pattern ) {
331339 DecimalFormat format =
0 commit comments