OffsetTimespanTimeRelation

class timespantools.OffsetTimespanTimeRelation(inequality=None, timespan=None, offset=None)

An offset vs. timespan time relation.

>>> offset = Offset(5)
>>> timespan = timespantools.Timespan(0, 10)
>>> time_relation = timespantools.offset_happens_during_timespan(
...     offset=offset,
...     timespan=timespan,
...     hold=True,
...     )
>>> print(format(time_relation))
timespantools.OffsetTimespanTimeRelation(
    inequality=timespantools.CompoundInequality(
        [
            timespantools.Inequality('timespan.start <= offset'),
            timespantools.Inequality('offset < timespan.stop'),
            ],
        logical_operator='and',
        ),
    timespan=timespantools.Timespan(
        start_offset=durationtools.Offset(0, 1),
        stop_offset=durationtools.Offset(10, 1),
        ),
    offset=durationtools.Offset(5, 1),
    )

Offset / timespan time relations are immutable.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_timespantools { graph [label=timespantools]; "abjad.tools.timespantools.OffsetTimespanTimeRelation.OffsetTimespanTimeRelation" [color=black, fontcolor=white, group=2, label=<<B>OffsetTimespanTimeRelation</B>>, shape=box, style="filled, rounded"]; "abjad.tools.timespantools.TimeRelation.TimeRelation" [color=3, group=2, label=TimeRelation, shape=oval, style=bold]; "abjad.tools.timespantools.TimeRelation.TimeRelation" -> "abjad.tools.timespantools.OffsetTimespanTimeRelation.OffsetTimespanTimeRelation"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.timespantools.TimeRelation.TimeRelation"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

inequality Time relation inequality.
is_fully_loaded Is true when timespan and offset are both not none.
is_fully_unloaded Is true when timespan and offset are both none.
offset Time relation offset:
timespan Time relation timepsan:
__call__([timespan, offset]) Evaluates time relation:
__eq__(argument) Is true when argument equals time relation.
__format__([format_specification]) Formats time relation.
__hash__() Hashes time relation.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

(TimeRelation).inequality

Time relation inequality.

Return ineqality.

OffsetTimespanTimeRelation.is_fully_loaded

Is true when timespan and offset are both not none. Otherwise false:

>>> time_relation.is_fully_loaded
True

Returns true or false.

OffsetTimespanTimeRelation.is_fully_unloaded

Is true when timespan and offset are both none. Otherwise false:

>>> time_relation.is_fully_unloaded
False

Returns true or false.

OffsetTimespanTimeRelation.offset

Time relation offset:

>>> time_relation.offset
Offset(5, 1)

Returns offset or none.

OffsetTimespanTimeRelation.timespan

Time relation timepsan:

>>> time_relation.timespan
Timespan(start_offset=Offset(0, 1), stop_offset=Offset(10, 1))

Returns timespan or none.

Special methods

OffsetTimespanTimeRelation.__call__(timespan=None, offset=None)

Evaluates time relation:

>>> time_relation()
True

Raises value error is either offset or timespan is none.

Otherwise returns boolean.

OffsetTimespanTimeRelation.__eq__(argument)

Is true when argument equals time relation. Otherwise false:

>>> offset = Offset(5)
>>> time_relation_1 = \
...     timespantools.offset_happens_during_timespan()
>>> time_relation_2 = \
...     timespantools.offset_happens_during_timespan(
...     offset=offset)
>>> time_relation_1 == time_relation_1
True
>>> time_relation_1 == time_relation_2
False
>>> time_relation_2 == time_relation_2
True

Returns true or false.

OffsetTimespanTimeRelation.__format__(format_specification='')

Formats time relation.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

>>> print(format(time_relation))
timespantools.OffsetTimespanTimeRelation(
    inequality=timespantools.CompoundInequality(
        [
            timespantools.Inequality('timespan.start <= offset'),
            timespantools.Inequality('offset < timespan.stop'),
            ],
        logical_operator='and',
        ),
    timespan=timespantools.Timespan(
        start_offset=durationtools.Offset(0, 1),
        stop_offset=durationtools.Offset(10, 1),
        ),
    offset=durationtools.Offset(5, 1),
    )

Returns string.

OffsetTimespanTimeRelation.__hash__()

Hashes time relation.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(AbjadObject).__ne__(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.