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

refactor: PositionedNote composition with Note instead of inheritance #113

Merged
merged 1 commit into from May 14, 2023

Conversation

plammens
Copy link
Collaborator

@plammens plammens commented May 13, 2023

Closes #106

Comments:

  • Now that semitones doesn't collide with Note.semitones, I renamed semitonesFromRootHeight to semitones to conform with MusicItem, but perhaps you prefer keeping the more explicit name and adding an alias semitones => semitonesFromRootHeight?
  • Should I implement the Transposable<T> definition change in this PR now that it is easier, or in a separate one?

@plammens plammens requested a review from albertms10 as a code owner May 13, 2023 14:16
@coveralls
Copy link

coveralls commented May 13, 2023

Pull Request Test Coverage Report for Build 4974174985

  • 15 of 15 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 4969357159: 0.0%
Covered Lines: 481
Relevant Lines: 481

💛 - Coveralls

test/src/note/positioned_note_test.dart Show resolved Hide resolved
lib/src/note/positioned_note.dart Outdated Show resolved Hide resolved
@albertms10
Copy link
Owner

albertms10 commented May 13, 2023

perhaps you prefer keeping the more explicit name and adding an alias semitones => semitonesFromRootHeight?

I'm totally fine with renaming it to semitones—cleaner and simpler. You can always access the previous value with the .note.semitones getters.

Should I implement the Transposable<T> definition change in this PR now that it is easier, or in a separate one?

I prefer to keep pull requests as straightforward and concise as possible, so I would do it in a separate PR. Please note that I created a PR for this some days ago: #99 (comment).

Thanks!

@albertms10 albertms10 added this to the Road to 0.7 milestone May 13, 2023
@plammens plammens force-pushed the refactor/positioned-note-composition branch from ee996d0 to e58af6d Compare May 14, 2023 19:53
@plammens plammens requested a review from albertms10 May 14, 2023 19:55
Copy link
Owner

@albertms10 albertms10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! 💎

@plammens plammens merged commit a56cf9d into main May 14, 2023
3 checks passed
@plammens plammens deleted the refactor/positioned-note-composition branch May 14, 2023 20:04
@@ -136,15 +138,14 @@ final class PositionedNote extends Note {

@override
bool operator ==(Object other) =>
super == other && other is PositionedNote && octave == other.octave;
other is PositionedNote && note == other.note && octave == other.octave;

@override
int get hashCode => Object.hash(super.hashCode, octave);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deprecated hashCode was left behind, as no exhaustive tests existed to catch a bad implementation there.

Fixed in #155.

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.

Rewrite inheritance with composition for the PositionedNote class
3 participants