FoscTimespan

Returns a FoscTimespan.


Description

Timespan.

Timespans are closed-open intervals.

Timespans are immutable.


Attributes Summary

Instance Properties

axis Arithmetic mean of startOffset and stopOffset.
duration Duration of timespan.
isWellFormed Is true when timespan start offset preceeds timespan stop offset.
offsets Timespan offsets.
startOffset Timespan start offset.
stopOffset Timespan stop offset.

Instance Methods: Special Methods

== (abjad: eq)
>= (abjad: ge)
> (abjad: gt)
<= (abjad: le)
< (abjad: lt )
asCompileString Formats timespan.
format Formats timespan.
hash Hashes timespan.
illustrate Illustrates timespan.
show
size Defined equal to 1 for all timespans.

Instance Methods: Set Operations

- (abjad: sub, -)
sect (abjad: and, &)
symmetricDifference (abjad: xor, ^)
union (abjad: or,

Instance Methods

containsTimespanImproperly Is true when timespan contains timespan improperly.
curtailsTimespan Is true when timespan curtails timespan.
delaysTimespan Is true when timespan delays timespan.
getOverlapWithTimespan Gets duration of overlap with timespan.
happensDuringTimespan Is true when timespan happens during timespan.
intersectsTimespan Is true when timespan intersects timespan.
isCongruentToTimespan Is true when timespan is congruent to timespan.
isTangentToTimespan Is true when timespan is tangent to timespan.
overlapsAllOfTimespan Is true when timespan overlaps all of timespan.
overlapsOnlyStartOfTimespan Is true when timespan overlaps only start of timespan.
overlapsOnlyStopOfTimespan Is true when timespan overlaps only stop of timespan.
overlapsStartOfTimespan Is true when timespan overlaps start of timespan.
overlapsStopOfTimespan Is true when timespan overlaps stop of timespan.
partitionByRatio (abjad: divide_by_ratio)
reflect Reflects timespan about axis.
roundOffsets Rounds timespan offsets to multiple of multiplier.
scale Scales timespan by multiplier.
setDuration Sets timespan duration to duration.
setOffsets Sets timespan start offset to startOffset and stop offset to stopOffset.
splitAtOffset Split into two parts when offset happens during timespan.
splitAtOffsets Split into one or more parts when offsets happens during timespan.
startsAfterOffset Is true when timespan overlaps start of offset.
startsAfterTimespanStarts Is true when timespan starts after timespan starts.
startsAfterTimespanStops Is true when timespan stops after timespan stops.
startsAtOffset Is true when timespan starts at offset.
startsAtOrAfterOffset Is true when timespan starts at or after offset.
startsBeforeOffset Is true when timespan starts before offset.
startsBeforeOrAtOffset Is true when timespan starts before or at offset.
startsBeforeTimespanStarts Is true when timespan starts before timespan starts.
startsBeforeTimespanStops Is true when timespan starts before timespan stops.
startsDuringTimespan Is true when timespan starts during timespan.
startsWhenTimespanStarts Is true when timespan starts when timespan starts.
startsWhenTimespanStops Is true when timespan starts when timespan stops.
stopsAfterOffset Is true when timespan stops after offset.
stopsAfterTimespanStarts Is true when timespan stops after timespan starts.
stopsAfterTimespanStops Is true when timespan stops after timespan stops.
stopsAtOffset Is true when timespan stops at offset.
stopsAtOrAfterOffset Is true when timespan stops at or after offset.
stopsBeforeOffset Is true when timespan stops before offset.
stopsBeforeOrAtOffset Is true when timespan stops before or at offset.
stopsBeforeTimespanStarts Is true when timespan stops before timespan starts.
stopsBeforeTimespanStops Is true when timespan stops before timespan stops.
stopsDuringTimespan Is true when timespan stops during timespan.
stopsWhenTimespanStarts Is true when timespan stops when timespan starts.
stopsWhenTimespanStops Is true when timespan stops when timespan stops.
stretch Stretches timespan by multiplier relative to anchor.
translate Translates timespan by translation.
translateOffsets Translates timespan start offset by start_offset_translation and stop offset by stop_offset_translation.
trisectsTimespan Is true when timespan trisects timespan.


Instance Properties


axis

Arithmetic mean of startOffset and stopOffset.

  1. Example

    FoscTimespan(0, 10).axis.cs;
    FoscOffset(5, 1)


duration

Duration of timespan.

  1. Example

    FoscTimespan(0, 10).duration.cs;
    FoscDuration(10, 1)


isWellFormed

Is true when timespan start offset preceeds timespan stop offset.

  1. Example

    FoscTimespan(0, 10).isWellFormed;
    true


offsets

Timespan offsets.

  1. Example

    FoscTimespan(0, 10).offsets.collect { |each| each.cs };
    [ "FoscOffset(0, 1)", "FoscOffset(10, 1)" ]


startOffset

Timespan start offset.

  1. Example

    FoscTimespan(0, 10).startOffset.cs;
    FoscOffset(0, 1)


stopOffset

Timespan stop offset.

  1. Example

    FoscTimespan(0, 10).stopOffset.cs;
    FoscOffset(10, 1)


Instance Methods: Special Methods


==

(abjad: eq)

Is true when timespan is a timespan with equal offsets. Otherwise false:

Returns true or false.

  1. Example

    FoscTimespan(1, 3) == FoscTimespan(1, 3);
    true
    FoscTimespan(1, 3) == FoscTimespan(2, 3);
    false


>=

(abjad: ge)

Is true when argument start offset is greater or equal to timespan start offset. Otherwise false:

Returns true or false.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 12);
    c = FoscTimespan(-2, 2);
    
    b >= c;
    true
    a >= b;
    false


>

(abjad: gt)

Is true when argument start offset is greater than timespan start offset. Otherwise false:

Returns true or false.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 12);
    c = FoscTimespan(-2, 2);
    
    b > c;
    true
    a > b;
    false


<=

(abjad: le)

Is true when argument start offset is less than or equal to timespan start offset. Otherwise false:

Returns true or false.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 12);
    c = FoscTimespan(-2, 2);
    
    b <= c;
    false
    a <= b;
    true


<

(abjad: lt )

Is true when argument start offset is less than timespan start offset. Otherwise false:

Returns true or false.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 12);
    c = FoscTimespan(-2, 2);
    
    b < c;
    false
    a < b;
    true


asCompileString

Formats timespan.

Returns string.

  1. Example

    FoscTimespan(1, 3).cs;
    FoscTimespan(1/1, 3/1)


format

Formats timespan.

Returns string.

  1. Example

    FoscTimespan(0, 10).format;
    FoscTimespan(0/1, 10/1)


hash

Hashes timespan.


illustrate

Illustrates timespan.

Returns Lilypond file.


show


size

Defined equal to 1 for all timespans.

Returns positive integer.


Instance Methods: Set Operations


-

(abjad: sub, -)

Subtract timespan from receiver.

Returns timespan list.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 12);
    c = FoscTimespan(-2, 2);
    d = FoscTimespan(10, 20);
    
    x = a - a;
    x.items.collect { |each| each.cs };
    [  ]
    x = a - b;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 5/1)" ]
    x = a - c;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(2/1, 10/1)" ]
    x = a - d;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 10/1)" ]
    x = b - a;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(10/1, 12/1)" ]
    x = b - b;
    x.items.collect { |each| each.cs };
    [  ]
    x = b - c;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(5/1, 12/1)" ]
    x = b - d;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(5/1, 10/1)" ]
    x = c - a;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(-2/1, 0/1)" ]
    x = c - b;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(-2/1, 2/1)" ]
    x = c - c;
    x.items.collect { |each| each.cs };
    [  ]
    x = c - d;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(-2/1, 2/1)" ]
    x = d - a;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(10/1, 20/1)" ]
    x = d - b;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(12/1, 20/1)" ]
    x = d - c;
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(10/1, 20/1)" ]
    x = d - d;
    x.items.collect { |each| each.cs };
    [  ]


sect

(abjad: and, &)

Intersection of receiver and timespan (Logical AND).

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 12);
    c = FoscTimespan(-2, 2);
    d = FoscTimespan(10, 20);
    
    x = a.sect(b);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(5/1, 10/1)" ]
    x = a.sect(c);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 2/1)" ]
    x = a.sect(d);
    x.items.collect { |each| each.cs };
    [  ]
    x = b.sect(c);
    x.items.collect { |each| each.cs };
    [  ]
    x = b.sect(d);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(10/1, 12/1)" ]
    x = c.sect(d);
    x.items.collect { |each| each.cs };
    [  ]


symmetricDifference

(abjad: xor, ^)

Symmetric difference of receiver and timespan (Logical XOR).

Returns timespan list.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 12);
    c = FoscTimespan(-2, 2);
    d = FoscTimespan(10, 20);
    
    x = a.symmetricDifference(b);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 5/1)", "FoscTimespan(10/1, 12/1)" ]
    x = a.symmetricDifference(c);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(-2/1, 0/1)", "FoscTimespan(2/1, 10/1)" ]
    x = a.symmetricDifference(d);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 10/1)", "FoscTimespan(10/1, 20/1)" ]
    x = b.symmetricDifference(c);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(-2/1, 2/1)", "FoscTimespan(5/1, 12/1)" ]
    x = b.symmetricDifference(d);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(5/1, 10/1)", "FoscTimespan(12/1, 20/1)" ]
    x = c.symmetricDifference(d);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(-2/1, 2/1)", "FoscTimespan(10/1, 20/1)" ]


union

(abjad: or, |)

Union of receiver and timespan (Logical OR).

Returns timespan list.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 12);
    c = FoscTimespan(-2, 2);
    d = FoscTimespan(10, 20);
    
    x = a.union(b);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 12/1)" ]
    x = a.union(c);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(-2/1, 10/1)" ]
    x = a.union(d);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 20/1)" ]
    x = b.union(c);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(-2/1, 2/1)", "FoscTimespan(5/1, 12/1)" ]
    x = b.union(d);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(5/1, 20/1)" ]
    x = c.union(d);
    x.items.collect { |each| each.cs };
    [ "FoscTimespan(-2/1, 2/1)", "FoscTimespan(10/1, 20/1)" ]


Instance Methods


containsTimespanImproperly

Is true when timespan contains timespan improperly.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 10);
    
    a.containsTimespanImproperly(a);
    true
    a.containsTimespanImproperly(b);
    true
    b.containsTimespanImproperly(a);
    false
    b.containsTimespanImproperly(b);
    true


curtailsTimespan

Is true when timespan curtails timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 10);
    
    a.curtailsTimespan(a);
    false
    a.curtailsTimespan(b);
    false
    b.curtailsTimespan(a);
    true
    b.curtailsTimespan(b);
    false


delaysTimespan

Is true when timespan delays timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 15);
    c = FoscTimespan(10, 20);
    
    a.delaysTimespan(b);
    true
    b.delaysTimespan(c);
    true
    b.delaysTimespan(a);
    false


getOverlapWithTimespan

Gets duration of overlap with timespan.

  1. Example

    a = FoscTimespan(0, 15);
    b = FoscTimespan(5, 10);
    c = FoscTimespan(6, 6);
    d = FoscTimespan(12, 22);
    
    a.getOverlapWithTimespan(a).cs;
    FoscDuration(15, 1)
    a.getOverlapWithTimespan(b).cs;
    FoscDuration(5, 1)
    a.getOverlapWithTimespan(c).cs;
    FoscDuration(0, 1)
    a.getOverlapWithTimespan(d).cs;
    FoscDuration(3, 1)
    b.getOverlapWithTimespan(b).cs;
    FoscDuration(5, 1)
    b.getOverlapWithTimespan(c).cs;
    FoscDuration(0, 1)
    b.getOverlapWithTimespan(d).cs;
    FoscDuration(0, 1)
    c.getOverlapWithTimespan(c).cs;
    FoscDuration(0, 1)
    c.getOverlapWithTimespan(d).cs;
    FoscDuration(0, 1)
    d.getOverlapWithTimespan(d).cs;
    FoscDuration(10, 1)


happensDuringTimespan

Is true when timespan happens during timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 10);
    
    a.happensDuringTimespan(a);
    true
    a.happensDuringTimespan(b);
    false
    b.happensDuringTimespan(a);
    true
    b.happensDuringTimespan(b);
    true


intersectsTimespan

Is true when timespan intersects timespan.

code:: a = FoscTimespan(0, 10); b = FoscTimespan(5, 15); c = FoscTimespan(10, 15);

a.intersectsTimespan(a);

code:: a.intersectsTimespan(b);

code:: a.intersectsTimespan(c);


isCongruentToTimespan

Is true when timespan is congruent to timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 15);
    
    a.isCongruentToTimespan(a);
    true
    a.isCongruentToTimespan(b);
    false
    b.isCongruentToTimespan(a);
    false
    b.isCongruentToTimespan(b);
    true


isTangentToTimespan

Is true when timespan is tangent to timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(10, 20);
    
    a.isTangentToTimespan(a);
    false
    a.isTangentToTimespan(b);
    true
    b.isTangentToTimespan(a);
    true
    b.isTangentToTimespan(b);
    false


overlapsAllOfTimespan

Is true when timespan overlaps all of timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 6);
    c = FoscTimespan(5, 10);
    
    a.overlapsAllOfTimespan(a);
    false
    a.overlapsAllOfTimespan(b);
    true
    b.overlapsAllOfTimespan(c);
    false


overlapsOnlyStartOfTimespan

Is true when timespan overlaps only start of timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(-5, 5);
    c = FoscTimespan(4, 6);
    d = FoscTimespan(5, 15);
    
    a.overlapsOnlyStartOfTimespan(a);
    false
    a.overlapsOnlyStartOfTimespan(b);
    false
    a.overlapsOnlyStartOfTimespan(c);
    false
    a.overlapsOnlyStartOfTimespan(d);
    true


overlapsOnlyStopOfTimespan

Is true when timespan overlaps only stop of timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(-5, 5);
    c = FoscTimespan(4, 6);
    d = FoscTimespan(5, 15);
    
    a.overlapsOnlyStopOfTimespan(a);
    false
    a.overlapsOnlyStopOfTimespan(b);
    true
    a.overlapsOnlyStopOfTimespan(c);
    false
    a.overlapsOnlyStopOfTimespan(d);
    false


overlapsStartOfTimespan

Is true when timespan overlaps start of timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(-5, 5);
    c = FoscTimespan(4, 6);
    d = FoscTimespan(5, 15);
    
    a.overlapsStartOfTimespan(a);
    false
    a.overlapsStartOfTimespan(b);
    false
    a.overlapsStartOfTimespan(c);
    true
    a.overlapsStartOfTimespan(d);
    true


overlapsStopOfTimespan

Is true when timespan overlaps stop of timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(-5, 5);
    c = FoscTimespan(4, 6);
    d = FoscTimespan(5, 15);
    
    a.overlapsStopOfTimespan(a);
    false
    a.overlapsStopOfTimespan(b);
    true
    a.overlapsStopOfTimespan(c);
    true
    a.overlapsStopOfTimespan(d);
    false


partitionByRatio

(abjad: divide_by_ratio)

Partitions timespan by ratio.

