Closed
Conversation
Was previously misinterpreting unique=false as "not unique". It actually just means uniqueness is not guaranteed by the file.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the UMB import/read path to be more tolerant of missing optional binary entries and to better handle integer valuations that may require up to 64 bits during decoding/range computation.
Changes:
- Add “default value” extraction paths when certain UMB binary entries are absent (e.g., offsets, players, branch probabilities).
- Introduce 64-bit integer support in bitstring/bitpacking utilities and add long-based valuation range computation.
- Update the PRISM
UMBImporterto decode integer variables via the new long-capable APIs and safely cast back tointwhere required.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| prism/src/io/github/pmctools/umbj/UMBReader.java | Adds missing-file defaults, long range computation, and default array fillers. |
| prism/src/io/github/pmctools/umbj/UMBFormat.java | Introduces BinFileDefaultValue enum for default-fill behavior. |
| prism/src/io/github/pmctools/umbj/UMBBitString.java | Adds set/get for signed/unsigned longs in bitstrings. |
| prism/src/io/github/pmctools/umbj/UMBBitPacking.java | Adds long get/set helpers for bit-packed integer variables. |
| prism/src/io/UMBImporter.java | Switches integer decoding/range computation to long-first and casts to int with overflow checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+917
to
+939
| if (type.type.isDouble()) { | ||
| DoubleConsumer doubleConsumer = (DoubleConsumer) consumer; | ||
| double doubleValue; | ||
| switch (value) { | ||
| case ZERO: | ||
| doubleValue = 0.0; | ||
| break; | ||
| case ONE: | ||
| doubleValue = 1.0; | ||
| break; | ||
| default: | ||
| throw new UMBException("Unsupported default value " + value); | ||
| } | ||
| for (long i = 0; i < sizeNew; i++) { | ||
| doubleConsumer.accept(doubleValue); | ||
| } | ||
| } else if (type.type.isRational()) { | ||
| if (!type.isDefaultSize()) { | ||
| throw new UMBException("Non-default sized rationals are not yet supported"); | ||
| } | ||
| LongConsumer longConsumer = (it.unimi.dsi.fastutil.longs.LongConsumer) consumer; | ||
| long longValue1; | ||
| long longValue2; |
Comment on lines
+104
to
+109
| if (!fileExists(UMBFormat.STATE_CHOICE_OFFSETS_FILE)) { | ||
| // Indices default to identities if requested when absent | ||
| extractDefaultLongArray(umbIndex.getNumStates() + 1, UMBFormat.BinFileDefaultValue.IDENTITY, longConsumer); | ||
| } else { | ||
| extractLongArray(UMBFormat.STATE_CHOICE_OFFSETS_FILE, umbIndex.getNumStates() + 1, longConsumer); | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Member
Author
|
Rebased/merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.