com.groovemanager.sampled.waveform
Class WaveFormPart

java.lang.Object
  extended by com.groovemanager.sampled.waveform.AbstractWaveForm
      extended by com.groovemanager.sampled.waveform.WaveFormPart
All Implemented Interfaces:
WaveForm

public class WaveFormPart
extends AbstractWaveForm

A WaveFormPart stands for a given part of another WaveForm

Author:
Manu Robledo

Field Summary
protected  int offset
          Start position inside the source WaveForm
protected  WaveForm source
          The WaveForm of which this WaveForm represents a part
 
Fields inherited from class com.groovemanager.sampled.waveform.AbstractWaveForm
channels, displayWidth, intervallSize, nullWave, position, realLength
 
Constructor Summary
WaveFormPart(WaveForm source, int begin, int length)
          Construct a new WaveFormPart
 
Method Summary
 boolean canProvide(int begin, int length, int width)
          Tells if this WaveForm sees itself capable of providing a SubWaveForm with the given parameters
protected  java.lang.String getAdditionalToString()
          Get an additional String describing this WaveForm.
 byte getMax(int channel)
          Get the maximum value at the current read position in the given channel
 byte getMin(int channel)
          Get the minimum value at the current read position in the given channel
 WaveForm subWaveForm(int begin, int length, int width)
          Get a WaveForm Object that represents the part of this WaveForm specified by begin and length and displays this part in the specified width
 
Methods inherited from class com.groovemanager.sampled.waveform.AbstractWaveForm
getChannels, getData, getDisplayableLength, getIntervallSize, getPosition, getRealLength, getRealPosition, getZoomFactor, next, rewind, setPosition, setRealPosition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

offset

protected int offset
Start position inside the source WaveForm


source

protected WaveForm source
The WaveForm of which this WaveForm represents a part

Constructor Detail

WaveFormPart

public WaveFormPart(WaveForm source,
                    int begin,
                    int length)
Construct a new WaveFormPart

Parameters:
source - The source WaveForm
begin - Start position inside the source WaveForm
length - The length of this part
Method Detail

canProvide

public boolean canProvide(int begin,
                          int length,
                          int width)
Description copied from interface: WaveForm
Tells if this WaveForm sees itself capable of providing a SubWaveForm with the given parameters

Specified by:
canProvide in interface WaveForm
Overrides:
canProvide in class AbstractWaveForm
Parameters:
begin - The offset to the beginning of this WaveForm. May also be negative.
length - The length in steps of this WaveForm that should be represented by the returned WaveForm.
width - The new width in which the part should be displayed.
Returns:
true if this WaveForm can provide the wanted subWaveForm, false otherwise
See Also:
WaveForm.canProvide(int, int, int)

getAdditionalToString

protected java.lang.String getAdditionalToString()
Description copied from class: AbstractWaveForm
Get an additional String describing this WaveForm. Will be used in toString()

Overrides:
getAdditionalToString in class AbstractWaveForm
Returns:
An optional String describing special characteristics of this WaveForm

getMax

public byte getMax(int channel)
Description copied from interface: WaveForm
Get the maximum value at the current read position in the given channel

Parameters:
channel - the zero-based index of the channel
Returns:
the maximum value at this position as byte

getMin

public byte getMin(int channel)
Description copied from interface: WaveForm
Get the minimum value at the current read position in the given channel

Parameters:
channel - the zero-based index of the channel
Returns:
the minimum value at this position as byte

subWaveForm

public WaveForm subWaveForm(int begin,
                            int length,
                            int width)
Description copied from interface: WaveForm
Get a WaveForm Object that represents the part of this WaveForm specified by begin and length and displays this part in the specified width

Specified by:
subWaveForm in interface WaveForm
Overrides:
subWaveForm in class AbstractWaveForm
Parameters:
begin - The offset to the beginning of this WaveForm. May also be negative.
length - The length in steps of this WaveForm that should be represented by the returned WaveForm.
width - The new width in which the part should be displayed.
Returns:
A WaveForm Object that represents the specified Part of this WaveForm and displays it in the given width. Can also be the same Object with adapted attributes
See Also:
WaveForm.subWaveForm(int, int, int)