-
Notifications
You must be signed in to change notification settings - Fork 19.9k
feat: add temperature unit conversions #5315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
BamaCharanChhandogi
merged 3 commits into
TheAlgorithms:master
from
vil02:add_temperature_converter
Aug 22, 2024
Merged
feat: add temperature unit conversions #5315
BamaCharanChhandogi
merged 3 commits into
TheAlgorithms:master
from
vil02:add_temperature_converter
Aug 22, 2024
Conversation
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
b2845f9
to
c297ed8
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5315 +/- ##
============================================
+ Coverage 45.44% 45.65% +0.20%
- Complexity 2817 2840 +23
============================================
Files 522 525 +3
Lines 15368 15425 +57
Branches 2915 2921 +6
============================================
+ Hits 6984 7042 +58
+ Misses 8090 8089 -1
Partials 294 294 ☔ View full report in Codecov by Sentry. |
alxkm
requested changes
Aug 10, 2024
src/main/java/com/thealgorithms/conversions/AffineConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/com/thealgorithms/conversions/UnitsConverter.java
Outdated
Show resolved
Hide resolved
c297ed8
to
5d61e90
Compare
BamaCharanChhandogi
approved these changes
Aug 21, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
alxkm
approved these changes
Aug 21, 2024
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.
This PR adds a framework to work with unit conversions. I did not want to make the things too complicated so I only handle the case, when relation between units is linear.
Please review this very carefully, because probably many people would like to add more types of unit conversions in the future. Please pay special attention to:
UnitConversionsTest
- I did not want to make it too complicated. It is not perfect, because adding a new quantity (like mass, length, time etc.) requiters adding 3 methods. But I think that it is still reasonable,UnitConversions
- my idea is to havestatic
members likeTEMPERATURE
,LENGTH
,MASS
,TIME
etc. there. Feels a bit weird to me, but nothing else comes to my mind,UnitsConverter.computeAllConversions
- probably it not the most efficient way, but there are not that many units in general. I guess it can be optimized in the future without changing the API,String
s?Please let's do not rush here.
This PR is partially inspired by #5048.
clang-format -i --style=file path/to/your/file.java