Skip to content

Commit

Permalink
Note equality overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam McKee committed Jul 17, 2024
1 parent d95ea03 commit 9235f05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.0.8

* MeasureDisplay without notes skips NotePositioning and renders chart without any notes
* Note equality overrides

## 0.0.7

Expand Down
11 changes: 11 additions & 0 deletions lib/note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ class Note {
Timing sustainReleaseTiming() {
return timing + (length ?? Timing(timing.type, timing.nth + 1));
}

@override
bool operator ==(Object other) =>
identical(this, other) ||
other is Note &&
runtimeType == other.runtimeType &&
string == other.string &&
timing == other.timing;

@override
int get hashCode => string.hashCode ^ timing.hashCode;
}

class ChordNoteSet {
Expand Down

0 comments on commit 9235f05

Please sign in to comment.