From 02253cde1b35234a509da64840b83c2ce6879cb1 Mon Sep 17 00:00:00 2001 From: marhali Date: Tue, 16 Sep 2025 23:09:49 +0200 Subject: [PATCH 01/48] feat: implement data structure holding a number with an associated radix base --- .../marhali/json5/internal/RadixNumber.java | 78 +++++++++++++++++++ .../json5/internal/RadixNumberTest.java | 37 +++++++++ 2 files changed, 115 insertions(+) create mode 100644 src/main/java/de/marhali/json5/internal/RadixNumber.java create mode 100644 src/test/java/de/marhali/json5/internal/RadixNumberTest.java diff --git a/src/main/java/de/marhali/json5/internal/RadixNumber.java b/src/main/java/de/marhali/json5/internal/RadixNumber.java new file mode 100644 index 0000000..d633c21 --- /dev/null +++ b/src/main/java/de/marhali/json5/internal/RadixNumber.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2025 Marcel Haßlinger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.marhali.json5.internal; + +import java.util.Objects; + +/** + * Simple wrapper around {@link Number} that tracks the used radix base. + * + * @author Marcel Haßlinger + */ +public class RadixNumber { + + /** + * Referenced number. + */ + private final Number number; + + /** + * Radix base to use. + *

+ * Supported values are: + *