edu.mines.jtk.mosaic
Class SequenceView

java.lang.Object
  extended by edu.mines.jtk.mosaic.TiledView
      extended by edu.mines.jtk.mosaic.SequenceView

public class SequenceView
extends TiledView

A view of a sequence of samples of a function f(x) of one variable x. This view renders each sample with a filled circle centered on the sample value and a vertical line drawn from that sample value to the origin. In other words, this view draws a sequence as lollipops with different heights that correspond to sample values.

Version:
2005.01.01
Author:
Dave Hale, Colorado School of Mines

Nested Class Summary
static class SequenceView.Zero
          The visibility of function value zero in the view.
 
Constructor Summary
SequenceView(float[] f)
          Constructs a sequence view with specified values f(x).
SequenceView(Sampling sx, float[] f)
          Constructs a sequence view with specified sampling and values f(x).
 
Method Summary
 float[] getFunction()
          Gets a copy of the array of function values.
 Sampling getSampling()
          Gets the sampling.
 void paint(java.awt.Graphics2D g2d)
          Paints this tiled view.
 void set(float[] f)
          Sets default sampling and specified function values f(x).
 void set(Sampling sx, float[] f)
          Sets specified sampling and function values.
 void setColor(java.awt.Color color)
          Sets the color used to paint the sequence.
 void setZero(SequenceView.Zero zero)
          Sets the visibility of function value zero in this view.
 
Methods inherited from class edu.mines.jtk.mosaic.TiledView
getBestHorizontalProjector, getBestVerticalProjector, getHorizontalProjector, getLineWidth, getTile, getTranscaler, getVerticalProjector, repaint, setBestProjectors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceView

public SequenceView(float[] f)
Constructs a sequence view with specified values f(x). Uses default sampling of x = 0, 1, 2, ....

Parameters:
f - array of sampled function values f(x).

SequenceView

public SequenceView(Sampling sx,
                    float[] f)
Constructs a sequence view with specified sampling and values f(x).

Parameters:
sx - the sampling of the variable x.
f - array of sampled function values f(x).
Method Detail

set

public void set(float[] f)
Sets default sampling and specified function values f(x). The default sampling is x = 0, 1, 2, ....

Parameters:
f - array of sampled function values f(x).

set

public void set(Sampling sx,
                float[] f)
Sets specified sampling and function values.

Parameters:
sx - the sampling of the variable x.
f - array of sampled function values f(x).

getSampling

public Sampling getSampling()
Gets the sampling.

Returns:
the sampling.

getFunction

public float[] getFunction()
Gets a copy of the array of function values.

Returns:
array of sampled function values f(x).

setZero

public void setZero(SequenceView.Zero zero)
Sets the visibility of function value zero in this view. The default visibility is ALWAYS.

Parameters:
zero - the visibility of function value zero.

setColor

public void setColor(java.awt.Color color)
Sets the color used to paint the sequence. The default color is the tile foreground color. That default is used if the specified color is null.

Parameters:
color - the color; null, for tile foreground color.

paint

public void paint(java.awt.Graphics2D g2d)
Description copied from class: TiledView
Paints this tiled view. This method is implemented by classes that extend this abstract base class. Implementations may modify the specified graphics context freely. Such modifications will not affect the paintings of other tiled views in the same tile or mosaic.

Tiled views should not replace (set) entirely the transform in the specified graphics context. This transform may already have been set by the tile or its mosaic. Therefore, tiled views should modify this transform only by specifying additional scaling, translation, etc.

Specified by:
paint in class TiledView
Parameters:
g2d - the graphics context in which to paint.