Returns array of timespans.

  1. Example

    a = FoscTimespan(1/2, 3/2);
    b = a.partitionByRatio(#[1,2,1]);
    b.collect { |each| each.cs };
    [ "FoscTimespan(1/2, 3/4)", "FoscTimespan(3/4, 5/4)", "FoscTimespan(5/4, 3/2)" ]


reflect

Reflects timespan about axis.

Returns a new FoscTimespan.

  1. Reverse timespan about timespan axis.

    a = FoscTimespan(3, 6).reflect;
    a.cs;
    FoscTimespan(3/1, 6/1)
  2. Reverse timespan about arbitrary axis.

    a = FoscTimespan(3, 6).reflect(10);
    a.cs;
    FoscTimespan(14/1, 17/1)


roundOffsets

Rounds timespan offsets to multiple of multiplier.

Returns a new FoscTimespan.

  1. Example

    a = FoscTimespan(1/5, 4/5);
    b = a.roundOffsets(1);
    b.cs;
    FoscTimespan(0/1, 1/1)
  2. Example

    a = FoscTimespan(1/5, 4/5);
    b = a.roundOffsets(2);
    b.cs;
    FoscTimespan(0/1, 2/1)
  3. Example

    a = FoscTimespan(1/5, 4/5);
    b = a.roundOffsets(2, anchor: 'right');
    b.cs;
    FoscTimespan(-2/1, 0/1)
  4. Example

    a = FoscTimespan(1/5, 4/5);
    b = a.roundOffsets(2, anchor: 'right', mustBeWellFormed: false);
    b.cs;
    FoscTimespan(0/1, 0/1)


scale

Scales timespan by multiplier.

Returns a new FoscTimespan.

  1. Scale timespan relative to timespan start offset.

    a = FoscTimespan(3, 6);
    b = a.scale(2);
    b.cs;
    FoscTimespan(3/1, 9/1)
  2. Scale timespan relative to timespan stop offset.

    a = FoscTimespan(3, 6);
    b = a.scale(2, anchor: 'right');
    b.cs;
    FoscTimespan(0/1, 6/1)


setDuration

Sets timespan duration to duration.

Returns a new FoscTimespan.

  1. Example

    a = FoscTimespan(1/2, 3/2);
    b = a.setDuration(3/5);
    b.cs;
    FoscTimespan(1/2, 11/10)


setOffsets

Sets timespan start offset to startOffset and stop offset to stopOffset.

Returns a new FoscTimespan.

  1. Example

    a = FoscTimespan(1/2, 3/2);
    b = a.setOffsets(stopOffset: 7/8);
    b.cs;
    FoscTimespan(1/2, 7/8)
  2. Subtract negative startOffset from existing stop offset.

    a = FoscTimespan(1/2, 3/2);
    b = a.setOffsets(startOffset: -1/2);
    b.cs;
    FoscTimespan(1/1, 3/2)
  3. Subtract negative stopOffset from existing stop offset.

    a = FoscTimespan(1/2, 3/2);
    b = a.setOffsets(stopOffset: -1/2);
    b.cs;
    FoscTimespan(1/2, 1/1)


splitAtOffset

Split into two parts when offset happens during timespan.

Returns a FoscTimespanList.

  1. Example

    a = FoscTimespan(0, 5);
    b = a.splitAtOffset(2);
    b.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 2/1)", "FoscTimespan(2/1, 5/1)" ]
  2. Returns a FoscTimespanList with a copy of receiver when offset does not happen during timespan.

    a = FoscTimespan(0, 5);
    b = a.splitAtOffset(12);
    b.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 5/1)" ]


splitAtOffsets

Split into one or more parts when offsets happens during timespan.

Returns a FoscTimespanList.

  1. Example

    a = FoscTimespan(0, 10);
    b = a.splitAtOffsets(#[1,3,7]);
    b.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 1/1)", "FoscTimespan(1/1, 3/1)", "FoscTimespan(3/1, 7/1)", "FoscTimespan(7/1, 10/1)" ]
  2. Returns a FoscTimespanList with a copy of receiver when offset does not happen during timespan.

    a = FoscTimespan(0, 10);
    b = a.splitAtOffsets(#[-100]);
    b.items.collect { |each| each.cs };
    [ "FoscTimespan(0/1, 10/1)" ]


startsAfterOffset

Is true when timespan overlaps start of offset.

  1. Example

    a = FoscTimespan(0, 10);
    
    a.startsAfterOffset(-5);
    true
    a.startsAfterOffset(0);
    false
    a.startsAfterOffset(5);
    false


startsAfterTimespanStarts

Is true when timespan starts after timespan starts.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 15);
    
    a.startsAfterTimespanStarts(a);
    false
    a.startsAfterTimespanStarts(b);
    false
    b.startsAfterTimespanStarts(a);
    true
    b.startsAfterTimespanStarts(b);
    false


startsAfterTimespanStops

Is true when timespan stops after timespan stops.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 15);
    c = FoscTimespan(10, 20);
    d = FoscTimespan(15, 25);
    
    a.startsAfterTimespanStops(a);
    false
    b.startsAfterTimespanStops(a);
    false
    c.startsAfterTimespanStops(a);
    true
    d.startsAfterTimespanStops(a);
    true


