TimespanList

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=1]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/timespans/../system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; } subgraph "cluster_abjad.timespans" { graph [label="abjad.timespans"]; node [color=2]; "abjad.timespans.TimespanList.TimespanList" [URL="../api/abjad/timespans/TimespanList.html#abjad.timespans.TimespanList.TimespanList", color=black, fontcolor=white, label="Timespan\nList", target=_top]; } subgraph "cluster_abjad.utilities" { graph [label="abjad.utilities"]; node [color=3]; "abjad.utilities.TypedCollection.TypedCollection" [URL="../api/abjad/timespans/../utilities/TypedCollection.html#abjad.utilities.TypedCollection.TypedCollection", label="Typed\nCollection", shape=oval, style=bold, target=_top]; "abjad.utilities.TypedList.TypedList" [URL="../api/abjad/timespans/../utilities/TypedList.html#abjad.utilities.TypedList.TypedList", label="Typed\nList", target=_top]; "abjad.utilities.TypedCollection.TypedCollection" -> "abjad.utilities.TypedList.TypedList"; } subgraph cluster_builtins { graph [label=builtins]; node [color=4]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } subgraph "cluster_collections.abc" { graph [label="collections.abc"]; node [color=5]; "collections.abc.Collection" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Collection", label=Collection, shape=oval, style=bold, target=_top]; "collections.abc.Container" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Container", label=Container, shape=oval, style=bold, target=_top]; "collections.abc.Iterable" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Iterable", label=Iterable, shape=oval, style=bold, target=_top]; "collections.abc.MutableSequence" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.MutableSequence", label="Mutable\nSequence", shape=oval, style=bold, target=_top]; "collections.abc.Reversible" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Reversible", label=Reversible, shape=oval, style=bold, target=_top]; "collections.abc.Sequence" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Sequence", label=Sequence, shape=oval, style=bold, target=_top]; "collections.abc.Sized" [URL="https://docs.python.org/3.6/library/collections.abc.html#collections.abc.Sized", label=Sized, shape=oval, style=bold, target=_top]; "collections.abc.Collection" -> "collections.abc.Sequence"; "collections.abc.Container" -> "collections.abc.Collection"; "collections.abc.Iterable" -> "collections.abc.Collection"; "collections.abc.Iterable" -> "collections.abc.Reversible"; "collections.abc.Reversible" -> "collections.abc.Sequence"; "collections.abc.Sequence" -> "collections.abc.MutableSequence"; "collections.abc.Sized" -> "collections.abc.Collection"; } "abjad.system.AbjadObject.AbjadObject" -> "abjad.utilities.TypedCollection.TypedCollection"; "abjad.utilities.TypedList.TypedList" -> "abjad.timespans.TimespanList.TimespanList"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; "builtins.object" -> "collections.abc.Container"; "builtins.object" -> "collections.abc.Iterable"; "builtins.object" -> "collections.abc.Sized"; "collections.abc.MutableSequence" -> "abjad.utilities.TypedList.TypedList"; }

class abjad.timespans.TimespanList.TimespanList(items=None, item_class=None, keep_sorted=False)

Timespan list.

Contiguous timespan list:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Overlapping timespan list:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(16, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(12, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(-2, 1),
            stop_offset=abjad.Offset(8, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(15, 1),
            stop_offset=abjad.Offset(20, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(24, 1),
            stop_offset=abjad.Offset(30, 1),
            ),
        ]
    )

Empty timespan list:

>>> abjad.TimespanList()
TimespanList([])

Coerces input:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, (1, 2)),
...     ((1, 2), (3, 4)),
...     abjad.Timespan((3, 4), 1),
...     ])
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(1, 2),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(1, 2),
            stop_offset=abjad.Offset(3, 4),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 4),
            stop_offset=abjad.Offset(1, 1),
            ),
        ]
    )

Operations on timespan currently work in place.


Attributes Summary

__and__ Keeps material that intersects timespan.
__illustrate__ Illustrates timespans.
__invert__ Inverts timespans.
__sub__ Deletes material that intersects timespan.
all_are_contiguous Is true when all timespans are contiguous.
all_are_nonoverlapping Is true when all timespans are nonoverlapping.
all_are_well_formed Is true when all timespans are well-formed.
axis Gets axis defined equal to arithmetic mean of start- and stop-offsets.
clip_timespan_durations Clips timespan durations.
compute_logical_and Computes logical AND of timespans.
compute_logical_or Computes logical OR of timespans.
compute_logical_xor Computes logical XOR of timespans.
compute_overlap_factor Computes overlap factor of timespans.
compute_overlap_factor_mapping Computes overlap factor for each consecutive offset pair in timespans.
count_offsets Counts offsets.
duration Gets duration of timespan list.
explode Explodes timespans into timespan lists, avoiding overlap, and distributing density as evenly as possible.
get_timespan_that_satisfies_time_relation Gets timespan that satisifies time_relation.
get_timespans_that_satisfy_time_relation Gets timespans that satisfy time_relation.
has_timespan_that_satisfies_time_relation Is true when timespan list has timespan that satisfies time_relation.
is_sorted Is true when timespans are in time order.
partition Partitions timespans into timespan_lists.
reflect Reflects timespans.
remove_degenerate_timespans Removes degenerate timespans.
repeat_to_stop_offset Repeats timespans to stop_offset.
rotate Rotates by count contiguous timespans.
round_offsets Rounds offsets of timespans in list to multiples of multiplier.
scale Scales timespan by multiplier relative to anchor.
split_at_offset Splits timespans at offset.
split_at_offsets Splits timespans at offsets.
start_offset Gets start offset.
stop_offset Gets stop offset.
stretch Stretches timespans by multiplier relative to anchor.
timespan Gets timespan of timespan list.
translate Translates timespans by translation.
translate_offsets Translates timespans by start_offset_translation and stop_offset_translation.

