public class Interval extends Object
Constructor and Description |
---|
Interval(BigFraction start,
BigFraction end)
Creates a new Interval, which must have a non-zero duration and end after
it begins.
|
Interval(double start,
double end) |
Modifier and Type | Method and Description |
---|---|
Interval |
add(BigFraction fraction) |
boolean |
equals(Object obj) |
BigFraction |
getEnd() |
BigFraction |
getSize() |
BigFraction |
getStart() |
int |
hashCode() |
static Interval |
modulo(BigFraction start,
BigFraction end,
Interval other)
Fits the start and end of an interval inside another interval, returning
the result.
|
Interval |
modulo(Interval other)
Shifts the start or end of this interval to make it fit inside another.
|
Interval |
multiply(BigFraction fraction) |
Interval |
multiplyMod(BigFraction fraction,
Interval interval)
Multiplies this interval by some amount, then fits the product into
another interval.
|
Interval |
multiplyMod(double amt,
Interval interval)
Multiplies this interval by some amount, then fits the product into
another interval.
|
static Interval[] |
shortenBy(Interval interval,
BigFraction fraction)
Splits an interval into two by cutting off a portion.
|
Interval |
subtract(BigFraction fraction) |
String |
toString() |
static Interval |
zeroTo(BigFraction duration)
Creates an interval that goes from 0 to the specified number of cycles.
|
static Interval |
zeroTo(double duration)
Creates an interval that goes from 0 to the specified number of cycles.
|
public Interval(double start, double end)
public Interval(BigFraction start, BigFraction end)
start
- the beginning of the intervalend
- the end of the intervalpublic static Interval zeroTo(double duration)
duration
- the length of the intervalpublic static Interval zeroTo(BigFraction duration)
duration
- the length of the intervalpublic BigFraction getStart()
public BigFraction getEnd()
public BigFraction getSize()
public Interval add(BigFraction fraction)
public Interval subtract(BigFraction fraction)
public Interval multiply(BigFraction fraction)
public Interval modulo(Interval other) throws IllegalArgumentException
other
- the other intervalIllegalArgumentException
public Interval multiplyMod(double amt, Interval interval)
amt
- the multiplierinterval
- the other interval into which the product should be fitpublic static Interval modulo(BigFraction start, BigFraction end, Interval other)
start
- the start of the original intervalend
- the end of the original intervalother
- the interval within which to fit the start and endfractionMod
public Interval multiplyMod(BigFraction fraction, Interval interval)
fraction
- the multiplierinterval
- the other interval into which the product should be fitpublic static Interval[] shortenBy(Interval interval, BigFraction fraction)
interval
- the original intervalfraction
- the amount by which to shortenProcessing Library loom by Cora Johnson-Roberson. (c) 2014-2016