startsAtOffset

Is true when timespan starts at offset.

  1. Example

    a = FoscTimespan(0, 10);
    
    a.startsAtOffset(-5);
    false
    a.startsAtOffset(0);
    true
    a.startsAtOffset(5);
    false


startsAtOrAfterOffset

Is true when timespan starts at or after offset.

  1. Example

    a = FoscTimespan(0, 10);
    
    a.startsAtOrAfterOffset(-5);
    true
    a.startsAtOrAfterOffset(0);
    true
    a.startsAtOrAfterOffset(5);
    false


startsBeforeOffset

Is true when timespan starts before offset.

  1. Example

    a = FoscTimespan(0, 10);
    
    a.startsBeforeOffset(-5);
    false
    a.startsBeforeOffset(0);
    false
    a.startsBeforeOffset(5);
    true


startsBeforeOrAtOffset

Is true when timespan starts before or at offset.

code:: a = FoscTimespan(0, 10);

a.startsBeforeOrAtOffset(-5);

code:: a.startsBeforeOrAtOffset(0);

code:: a.startsBeforeOrAtOffset(5);


startsBeforeTimespanStarts

Is true when timespan starts before timespan starts.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 15);
    
    a.startsBeforeTimespanStarts(a);
    false
    a.startsBeforeTimespanStarts(b);
    true
    b.startsBeforeTimespanStarts(a);
    false
    b.startsBeforeTimespanStarts(b);
    false


startsBeforeTimespanStops

Is true when timespan starts before timespan stops.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 15);
    
    a.startsBeforeTimespanStops(a);
    true
    a.startsBeforeTimespanStops(b);
    true
    b.startsBeforeTimespanStops(a);
    true
    b.startsBeforeTimespanStops(b);
    true


startsDuringTimespan

Is true when timespan starts during timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 15);
    
    a.startsDuringTimespan(a);
    true
    a.startsDuringTimespan(b);
    false
    b.startsDuringTimespan(a);
    true
    b.startsDuringTimespan(b);
    true


startsWhenTimespanStarts

Is true when timespan starts when timespan starts.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 15);
    
    a.startsWhenTimespanStarts(a);
    true
    a.startsWhenTimespanStarts(b);
    false
    b.startsWhenTimespanStarts(a);
    false
    b.startsWhenTimespanStarts(b);
    true


startsWhenTimespanStops

Is true when timespan starts when timespan stops.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(10, 20);
    
    a.startsWhenTimespanStops(a);
    false
    a.startsWhenTimespanStops(b);
    false
    b.startsWhenTimespanStops(a);
    true
    b.startsWhenTimespanStops(b);
    false


stopsAfterOffset

Is true when timespan stops after offset.

  1. Example

    a = FoscTimespan(0, 10);
    
    a.stopsAfterOffset(0);
    true
    a.stopsAfterOffset(5);
    true
    a.stopsAfterOffset(10);
    false


stopsAfterTimespanStarts

Is true when timespan stops after timespan starts.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(10, 20);
    
    a.stopsAfterTimespanStarts(a);
    true
    a.stopsAfterTimespanStarts(b);
    false
    b.stopsAfterTimespanStarts(a);
    true
    b.stopsAfterTimespanStarts(b);
    true


stopsAfterTimespanStops

Is true when timespan stops after timespan stops.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(10, 20);
    
    a.stopsAfterTimespanStops(a);
    false
    a.stopsAfterTimespanStops(b);
    false
    b.stopsAfterTimespanStops(a);
    true
    b.stopsAfterTimespanStops(b);
    false


stopsAtOffset

Is true when timespan stops at offset.

  1. Example

    a = FoscTimespan(0, 10);
    
    a.stopsAtOffset(0);
    false
    a.stopsAtOffset(10);
    true
    a.stopsAtOffset(20);
    false


stopsAtOrAfterOffset