Special methods

__and__(timespan)

Keeps material that intersects timespan.

Keeps material that intersects timespan:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     ])
>>> abjad.show(timespans, range_=(-2, 12), scale=0.5) 
>>> timespan = abjad.Timespan(5, 10)
>>> _ = timespans & timespan
>>> abjad.show(timespans, range_=(-2, 12), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(8, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Operates in place and returns timespan list.

(TypedCollection).__contains__(item)

Is true when typed collection contains item.

Returns true or false.

(TypedList).__delitem__(i)

Aliases list.__delitem__().

Returns none.

(TypedCollection).__eq__(argument)

Is true when argument is a typed collection with items that compare equal to those of this typed collection.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

(TypedList).__getitem__(argument)

Gets item or slice identified by argument.

Returns item or slice.

(TypedCollection).__hash__()

Hashes typed collection.

Redefined in tandem with __eq__.

(TypedList).__iadd__(argument)

Adds argument in place to typed list.

>>> dynamic_list = abjad.TypedList(item_class=abjad.Dynamic)
>>> dynamic_list.append('ppp')
>>> dynamic_list += ['p', 'mp', 'mf', 'fff']
>>> abjad.f(dynamic_list)
abjad.TypedList(
    [
        abjad.Dynamic('ppp'),
        abjad.Dynamic('p'),
        abjad.Dynamic('mp'),
        abjad.Dynamic('mf'),
        abjad.Dynamic('fff'),
        ],
    item_class=abjad.Dynamic,
    )

Returns typed list.

__illustrate__(key=None, range_=None, sortkey=None, scale=None)

Illustrates timespans.

Illustrates timespans:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespan_operand = abjad.Timespan(6, 10)
>>> timespans = timespans - timespan_operand
>>> abjad.show(timespans, scale=0.5) 

Returns LilyPond file.

__invert__()

Inverts timespans.

Inverts timespans:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.show(~timespans, range_=(-2, 30), scale=0.5) 
>>> abjad.f(~timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(8, 1),
            stop_offset=abjad.Offset(15, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(20, 1),
            stop_offset=abjad.Offset(24, 1),
            ),
        ]
    )

Inverts contiguous timespans:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> ~timespans
TimespanList([])

Returns new timespan list.

(TypedCollection).__iter__()

Iterates typed collection.

Returns generator.

(TypedCollection).__len__()

Gets length of typed collection.

Returns nonnegative integer.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

(TypedList).__reversed__()

Aliases list.__reversed__().

Returns generator.

(TypedList).__setitem__(i, argument)

Sets item i equal to argument.

Sets item:

>>> pitch_list = abjad.TypedList(
...     item_class=abjad.NamedPitch,
...     )
>>> pitch_list.append(0)
>>> pitch_list.append("d'")
>>> pitch_list.append(('e', 4))
>>> pitch_list.append(abjad.NamedPitch("f'"))
>>> pitch_list[-1] = 'gqs,'
>>> abjad.f(pitch_list)
abjad.TypedList(
    [
        abjad.NamedPitch("c'"),
        abjad.NamedPitch("d'"),
        abjad.NamedPitch("e'"),
        abjad.NamedPitch('gqs,'),
        ],
    item_class=abjad.NamedPitch,
    )

Sets slice:

>>> pitch_list[-1:] = ["f'", "g'", "a'", "b'", "c''"]
>>> abjad.f(pitch_list)
abjad.TypedList(
    [
        abjad.NamedPitch("c'"),
        abjad.NamedPitch("d'"),
        abjad.NamedPitch("e'"),
        abjad.NamedPitch("f'"),
        abjad.NamedPitch("g'"),
        abjad.NamedPitch("a'"),
        abjad.NamedPitch("b'"),
        abjad.NamedPitch("c''"),
        ],
    item_class=abjad.NamedPitch,
    )

Returns none.

__sub__(timespan)

Deletes material that intersects timespan.

Deletes material that intersects timespan:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespan = abjad.Timespan(5, 10)
>>> _ = timespans - timespan
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(-2, 1),
            stop_offset=abjad.Offset(5, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(5, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(10, 1),
            stop_offset=abjad.Offset(12, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(10, 1),
            stop_offset=abjad.Offset(16, 1),
            ),
        ]
    )
>>> abjad.show(timespans, scale=0.5) 

Operates in place and returns timespan list.


Methods

(TypedList).append(item)

Appends item to typed list.

>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.append('1')
>>> integer_list.append(2)
>>> integer_list.append(3.4)
>>> integer_list[:]
[1, 2, 3]

Returns none.

(MutableSequence).clear() → None -- remove all items from S
clip_timespan_durations(minimum=None, maximum=None, anchor=Left)

Clips timespan durations.

Clips timespan durations:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 1),
...     abjad.Timespan(0, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> result = timespans.clip_timespan_durations(
...     minimum=5,
...     )
>>> abjad.show(result, range_=(0, 10), scale=0.5) 
>>> abjad.f(result)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(5, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Clips timespan durations:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 1),
...     abjad.Timespan(0, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> result = timespans.clip_timespan_durations(
...     maximum=5,
...     )
>>> abjad.show(result, range_=(0, 10), scale=0.5) 
>>> abjad.f(result)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(1, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(5, 1),
            ),
        ]
    )

