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

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

Merged

Conversation

trevorbaca
Copy link
Member

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()

@trevorbaca trevorbaca added this to the 3.14 milestone Oct 30, 2022
@trevorbaca trevorbaca self-assigned this Oct 30, 2022
@trevorbaca trevorbaca merged commit f07fbe7 into main Oct 30, 2022
@trevorbaca trevorbaca deleted the trevor/remove-natural-language-timespan-inequalities branch October 30, 2022 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove natural-language timespan inequalities
1 participant