| 1 | package com.roxoft.aoc.y2015.Day2; | |
| 2 | ||
| 3 | import java.util.Arrays; | |
| 4 | import java.util.List; | |
| 5 | ||
| 6 | public final class Parser { | |
| 7 | /** The raw content to be parsed. */ | |
| 8 | private final String content; | |
| 9 | ||
| 10 | private Parser(final String stringToParse) { | |
| 11 | this.content = stringToParse; | |
| 12 | } | |
| 13 | ||
| 14 | /** | |
| 15 | * @param stringToParse the string intended to be parsed. | |
| 16 | * @return A {@link Parser} ready to parse the input. | |
| 17 | */ | |
| 18 | public static Parser parsing(final String stringToParse) { | |
| 19 |
1
1. parsing : replaced return value with null for com/roxoft/aoc/y2015/Day2/Parser::parsing → KILLED |
return new Parser(stringToParse); |
| 20 | } | |
| 21 | ||
| 22 | /** | |
| 23 | * @return {@link Day2} object from the raw string. | |
| 24 | */ | |
| 25 | public Day2 asDay2Entry() { | |
| 26 | //^[0-9]{1,2}x[0-9]{1,2}x[0-9]{1,2}$ | |
| 27 | final List<Integer> x = Arrays | |
| 28 | .stream(content.split("x")) | |
| 29 | .map(Integer::parseInt) | |
| 30 | .toList(); | |
| 31 |
1
1. asDay2Entry : replaced return value with null for com/roxoft/aoc/y2015/Day2/Parser::asDay2Entry → KILLED |
return Day2.of(x.get(0), x.get(1), x.get(2)); |
| 32 | } | |
| 33 | } | |
Mutations | ||
| 19 |
1.1 |
|
| 31 |
1.1 |