Clips timespan durations:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 1),
...     abjad.Timespan(0, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> result = timespans.clip_timespan_durations(
...     minimum=3,
...     maximum=7,
...     )
>>> abjad.show(result, range_=(0, 10), scale=0.5) 
>>> abjad.f(result)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(7, 1),
            ),
        ]
    )

Clips timespan durations:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 1),
...     abjad.Timespan(0, 10),
...     ])
>>> abjad.show(timespans, range_=(-2, 10), scale=0.5) 
>>> result = timespans.clip_timespan_durations(
...     minimum=3,
...     maximum=7,
...     anchor=abjad.Right,
...     )
>>> abjad.show(result, range_=(-2, 10), scale=0.5) 
>>> abjad.f(result)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(-2, 1),
            stop_offset=abjad.Offset(1, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Returns new timespan list.

compute_logical_and()

Computes logical AND of timespans.

Computes logical AND:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.compute_logical_and()
>>> abjad.show(timespans, range_=(0, 10), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Computes logical AND:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     abjad.Timespan(5, 12),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.compute_logical_and()
>>> abjad.show(timespans, range_=(0, 12), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Computes logical AND:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     ])
>>> abjad.show(timespans, range_=(-2, 12), scale=0.5) 
>>> _ = timespans.compute_logical_and()
>>> abjad.show(timespans, range_=(-2, 12), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(8, 1),
            ),
        ]
    )

Same as setwise intersection.

Operates in place and returns timespan list.

compute_logical_or()

Computes logical OR of timespans.

Computes logical OR:

>>> timespans = abjad.TimespanList()
>>> _ = timespans.compute_logical_or()
>>> timespans
TimespanList([])

Computes logical OR:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.compute_logical_or()
>>> abjad.show(timespans, range_=(0, 10), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Computes logical OR:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     abjad.Timespan(5, 12),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.compute_logical_or()
>>> abjad.show(timespans, range_=(0, 12), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(12, 1),
            ),
        ]
    )

Computes logical OR:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 2),
...     ])
>>> abjad.show(timespans, range_=(-2, 12), scale=0.5) 
>>> _ = timespans.compute_logical_or()
>>> abjad.show(timespans, range_=(-2, 12), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(-2, 1),
            stop_offset=abjad.Offset(12, 1),
            ),
        ]
    )

Computes logical OR:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(-2, 2),
...     abjad.Timespan(10, 20),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.compute_logical_or()
>>> abjad.show(timespans, range_=(-2, 20), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(-2, 1),
            stop_offset=abjad.Offset(2, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(10, 1),
            stop_offset=abjad.Offset(20, 1),
            ),
        ]
    )

Operates in place and returns timespan list.

compute_logical_xor()

Computes logical XOR of timespans.

Computes logical XOR:

>>> timespans = abjad.TimespanList()
>>> _ = timespans.compute_logical_xor()
>>> timespans
TimespanList([])

Computes logical XOR:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.compute_logical_xor()
>>> abjad.show(timespans, range_=(0, 10), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Computes logical XOR:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     abjad.Timespan(5, 12),
...     ])
>>> abjad.show(timespans, range_=(0, 12), scale=0.5) 
>>> _ = timespans.compute_logical_xor()
>>> abjad.show(timespans, range_=(0, 12), scale=0.5) 

Computes logical XOR:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 2),
...     ])
>>> abjad.show(timespans, range_=(0, 12), scale=0.5) 
>>> _ = timespans.compute_logical_xor()
>>> abjad.show(timespans, scale=0.5) 

Computes logical XOR:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(-2, 2),
...     abjad.Timespan(10, 20),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.compute_logical_xor()
>>> abjad.show(timespans, range_=(-2, 20), scale=0.5) 