Is true when timespan stops at or after offset.

  1. Example

    a = FoscTimespan(0, 10);
    
    a.stopsAtOrAfterOffset(0);
    true
    a.stopsAtOrAfterOffset(10);
    true
    a.stopsAtOrAfterOffset(20);
    false


stopsBeforeOffset

Is true when timespan stops before offset.

  1. Example

    a = FoscTimespan(0, 10);
    
    a.stopsBeforeOffset(0);
    false
    a.stopsBeforeOffset(10);
    false
    a.stopsBeforeOffset(20);
    true


stopsBeforeOrAtOffset

Is true when timespan stops before or at offset.

  1. Example

    a = FoscTimespan(0, 10);
    
    a.stopsBeforeOrAtOffset(0);
    false
    a.stopsBeforeOrAtOffset(10);
    true
    a.stopsBeforeOrAtOffset(20);
    true


stopsBeforeTimespanStarts

Is true when timespan stops before timespan starts.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(15, 20);
    
    a.stopsBeforeTimespanStarts(a);
    false
    a.stopsBeforeTimespanStarts(b);
    true
    b.stopsBeforeTimespanStarts(a);
    false


stopsBeforeTimespanStops

Is true when timespan stops before timespan stops.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(15, 20);
    
    a.stopsBeforeTimespanStops(a);
    false
    a.stopsBeforeTimespanStops(b);
    true
    b.stopsBeforeTimespanStops(a);
    false


stopsDuringTimespan

Is true when timespan stops during timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(10, 20);
    
    a.stopsDuringTimespan(a);
    true
    a.stopsDuringTimespan(b);
    false
    b.stopsDuringTimespan(a);
    false
    b.stopsDuringTimespan(b);
    true


stopsWhenTimespanStarts

Is true when timespan stops when timespan starts.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(10, 20);
    
    a.stopsWhenTimespanStarts(a);
    false
    a.stopsWhenTimespanStarts(b);
    true
    b.stopsWhenTimespanStarts(a);
    false
    b.stopsWhenTimespanStarts(b);
    false


stopsWhenTimespanStops

Is true when timespan stops when timespan stops.

  1. • stopsWhenTimespanStops

    Is true when timespan stops when timespan stops.


stretch

Stretches timespan by multiplier relative to anchor.

Returns a new FoscTimespan.

  1. Stretch relative to timespan start offset.

    a = FoscTimespan(3, 10);
    b = a.stretch(2);
    b.cs;
    FoscTimespan(3/1, 17/1)
  2. Stretch relative to timespan stop offset.

    a = FoscTimespan(3, 10);
    b = a.stretch(2, anchor: a.stopOffset);
    b.cs;
    FoscTimespan(-4/1, 10/1)
  3. Stretch relative to offset prior to timespan.

    a = FoscTimespan(3, 10);
    b = a.stretch(2, anchor: 0);
    b.cs;
    FoscTimespan(6/1, 20/1)
  4. Stretch relative to offset after timespan.

    a = FoscTimespan(3, 10);
    b = a.stretch(3, anchor: 12);
    b.cs;
    FoscTimespan(-15/1, 6/1)
  5. Stretch relative to offset that happens during timespan.

    a = FoscTimespan(3, 10);
    b = a.stretch(2, anchor: 4);
    b.cs;
    FoscTimespan(2/1, 16/1)


translate

Translates timespan by translation.

Returns a new FoscTimespan.

  1. Example

    a = FoscTimespan(5, 10);
    b = a.translate(2);
    b.cs;
    FoscTimespan(7/1, 12/1)


translateOffsets

Translates timespan start offset by start_offset_translation and stop offset by stop_offset_translation.

Returns a new FoscTimespan.

  1. Example

    a = FoscTimespan(1/2, 3/2);
    b = a.translateOffsets(startOffsetTranslation: -1/8);
    b.cs;
    FoscTimespan(3/8, 3/2)


trisectsTimespan

Is true when timespan trisects timespan.

  1. Example

    a = FoscTimespan(0, 10);
    b = FoscTimespan(5, 6);
    
    a.trisectsTimespan(a);
    false
    a.trisectsTimespan(b);
    false
    b.trisectsTimespan(a);
    true
    b.trisectsTimespan(b);
    false