diff options
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/PathInfo.kt | 15 |
1 files changed, 15 insertions, 0 deletions
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<Path> { 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 |