Computes logical XOR:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     abjad.Timespan(4, 8),
...     abjad.Timespan(2, 6),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.compute_logical_xor()
>>> abjad.show(timespans, range_=(0, 10), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(2, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(8, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Computes logical XOR:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     abjad.Timespan(0, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.compute_logical_xor()
>>> timespans
TimespanList([])

Operates in place and returns timespan list.

compute_overlap_factor(timespan=None)

Computes overlap factor of timespans.

Example timespan list:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     abjad.Timespan(5, 15),
...     abjad.Timespan(20, 25),
...     abjad.Timespan(20, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 

Computes overlap factor across the entire list:

>>> timespans.compute_overlap_factor()
Multiplier(7, 6)

Computes overlap factor within a specific timespan:

>>> timespans.compute_overlap_factor(
...     timespan=abjad.Timespan(-15, 0))
Multiplier(0, 1)

Computes overlap factor:

>>> timespans.compute_overlap_factor(
...     timespan=abjad.Timespan(-10, 5),
...     )
Multiplier(1, 3)

Computes overlap factor:

>>> timespans.compute_overlap_factor(
...     timespan=abjad.Timespan(-5, 10))
Multiplier(1, 1)

Computes overlap factor:

>>> timespans.compute_overlap_factor(
...     timespan=abjad.Timespan(0, 15))
Multiplier(4, 3)

Computes overlap factor:

>>> timespans.compute_overlap_factor(
...     timespan=abjad.Timespan(5, 20))
Multiplier(1, 1)

Computes overlap factor:

>>> timespans.compute_overlap_factor(
...     timespan=abjad.Timespan(10, 25))
Multiplier(1, 1)

Computes overlap factor:

>>> timespans.compute_overlap_factor(
...     timespan=abjad.Timespan(15, 30))
Multiplier(1, 1)

Returns multiplier.

compute_overlap_factor_mapping()

Computes overlap factor for each consecutive offset pair in timespans.

Computes overlap factor mapping:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 10),
...     abjad.Timespan(5, 15),
...     abjad.Timespan(20, 25),
...     abjad.Timespan(20, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> mapping = timespans.compute_overlap_factor_mapping()
>>> for timespan, overlap_factor in mapping.items():
...     timespan.start_offset, timespan.stop_offset, overlap_factor
... 
(Offset(0, 1), Offset(5, 1), Multiplier(1, 1))
(Offset(5, 1), Offset(10, 1), Multiplier(2, 1))
(Offset(10, 1), Offset(15, 1), Multiplier(1, 1))
(Offset(15, 1), Offset(20, 1), Multiplier(0, 1))
(Offset(20, 1), Offset(25, 1), Multiplier(2, 1))
(Offset(25, 1), Offset(30, 1), Multiplier(1, 1))

Returns mapping.

(TypedList).count(item)

Gets count of item in typed list.

>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.extend([0, 0., '0', 99])
>>> integer_list.count(0)
3
>>> integer_list.count(1)
0
>>> integer_list.count(99)
1

Returns nonnegative integer.

count_offsets()

Counts offsets.

Counts offsets:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )
>>> offset_counter = timespans.count_offsets()
>>> abjad.show(offset_counter, range_=(0, 10), scale=0.5) 
>>> for offset, count in sorted(
...     timespans.count_offsets().items()):
...     offset, count
... 
(Offset(0, 1), 1)
(Offset(3, 1), 2)
(Offset(6, 1), 2)
(Offset(10, 1), 1)

Counts offsets:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(16, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(12, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(-2, 1),
            stop_offset=abjad.Offset(8, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(15, 1),
            stop_offset=abjad.Offset(20, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(24, 1),
            stop_offset=abjad.Offset(30, 1),
            ),
        ]
    )
>>> offset_counter = timespans.count_offsets()
>>> abjad.show(offset_counter, range_=(0, 30), scale=0.5) 
>>> for offset, count in sorted(
...     timespans.count_offsets().items()):
...     offset, count
... 
(Offset(-2, 1), 1)
(Offset(0, 1), 1)
(Offset(5, 1), 1)
(Offset(8, 1), 1)
(Offset(12, 1), 1)
(Offset(15, 1), 1)
(Offset(16, 1), 1)
(Offset(20, 1), 1)
(Offset(24, 1), 1)
(Offset(30, 1), 1)

Counts offsets:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(0, 6),
...     abjad.Timespan(0, 9),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> offset_counter = timespans.count_offsets()
>>> abjad.show(offset_counter, range_=(0, 9), scale=0.5) 
>>> for offset, count in sorted(
...     timespans.count_offsets().items()):
...     offset, count
... 
(Offset(0, 1), 3)
(Offset(3, 1), 1)
(Offset(6, 1), 1)
(Offset(9, 1), 1)

Returns counter.

explode(inventory_count=None)

Explodes timespans into timespan lists, avoiding overlap, and distributing density as evenly as possible.

Example timespan list:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(5, 13),
...     abjad.Timespan(6, 10),
...     abjad.Timespan(8, 9),
...     abjad.Timespan(15, 23),
...     abjad.Timespan(16, 21),
...     abjad.Timespan(17, 19),
...     abjad.Timespan(19, 20),
...     abjad.Timespan(25, 30),
...     abjad.Timespan(26, 29),
...     abjad.Timespan(32, 34),
...     abjad.Timespan(34, 37),
...     ])
>>> abjad.show(timespans, scale=0.5) 

Explodes timespans into the optimal number of non-overlapping timespan_lists:

>>> for exploded_timespan_list in timespans.explode():
...     abjad.f(exploded_timespan_list)
... 
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(13, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(17, 1),
            stop_offset=abjad.Offset(19, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(19, 1),
            stop_offset=abjad.Offset(20, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(34, 1),
            stop_offset=abjad.Offset(37, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(16, 1),
            stop_offset=abjad.Offset(21, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(25, 1),
            stop_offset=abjad.Offset(30, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(8, 1),
            stop_offset=abjad.Offset(9, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(15, 1),
            stop_offset=abjad.Offset(23, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(26, 1),
            stop_offset=abjad.Offset(29, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(32, 1),
            stop_offset=abjad.Offset(34, 1),
            ),
        ]
    )

Explodes timespans into a less-than-optimal number of overlapping timespan_lists:

>>> for exploded_timespan_list in timespans.explode(
...     inventory_count=2):
...     abjad.f(exploded_timespan_list)
... 
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(13, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(15, 1),
            stop_offset=abjad.Offset(23, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(25, 1),
            stop_offset=abjad.Offset(30, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(34, 1),
            stop_offset=abjad.Offset(37, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(8, 1),
            stop_offset=abjad.Offset(9, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(16, 1),
            stop_offset=abjad.Offset(21, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(17, 1),
            stop_offset=abjad.Offset(19, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(19, 1),
            stop_offset=abjad.Offset(20, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(26, 1),
            stop_offset=abjad.Offset(29, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(32, 1),
            stop_offset=abjad.Offset(34, 1),
            ),
        ]
    )

Explodes timespans into a greater-than-optimal number of non-overlapping timespan lists:

>>> for exploded_timespan_list in timespans.explode(
...     inventory_count=6):
...     abjad.f(exploded_timespan_list)
... 
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(16, 1),
            stop_offset=abjad.Offset(21, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(34, 1),
            stop_offset=abjad.Offset(37, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(15, 1),
            stop_offset=abjad.Offset(23, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(8, 1),
            stop_offset=abjad.Offset(9, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(17, 1),
            stop_offset=abjad.Offset(19, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(19, 1),
            stop_offset=abjad.Offset(20, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(26, 1),
            stop_offset=abjad.Offset(29, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(32, 1),
            stop_offset=abjad.Offset(34, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(13, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(25, 1),
            stop_offset=abjad.Offset(30, 1),
            ),
        ]
    )

Returns timespan lists.

(TypedList).extend(items)

Extends typed list with items.

>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.extend(['0', 1.0, 2, 3.14159])
>>> integer_list
TypedList([0, 1, 2, 3], item_class=int)

Returns none.

get_timespan_that_satisfies_time_relation(time_relation)

Gets timespan that satisifies time_relation.

Gets timespan:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespan = abjad.Timespan(2, 5)
>>> time_relation = abjad.timespans.timespan_2_starts_during_timespan_1(
...     timespan_1=timespan)
>>> timespan = timespans.get_timespan_that_satisfies_time_relation(
...     time_relation)
>>> abjad.show(timespan, range_=(0, 10), scale=0.5) 
>>> timespan
Timespan(start_offset=Offset(3, 1), stop_offset=Offset(6, 1))

Returns timespan when timespan list contains exactly one timespan that satisfies time_relation.

Raises exception when timespan list contains no timespan that satisfies time_relation.

Raises exception when timespan list contains more than one timespan that satisfies time_relation.

get_timespans_that_satisfy_time_relation(time_relation)

Gets timespans that satisfy time_relation.

Gets timespans:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespan = abjad.Timespan(2, 8)
>>> time_relation = abjad.timespans.timespan_2_starts_during_timespan_1(
...     timespan_1=timespan)
>>> result = timespans.get_timespans_that_satisfy_time_relation(
...     time_relation)
>>> abjad.show(result, range_=(0, 10), scale=0.5) 
>>> abjad.f(result)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Returns new timespan list.

has_timespan_that_satisfies_time_relation(time_relation)

Is true when timespan list has timespan that satisfies time_relation.

Is true when list has matching timespan:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespan = abjad.Timespan(2, 8)
>>> time_relation = abjad.timespans.timespan_2_starts_during_timespan_1(
...     timespan_1=timespan)
>>> timespans.has_timespan_that_satisfies_time_relation(
...     time_relation)
True

Is false when list does not have matching timespan:

>>> timespan = abjad.Timespan(10, 20)
>>> time_relation = abjad.timespans.timespan_2_starts_during_timespan_1(
...     timespan_1=timespan)
>>> timespans.has_timespan_that_satisfies_time_relation(
...     time_relation)
False

Returns true or false.

(TypedList).index(item)

Gets index of item in typed list.

>>> pitch_list = abjad.TypedList(
...     item_class=abjad.NamedPitch,
...     )
>>> pitch_list.extend(['cqf', "as'", 'b,', 'dss'])
>>> pitch_list.index(abjad.NamedPitch('cqf'))
0
>>> pitch_list.index(abjad.NamedPitch("as'"))
1
>>> pitch_list.index('b,')
2
>>> pitch_list.index('dss')
3

Returns nonnegative integer.

(TypedList).insert(i, item)

Insert item into typed list.

Inserts into typed list.

>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.extend(['1', 2, 4.3])
>>> integer_list
TypedList([1, 2, 4], item_class=int)
>>> integer_list.insert(0, '0')
>>> integer_list
TypedList([0, 1, 2, 4], item_class=int)
>>> integer_list.insert(1, '9')
>>> integer_list
TypedList([0, 9, 1, 2, 4], item_class=int)

Returns none.

partition(include_tangent_timespans=False)

Partitions timespans into timespan_lists.

Partitions timespans:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )
>>> for timespan_list in timespans.partition():
...     abjad.f(timespan_list)
... 
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Partitions timespans:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(16, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(12, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(-2, 1),
            stop_offset=abjad.Offset(8, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(15, 1),
            stop_offset=abjad.Offset(20, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(24, 1),
            stop_offset=abjad.Offset(30, 1),
            ),
        ]
    )
>>> for timespan_list in timespans.partition():
...     abjad.f(timespan_list)
... 
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(-2, 1),
            stop_offset=abjad.Offset(8, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(16, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(12, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(15, 1),
            stop_offset=abjad.Offset(20, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(24, 1),
            stop_offset=abjad.Offset(30, 1),
            ),
        ]
    )

Treats tangent timespans as part of the same group when include_tangent_timespans is true:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> for timespan_list in timespans.partition(
...     include_tangent_timespans=True,
...     ):
...     abjad.f(timespan_list)
... 
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Returns zero or more timespan_lists.

(TypedList).pop(i=-1)

Pops item i from typed list.

Returns item.

reflect(axis=None)

Reflects timespans.

Reflects timespans about timespan list axis:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.reflect()
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(4, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(4, 1),
            stop_offset=abjad.Offset(7, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(7, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Reflects timespans about arbitrary axis:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, range_=(0, 30), scale=0.5) 
>>> _ = timespans.reflect(axis=abjad.Offset(15))
>>> abjad.show(timespans, range_=(0, 30), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(20, 1),
            stop_offset=abjad.Offset(24, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(24, 1),
            stop_offset=abjad.Offset(27, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(27, 1),
            stop_offset=abjad.Offset(30, 1),
            ),
        ]
    )

Operates in place and returns timespan list.

(TypedList).remove(item)

Removes item from typed list.

>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.extend(('0', 1.0, 2, 3.14159))
>>> integer_list[:]
[0, 1, 2, 3]
>>> integer_list.remove('1')
>>> integer_list[:]
[0, 2, 3]

Returns none.

remove_degenerate_timespans()

Removes degenerate timespans.

Removes degenerate timespans:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(5, 5),
...     abjad.Timespan(5, 10),
...     abjad.Timespan(5, 25),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.remove_degenerate_timespans()
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(25, 1),
            ),
        ]
    )

Operates in place and returns timespan list.

repeat_to_stop_offset(stop_offset)

Repeats timespans to stop_offset.

Repeats timespans to stop offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, range_=(0, 15), scale=0.5) 
>>> _ = timespans.repeat_to_stop_offset(15)
>>> abjad.show(timespans, range_=(0, 15), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(10, 1),
            stop_offset=abjad.Offset(13, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(13, 1),
            stop_offset=abjad.Offset(15, 1),
            ),
        ]
    )

Operates in place and returns timespan list.

(TypedList).reverse()

Reverses items in typed list.

rotate(count)

Rotates by count contiguous timespans.

Rotates by one timespan to the left:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 4),
...     abjad.Timespan(4, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.rotate(-1)
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(1, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(1, 1),
            stop_offset=abjad.Offset(7, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(7, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Rotates by one timespan to the right:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 4),
...     abjad.Timespan(4, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> _ = timespans.rotate(1)
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(9, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(9, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Operates in place and returns timespan list.

round_offsets(multiplier, anchor=Left, must_be_well_formed=True)

Rounds offsets of timespans in list to multiples of multiplier.

Rounds offsets:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 2),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> rounded_timespans = timespans.round_offsets(3)
>>> abjad.show(rounded_timespans, range_=(0, 10), scale=0.5) 
>>> abjad.f(rounded_timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(9, 1),
            ),
        ]
    )

Rounds offsets:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 2),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> rounded_timespans = timespans.round_offsets(5)
>>> abjad.show(rounded_timespans, scale=0.5) 
>>> abjad.f(rounded_timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(5, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Rounds offsets:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 2),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, range_=(-5, 10), scale=0.5) 
>>> rounded_timespans = timespans.round_offsets(
...     5,
...     anchor=abjad.Right,
...     )
>>> abjad.show(rounded_timespans, range_=(-5, 10), scale=0.5) 
>>> abjad.f(rounded_timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(-5, 1),
            stop_offset=abjad.Offset(0, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(5, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Rounds offsets:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 2),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> rounded_timespans = timespans.round_offsets(
...     5,
...     anchor=abjad.Right,
...     must_be_well_formed=False,
...     )
>>> abjad.f(rounded_timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(0, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(5, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(5, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Operates in place and returns timespan list.

scale(multiplier, anchor=Left)

Scales timespan by multiplier relative to anchor.

Scales timespans relative to timespan list start offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, range_=(0, 14), scale=0.5) 
>>> _ = timespans.scale(2)
>>> abjad.show(timespans, range_=(0, 14), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(9, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(14, 1),
            ),
        ]
    )

Scales timespans relative to timespan list stop offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, range_=(-3, 10), scale=0.5) 
>>> _ = timespans.scale(2, anchor=abjad.Right)
>>> abjad.show(timespans, range_=(-3, 10), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(-3, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(2, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Operates in place and returns timespan list.

(TypedList).sort(cmp=None, key=None, reverse=False)

Sorts items in typed list.

split_at_offset(offset)

Splits timespans at offset.

Splits at offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> left, right = timespans.split_at_offset(4)
>>> abjad.show(left, range_=(0, 10), scale=0.5) 
>>> abjad.f(left)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(4, 1),
            ),
        ]
    )
>>> abjad.show(right, range_=(0, 10), scale=0.5) 
>>> abjad.f(right)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(4, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Splits at offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> left, right = timespans.split_at_offset(6)
>>> abjad.show(left, range_=(0, 10), scale=0.5) 
>>> abjad.f(left)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        ]
    )
>>> abjad.show(right, range_=(0, 10), scale=0.5) 
>>> abjad.f(right)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Splits at offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> left, right = timespans.split_at_offset(-1)
>>> left
TimespanList([])
>>> abjad.show(right, range_=(0, 10), scale=0.5) 
>>> abjad.f(right)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )

Returns timespan_lists.

split_at_offsets(offsets)

Splits timespans at offsets.

Splits at offsets:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(4, 10),
...     abjad.Timespan(15, 20),
...     ])
>>> abjad.show(timespans, range_=(0, 20), scale=0.5) 
>>> offsets = [-1, 3, 6, 12, 13]
>>> for timespan_list in timespans.split_at_offsets(offsets):
...     abjad.show(timespan_list, range_=(0, 20), scale=0.5) 
...     abjad.f(timespan_list)
... 
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(3, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(4, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(10, 1),
            ),
        ]
    )
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(15, 1),
            stop_offset=abjad.Offset(20, 1),
            ),
        ]
    )

Splits empty list:

>>> timespans = abjad.TimespanList([])
>>> timespans.split_at_offsets(offsets)
[TimespanList([])]

Returns one or more timespan_lists.

stretch(multiplier, anchor=None)

Stretches timespans by multiplier relative to anchor.

Stretches timespans relative to timespan list start offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, range_=(0, 20), scale=0.5) 
>>> _ = timespans.stretch(2)
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(6, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(12, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(12, 1),
            stop_offset=abjad.Offset(20, 1),
            ),
        ]
    )

Stretches timespans relative to arbitrary anchor:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, range_=(-8, 12), scale=0.5) 
>>> _ = timespans.stretch(2, anchor=abjad.Offset(8))
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(-8, 1),
            stop_offset=abjad.Offset(-2, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(-2, 1),
            stop_offset=abjad.Offset(4, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(4, 1),
            stop_offset=abjad.Offset(12, 1),
            ),
        ]
    )

Operates in place and returns timespan list.

translate(translation=None)

Translates timespans by translation.

Translates timespan by offset 50:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, range_=(0, 60), scale=0.5) 
>>> _ = timespans.translate(50)
>>> abjad.show(timespans, range_=(0, 60), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(50, 1),
            stop_offset=abjad.Offset(53, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(53, 1),
            stop_offset=abjad.Offset(56, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(56, 1),
            stop_offset=abjad.Offset(60, 1),
            ),
        ]
    )

Operates in place and returns timespan list.

translate_offsets(start_offset_translation=None, stop_offset_translation=None)

Translates timespans by start_offset_translation and stop_offset_translation.

Translates timespan start- and stop-offsets equally:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, range_=(0, 60), scale=0.5) 
>>> _ = timespans.translate_offsets(50, 50)
>>> abjad.show(timespans, range_=(0, 60), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(50, 1),
            stop_offset=abjad.Offset(53, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(53, 1),
            stop_offset=abjad.Offset(56, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(56, 1),
            stop_offset=abjad.Offset(60, 1),
            ),
        ]
    )

Translates timespan stop-offsets only:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, range_=(0, 30), scale=0.5) 
>>> _ = timespans.translate_offsets(
...     stop_offset_translation=20)
>>> abjad.show(timespans, range_=(0, 30), scale=0.5) 
>>> abjad.f(timespans)
abjad.TimespanList(
    [
        abjad.Timespan(
            start_offset=abjad.Offset(0, 1),
            stop_offset=abjad.Offset(23, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(3, 1),
            stop_offset=abjad.Offset(26, 1),
            ),
        abjad.Timespan(
            start_offset=abjad.Offset(6, 1),
            stop_offset=abjad.Offset(30, 1),
            ),
        ]
    )

Operates in place and returns timespan list.


Read/write properties

(TypedList).keep_sorted

Is true when typed list keeps items sorted.

Defaults to none.

Set to true, false or none.

Returns true, false or none.


Read-only properties

all_are_contiguous

Is true when all timespans are contiguous.

Is true when all timespans are contiguous:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.all_are_contiguous
True

Is false when timespans not contiguous:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.all_are_contiguous
False

Is true when timespan list is empty:

>>> abjad.TimespanList().all_are_contiguous
True

Returns true or false.

all_are_nonoverlapping

Is true when all timespans are nonoverlapping.

Is true when all timespans are nonoverlapping:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.all_are_nonoverlapping
True

Is false when timespans are overlapping:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.all_are_nonoverlapping
False

Is true when timespan list is empty:

>>> abjad.TimespanList().all_are_nonoverlapping
True

Returns true or false.

all_are_well_formed

Is true when all timespans are well-formed.

Is true when all timespans are well-formed:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.all_are_well_formed
True

Is true when all timespans are well-formed:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.all_are_well_formed
True

Is true when timespan list is empty:

>>> abjad.TimespanList().all_are_well_formed
True

Is false when timespans are not all well-formed.

Returns true or false.

axis

Gets axis defined equal to arithmetic mean of start- and stop-offsets.

Gets axis:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.axis
Offset(5, 1)

Gets axis:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.axis
Offset(14, 1)

Gets none when timespan list is empty:

>>> abjad.TimespanList().axis is None
True

Returns offset or none.

duration

Gets duration of timespan list.

Gets duration:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.duration
Duration(10, 1)

Gets duration:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.duration
Duration(32, 1)

Gets zero when timespan list is empty:

>>> abjad.TimespanList().duration
Duration(0, 1)

Returns duration.

is_sorted

Is true when timespans are in time order.

Is true when timespans are sorted:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.is_sorted
True

Is false when timespans are not sorted:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(6, 10),
...     abjad.Timespan(3, 6),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.is_sorted
False

Returns true or false.

(TypedCollection).item_class

Gets item class of collection.

Collection coerces items according to item_class.

Returns class.

(TypedCollection).items

Gets items in collection.

Returns list.

start_offset

Gets start offset.

Defined equal to earliest start offset of any timespan in list.

Gets start offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.start_offset
Offset(0, 1)

Gets start offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.start_offset
Offset(-2, 1)

Gets negative infinity when timespan list is empty:

>>> abjad.TimespanList().start_offset
NegativeInfinity

Returns offset or none.

stop_offset

Gets stop offset.

Defined equal to latest stop offset of any timespan.

Gets stop offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.stop_offset
Offset(10, 1)

Gets stop offset:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> timespans.stop_offset
Offset(30, 1)

Gets infinity when timespan list is empty:

>>> abjad.TimespanList().stop_offset
Infinity

Returns offset or none.

timespan

Gets timespan of timespan list.

Gets timespan:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 3),
...     abjad.Timespan(3, 6),
...     abjad.Timespan(6, 10),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.show(timespans.timespan, range_=(0, 10), scale=0.5) 
>>> timespans.timespan
Timespan(start_offset=Offset(0, 1), stop_offset=Offset(10, 1))

Gets timespan:

>>> timespans = abjad.TimespanList([
...     abjad.Timespan(0, 16),
...     abjad.Timespan(5, 12),
...     abjad.Timespan(-2, 8),
...     abjad.Timespan(15, 20),
...     abjad.Timespan(24, 30),
...     ])
>>> abjad.show(timespans, scale=0.5) 
>>> abjad.show(timespans.timespan, range_=(0, 30), scale=0.5) 
>>> timespans.timespan
Timespan(start_offset=Offset(-2, 1), stop_offset=Offset(30, 1))

Gets infinite timespan when list is empty:

>>> abjad.TimespanList().timespan
Timespan(start_offset=NegativeInfinity, stop_offset=Infinity)

Returns timespan.