Skip to content
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

Fixed #167. Refactor: centralized type handling for simple operations such as add and subtract, and added branch coverage for this #173

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

akerfel
Copy link

@akerfel akerfel commented Mar 9, 2022

Created functions which take two Number objects, and either adds, subtracts, or compares them. These Number objects can be of type Integer, Long, Float, Double, BigInteger or BigDecimal. Also added function which does row multiplication for Number arrays.

Instead of using the same code spread over multiple functions, this patch centralizes it to one class (Operations.java), thus decreasing code repetition and cylcomatic complexity, while increasing readability.

Also added branch coverage for these different Number types, since it was missing (previous tests only tested relevant functions using Integers).

For more details, see issue #167.

By submitting this pull request I confirm I've read and complied with the below requirements.

  • I have read the Contribution guidelines and I am confident that my PR reflects them.
  • I have followed the coding guidelines for this project.
  • My code follows the skeleton code structure.
  • This pull request has a descriptive title. For example, Added {Algorithm/DS name} [{Language}], not Update README.md or Added new code.

mnordste and others added 27 commits March 1, 2022 17:25
Merge lab4refactoring and lab4tests branches to lab4patch branch
* Fixed #101, feat: added compare function in operations and replaced ugly TODO code with calls to this function in Matrix and SegmentTree
* Fixed #98, tests: added tests for all datatypes (for number representation) to increase branch coverage for TODO functions in SegmentTree
* #Fixed #118, fix: fixed the bug for multiplyUsingLoopWithStringInput so it now can handle zero inputs, also modified the test to cover the case where there are several zeroes ('0000') in the input.

Co-authored-by: Magnus Åkerfelt <magnus@akerfeldt.net>
Co-authored-by: Beatrice Berg <beab@kth.se>
I have moved those changes to a separate branch, lab4removeForLoops, since it deals with a separate issue
This reverts commit e97d3b7.

This commit is reverted since it deals with a separate issue on the main-repo. We will move this commit to a separate branch, so we can make a separate pull request for this specific issue fix.
@akerfel akerfel changed the title Refactor: centralize type handling for simple operations such as add and subtract, and add branch coverage for this Fixed #167. Refactor: centralize type handling for simple operations such as add and subtract, and add branch coverage for this Mar 9, 2022
@akerfel akerfel changed the title Fixed #167. Refactor: centralize type handling for simple operations such as add and subtract, and add branch coverage for this Fixed #167. Refactor: centralize type handling for simple operations such as add and subtract, and added branch coverage for this Mar 9, 2022
@akerfel akerfel changed the title Fixed #167. Refactor: centralize type handling for simple operations such as add and subtract, and added branch coverage for this Fixed #167. Refactor: centralized type handling for simple operations such as add and subtract, and added branch coverage for this Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants