From b3bea2bea5c90435f0f1ed42b0cf82e453105c13 Mon Sep 17 00:00:00 2001 From: Edoardo La Greca Date: Thu, 7 Aug 2025 19:04:10 +0200 Subject: add genFID to PathInfo --- src/main/kotlin/PathInfo.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/kotlin/PathInfo.kt b/src/main/kotlin/PathInfo.kt index 4981662..c803e17 100644 --- a/src/main/kotlin/PathInfo.kt +++ b/src/main/kotlin/PathInfo.kt @@ -68,4 +68,19 @@ class PathInfo() { fun getAllPaths(): Set { return this.paths.toSet() } + + /** + * Generate a new FID which is not already in use. + * + * @return The new FID. + * @throws IllegalStateException if there is no available FID. + */ + fun genFID(): UInt { + for (newFid in 0u..UInt.MAX_VALUE) { + if (findByFID(newFid) == null) { + return newFid + } + } + throw IllegalStateException() + } } \ No newline at end of file -- cgit v1.2.3