Skip to content

Commit 2773fc1

Browse files
committed
try to solve clang-format errors and add serialVersionID
1 parent 3dc52a4 commit 2773fc1

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

src/main/java/com/thealgorithms/conversions/WordsToNumber.java

+27-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.thealgorithms.conversions;
22

3+
import java.io.Serial;
34
import java.math.BigDecimal;
45
import java.util.ArrayDeque;
56
import java.util.ArrayList;
@@ -263,35 +264,37 @@ private static BigDecimal combineChunks(List<BigDecimal> chunks) {
263264

264265
class WordsToNumberException extends RuntimeException {
265266

266-
enum ErrorType {
267-
NULL_INPUT("'null' or empty input provided"),
268-
UNKNOWN_WORD("Unknown Word: "),
269-
UNEXPECTED_WORD("Unexpected Word: "),
270-
UNEXPECTED_WORD_AFTER_POINT("Unexpected Word (after Point): "),
271-
MISSING_DECIMAL_NUMBERS("Decimal part is missing numbers."),
272-
MULTIPLE_NEGATIVES("Multiple 'Negative's detected."),
273-
INVALID_NEGATIVE("Incorrect 'negative' placement"),
274-
INVALID_CONJUNCTION("Incorrect 'and' placement");
267+
@Serial private static final long serialVersionUID = 1L;
275268

276-
private final String message;
269+
enum ErrorType {
270+
NULL_INPUT("'null' or empty input provided"),
271+
UNKNOWN_WORD("Unknown Word: "),
272+
UNEXPECTED_WORD("Unexpected Word: "),
273+
UNEXPECTED_WORD_AFTER_POINT("Unexpected Word (after Point): "),
274+
MISSING_DECIMAL_NUMBERS("Decimal part is missing numbers."),
275+
MULTIPLE_NEGATIVES("Multiple 'Negative's detected."),
276+
INVALID_NEGATIVE("Incorrect 'negative' placement"),
277+
INVALID_CONJUNCTION("Incorrect 'and' placement");
277278

278-
ErrorType(String message) {
279-
this.message = message;
280-
}
279+
private final String message;
280+
281+
ErrorType(String message) {
282+
this.message = message;
283+
}
281284

282-
public String formatMessage(String details) {
283-
return "Invalid Input. " + message + (details.isEmpty() ? "" : details);
285+
public String formatMessage(String details) {
286+
return "Invalid Input. " + message + (details.isEmpty() ? "" : details);
287+
}
284288
}
285-
}
286289

287-
public final ErrorType errorType;
290+
public final ErrorType errorType;
288291

289-
WordsToNumberException(ErrorType errorType, String details) {
290-
super(errorType.formatMessage(details));
291-
this.errorType = errorType;
292-
}
292+
WordsToNumberException(ErrorType errorType, String details) {
293+
super(errorType.formatMessage(details));
294+
this.errorType = errorType;
295+
}
293296

294-
public ErrorType getErrorType() {
295-
return errorType;
296-
}
297+
public ErrorType getErrorType() {
298+
return errorType;
299+
}
297300
}

0 commit comments

Comments
 (0)