Package de.sciss.io
Class Region
- java.lang.Object
-
- de.sciss.io.Region
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class Region extends java.lang.Object implements java.io.Serializable, java.lang.CloneableA struct class: region in an audio file. (copied from FScape).- See Also:
AudioFileDescr.KEY_REGIONS, Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intadd(java.util.List regions, Region region, boolean byBegin)Adds region chronologically to a pre-sorted list.java.lang.Objectclone()Returns a new region which is equal to this one.static intfind(java.util.List regions, java.lang.String name, int startIndex)Gets the index for specific region in a list.static java.util.Listsort(java.util.List regions, boolean byBegin)Sorts regions chronologically
-
-
-
Field Detail
-
span
public final Span span
A region's time span in sample frames
-
name
public final java.lang.String name
A region's name
-
-
Constructor Detail
-
Region
public Region(Span span, java.lang.String name)
Constructs a new immutable region- Parameters:
span- time span in sample framesname- region's name
-
Region
public Region(Region orig)
Constructs a new immutable region identical to a given region.- Parameters:
orig- the region to copy
-
-
Method Detail
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionReturns a new region which is equal to this one.CloneNotSupportedExceptionis never thrown.- Overrides:
clonein classjava.lang.Object- Returns:
- a new region with the same name and span as this region
- Throws:
java.lang.CloneNotSupportedException
-
sort
public static java.util.List sort(java.util.List regions, boolean byBegin)Sorts regions chronologically- Parameters:
regions- a vector whose elements are instanceof Region.byBegin-trueto sort by region begin points;falseto sort by region end points- Returns:
- sorted region list. Each region is guaranteed to have a time span's begin (byBegin==true) or end (byBegin==false) less or equal its successor
-
add
public static int add(java.util.List regions, Region region, boolean byBegin)Adds region chronologically to a pre-sorted list.- Parameters:
regions- a vector whose elements are instanceof Region and which are chronologically sorted according to thebyBeginflag.region- the region to insert such that its predecessor has a time span's start (byBegin==true) or stop (byBegin==false) less or equal this region's time span start or stop and the regions's successor has a time span's start or stop greater than this regions's time span start or stop.byBegin-trueto sort by region begin points;falseto sort by region end points- Returns:
- region index in vector at which it was inserted
-
find
public static int find(java.util.List regions, java.lang.String name, int startIndex)Gets the index for specific region in a list.- Parameters:
regions- a vector whose elements are instanceof Region.name- region name to findstartIndex- where to begin- Returns:
- The list index of the first occurance (beginning
at
startIndex) of a region whose name equals the given name.
-
-