Ejemplo n.º 1
0
            public int Compare(object x, object y)
            {
                var xNote = (Note)x;
                var yNote = (Note)y;

                return(NoteEquality.AreEqual(xNote, yNote) ? 0 : -1);
            }
Ejemplo n.º 2
0
            public bool Equals(ITimedObject timedObject1, ITimedObject timedObject2)
            {
                if (ReferenceEquals(timedObject1, timedObject2))
                    return true;

                if (ReferenceEquals(null, timedObject1) || ReferenceEquals(null, timedObject2))
                    return false;

                var timedEvent = timedObject1 as TimedEvent;
                if (timedEvent != null)
                    return TimedEventEquality.AreEqual(timedEvent, timedObject2 as TimedEvent, _compareDeltaTimes);

                var note = timedObject1 as Note;
                if (note != null)
                    return NoteEquality.AreEqual(note, timedObject2 as Note);

                var chord = timedObject1 as Chord;
                if (chord != null)
                    return ChordEquality.AreEqual(chord, timedObject2 as Chord);

                var rest = timedObject1 as Rest;
                if (rest != null)
                    return rest.Equals(timedObject2 as Rest);

                throw new NotImplementedException($"Comparing of {timedObject1} and {timedObject2} is not implemented.");
            }
Ejemplo n.º 3
0
            public bool Equals(Chord chord1, Chord chord2)
            {
                if (ReferenceEquals(chord1, chord2))
                {
                    return(true);
                }

                if (ReferenceEquals(null, chord1) || ReferenceEquals(null, chord2))
                {
                    return(false);
                }

                return(NoteEquality.AreEqual(chord1.Notes, chord2.Notes));
            }