Make *(one|zero) weights singletons#153
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR standardizes the implementation of several weight and transition function classes by enforcing the singleton pattern, ensuring that only a single instance (one or zero) exists. Key changes include making public constructors private, adding @nonnull annotations on parameters, and updating string representations in toString methods.
- TransitionFunctionZero.java & TransitionFunctionOne.java: Constructors changed to private to enforce singleton usage and NonNull annotations added where needed.
- PathConditionWeightOne.java, MinDistanceWeightOne.java, DataFlowPathWeightOne.java, SetDomainZero.java, SetDomainOne.java: Constructors made private in line with the singleton approach.
- MinDistanceWeightImpl.java: Simplified the toString method by removing an instantiation of the singleton weight.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| idealPDS/src/main/java/typestate/TransitionFunctionZero.java | Constructor changed to private to enforce singleton |
| idealPDS/src/main/java/typestate/TransitionFunctionOne.java | Constructor made private and NonNull annotation added to extendWith parameter |
| boomerangPDS/src/main/java/boomerang/weights/PathConditionWeightOne.java | Constructors changed to private to support singleton pattern |
| boomerangPDS/src/main/java/boomerang/weights/MinDistanceWeightOne.java | Constructor made private to enforce singleton pattern |
| boomerangPDS/src/main/java/boomerang/weights/MinDistanceWeightImpl.java | toString method updated to remove redundant weight instantiation |
| boomerangPDS/src/main/java/boomerang/weights/DataFlowPathWeightOne.java | Constructor changed to private to enforce singleton |
| SynchronizedPDS/src/main/java/sync/pds/weights/SetDomainZero.java | Constructor made private in line with singleton usage |
| SynchronizedPDS/src/main/java/sync/pds/weights/SetDomainOne.java | Constructor made private to enforce the singleton design |
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.
Close #150