Abjad / abjad

Abjad is a Python API for building LilyPond files. Use Abjad to make PDFs of music notation.
https://abjad.github.io
GNU General Public License v3.0
234 stars 41 forks source link

Removed natural-language inequalities from abjad.Timespan. #1492

Closed trevorbaca closed 1 year ago

trevorbaca commented 1 year ago

Closes #1491.

The natural-language inequalities implemented on abjad.Timespan are a nice idea, but reintroduce the ambiguity that natural language frequently does. Just write inequalities with built-in <, <=, == instead. Replacements for many methods are copied here, for reference:

REMOVED: timespan_1.contains_timespan_improperly(timespan_2)
INSTEAD: timespan_2 in timespan_1

REMOVED:
    timespan_1.curtails_timespan(timespan_2)
INSTEAD:
    timespan_2.start_offset < timespan_1.start_offset and
    timespan_1.start_offset <= timespan_2.stop_offset and
    timespan_2.stop_offset <= timespan_1.stop_offset

REMOVED:
    timespan_1.delays_timespan(timespan_2)
INSTEAD:
    timespan_1.start_offset <= timespan_2.start_offset and
    timespan_2.start_offset < timespan_1.stop_offset

REMOVED: timespan_1.happens_during_timespan(timespan_2)
INSTEAD: timespan_1 in timespan_2

REMOVED: timespan_1.intersects_timespan(timespan_2)
INSTEAD: bool(timespan_1 & timespan_2)

REMOVED: timespan_1.is_congruent_to_timespan(timespan_2)
INSTEAD: timespan_1 == timespan_2

REMOVED:
    timespan_1.is_tangent_to_timespan(timespan_2)
INSTEAD:
    timespan_1.stop_offset == timespan_2.start_offset or
    timespan_2.stop_offset == timespan_1.start_offset

REMOVED:
    timespan_1.overlaps_all_of_timespan(timespan_2)
INSTEAD:
    timespan_1.start_offset < timespan_2.start_offset and
    timespan_2.stop_offset < timespan_1.stop_offset

REMOVED:
    timespan_1.overlaps_only_stop_of_timespan(timespan_2)
INSTEAD:
    timespan_1.start_offset < timespan_2.start_offset and
    timespan_2.start_offset < timespan_1.stop_offset and
    timespan_1.stop_offset <= timespan_2.stop_offset

REMOVED:
    timespan_1.overlaps_only_stop_of_timespan(timespan_2)
INSTEAD:
    timespan_2.start_offset <= timespan_1.start_offset and
    timespan_1.start_offset < timespan_2.stop_offset and
    timespan_2stop_offset < timespan_1.stop_offset

REMOVED:
    timespan_1.overlaps_start_of_timespan(timespan_2)
INSTEAD:
    timespan_1.start_offset < timespan_2.start_offset and
    timespan_2.start_offset < timespan_1.stop_offset

REMOVED:
    timespan_1.overlaps_stop_of_timespan(timespan_2)
INSTEAD:
    timespan_1.start_offset < timespan_2.stop_offset and
    timespan_2.stop_offset < timespan_1.stop_offset

REMOVED:
    timespan_1.trisects_timespan(timespan_2)
INSTEAD:
    timespan_2.start_offset < timespan_1.start_offset and
    timespan_1.stop_offset < timespan_2.stop_offset

REMOVED: timespan_1.starts_after_timespan_starts(timespan_2)
INSTEAD: timespan_2.start_offset < timespan_1.start_offset

REMOVED:
    timespan_1.starts_during_timespan(timespan_2)
INSTEAD:
    timespan_2.start_offset <= timespan_1.start_offset and
    timespan_1.start_offset < timespan_2.stop_offset

These methods are also removed; their replacements should be clear:

abjad.Timespan.starts_after_timespan_stops()
abjad.Timespan.starts_before_timespan_starts()
abjad.Timespan.starts_before_timespan_stops()
abjad.Timespan.starts_when_timespan_starts()
abjad.Timespan.starts_when_timespan_stops()
abjad.Timespan.stops_after_timespan_starts()
abjad.Timespan.stops_after_timespan_stops()
abjad.Timespan.stops_before_timespan_starts()
abjad.Timespan.stops_before_timespan_stops()
abjad.Timespan.stops_during_timespan()
abjad.Timespan.stops_when_timespan_starts()
abjad.Timespan.stops_when_timespan_stops()
abjad.Timespan.starts_after_offset()
abjad.Timespan.starts_at_offset()
abjad.Timespan.starts_at_or_after_offset()
abjad.Timespan.starts_before_offset()
abjad.Timespan.starts_before_or_at_offset()
abjad.Timespan.stops_after_offset()
abjad.Timespan.stops_at_offset()
abjad.Timespan.stops_at_or_after_offset()
abjad.Timespan.stops_before_offset()
abjad.Timespan.stops_before_or_at_offset()