|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.sciss.io.Span
public class Span
A struct class: a span between a start and end point in one dimensional space. The start point is considered inclusive while the end point is considered exclusive. In Melloncillo, it is mainly used to describe a time span in sense rate frames.
Field Summary | |
---|---|
long |
start
The span start should be treated
as if it was immutable! |
static java.util.Comparator |
startComparator
|
long |
stop
The span start should be treated
as if it was immutable! |
static java.util.Comparator |
stopComparator
|
Constructor Summary | |
---|---|
Span()
Create a new empty span whose start and stop are zero. |
|
Span(long start,
long stop)
Creates a span with the given start and stop points. |
|
Span(Span span)
Create a span with the start and stop points copied from another span. |
Method Summary | |
---|---|
long |
clip(long pos)
|
java.lang.Object |
clone()
Returns a new span which is equal to this one. |
boolean |
contains(long position)
Checks if a position lies within the span. |
boolean |
contains(Span anotherSpan)
Checks if another span lies within the span. |
boolean |
equals(java.lang.Object o)
Checks if this span is equal to an object. |
long |
getLength()
Queries the span's extent (duration, length etc.) |
long |
getStart()
Queries the span's start. |
long |
getStop()
Queries the span's end. |
int |
hashCode()
|
Span |
intersection(Span anotherSpan)
|
static Span |
intersection(Span span1,
Span span2)
|
boolean |
isEmpty()
Checks if the span is empty. |
boolean |
overlaps(Span anotherSpan)
Checks if a two spans overlap each other. |
Span |
replaceStart(long newStart)
|
Span |
replaceStop(long newStop)
|
Span |
shift(long delta)
|
java.lang.String |
toString()
|
boolean |
touches(Span anotherSpan)
Checks if a two spans overlap or touch each other. |
Span |
union(Span anotherSpan)
|
static Span |
union(Span span1,
Span span2)
Union operation on two spans. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.util.Comparator startComparator
public static final java.util.Comparator stopComparator
public final long start
start
should be treated
as if it was immutable!
public final long stop
start
should be treated
as if it was immutable!
Constructor Detail |
---|
public Span()
public Span(long start, long stop)
start
- beginning of the spanstop
- end of the spanpublic Span(Span span)
span
- template span whose start and end are copiedMethod Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
CloneNotSupportedException
is never thrown.
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public boolean contains(long position)
true
, if start <= postion < stop
public boolean contains(Span anotherSpan)
anotherSpan
- second span, may be null
(in this case returns false
)
true
, if anotherSpan.start >= this.span &&
anotherSpan.stop <= this.stop
public boolean overlaps(Span anotherSpan)
anotherSpan
- second span, may be null
(in this case returns false
)
true
, if the spans
overlap each otherpublic boolean touches(Span anotherSpan)
anotherSpan
- second span, may be null
(in this case returns false
)
true
, if the spans
overlap each otherpublic boolean isEmpty()
true
, if start == stop
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- an object to compare to this span
true
, if o
is a span with
the same start and end pointpublic int hashCode()
hashCode
in class java.lang.Object
public long getStart()
public long getStop()
public long getLength()
stop - start
public java.lang.String toString()
toString
in class java.lang.Object
public static Span union(Span span1, Span span2)
span1
- first span to fuse (may be null
)span2
- second span to fuse (may be null
)
null
if
both span1
and span2
are null
public Span union(Span anotherSpan)
public static Span intersection(Span span1, Span span2)
public Span intersection(Span anotherSpan)
public long clip(long pos)
public Span replaceStart(long newStart)
public Span replaceStop(long newStop)
public Span shift(long delta)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |