Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jplot
Class DataArray  view DataArray download DataArray.java

java.lang.Object
  extended byjplot.LinePars
      extended byjplot.DataArray

public class DataArray
extends LinePars

The DataArray class is a special-purpose array class for use with the graphical plotting program JPlot. All the plotting attributes are defined in the base-class LinePars, here we set the actual data array, i.e. a vector of points (PlotPoints) defining X,Y.

Version:
24/08/99

Field Summary
protected  double[] lowestNonZeroValue
           
protected  double[] maxValue
           
protected  double[] minValue
           
protected  java.util.Vector points
           
 
Fields inherited from class jplot.LinePars
additioner, blueInc, color, colorIndex, dashIndex, dashLength, dataModified, endColor, every, fillArea, fillColor, greenInc, HISTO, LINES, multiplier, name, penWidth, plotLine, redInc, showLegend, slideColor, startColor, STICKS, style, symbol, symbolSize, useSymbol
 
Constructor Summary
DataArray()
          Default constructor, initializes the class with nothing.
DataArray(int n)
          Constructor, allocates memory for the data points.
DataArray(int n, LinePars lp)
          Constructor, allocates memory for the data points.
 
Method Summary
 void addPoint(double x, double y)
          Adds the values of a plot-point pair (x,y).
 void addPoint(double x, double y, boolean liftPen)
          Adds the values of a plot-point pair (x,y).
 void allocate(int n)
          Allocation of memory for the data points.
 java.util.Vector getData()
          Return the data vector
(package private)  double getLowestNonZeroValue(int axis)
          Returns the lowest, but non-zero value in the range.
(package private)  double getMaxValue(int axis)
          Returns the maximum value in the range.
(package private)  double getMinValue(int axis)
          Returns the minimum value in the range.
 PlotPoint getPoint(int i)
          Returns the plot-point of the specified index.
(package private)  java.awt.BasicStroke getStroke()
          Returns the stroke used to plot these points.
(package private)  double getX(int i)
          Return a specific X-value.
(package private)  double getY(int i)
          Return a specific Y-value.
 boolean liftPen(int i)
           
 void setLiftPen(int i)
          Defines that, for this plotpoint, the pen should lift.
(package private)  void setLinePars(LinePars l)
          Sets the drawing style parameters at once.
 void setPoint(int i, double x, double y)
          Sets the values of a plot-point pair (x,y).
 int size()
          Return the length of the data vector.
 void sort(boolean ascending)
          Sorts the arrays in ascending or descending order.
 void updateMinMax(double x, double y)
          Updates maximum and minimum values.
 
Methods inherited from class jplot.LinePars
copy, dataChanged, drawLegend, drawLine, drawSymbol, fill, fill, getAdditioner, getColor, getColorIndex, getDashIndex, getDashLength, getEndColor, getFillColor, getGraphStyle, getMultiplier, getName, getPenWidth, getPointFrequency, getSettings, getStartColor, getSymbol, getSymbolSize, nextColor, setAdditioner, setColor, setColor, setDashLength, setDashLength, setDataChanged, setDrawLegend, setDrawLine, setDrawSymbol, setFillColor, setGraphStyle, setMultiplier, setName, setPenWidth, setPointFrequency, setSlideColor, setSlideColor, setSymbol, setSymbolSize, slideColor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

points

protected java.util.Vector points

maxValue

protected double[] maxValue

minValue

protected double[] minValue

lowestNonZeroValue

protected double[] lowestNonZeroValue
Constructor Detail

DataArray

public DataArray()
Default constructor, initializes the class with nothing.


DataArray

public DataArray(int n)
Constructor, allocates memory for the data points.


DataArray

public DataArray(int n,
                 LinePars lp)
Constructor, allocates memory for the data points.

Method Detail

allocate

public void allocate(int n)
Allocation of memory for the data points.


updateMinMax

public void updateMinMax(double x,
                         double y)
Updates maximum and minimum values.


addPoint

public void addPoint(double x,
                     double y)
Adds the values of a plot-point pair (x,y). This point is added at the end of the array.


addPoint

public void addPoint(double x,
                     double y,
                     boolean liftPen)
Adds the values of a plot-point pair (x,y). This point is added at the end of the array.


setPoint

public void setPoint(int i,
                     double x,
                     double y)
Sets the values of a plot-point pair (x,y).


getPoint

public PlotPoint getPoint(int i)
Returns the plot-point of the specified index.


setLiftPen

public void setLiftPen(int i)
Defines that, for this plotpoint, the pen should lift. This allows to draw discontinuous graphs.


liftPen

public boolean liftPen(int i)

size

public int size()
Return the length of the data vector.


getData

public java.util.Vector getData()
Return the data vector


getX

double getX(int i)
Return a specific X-value. This function returns POSINF (1e300) if index i falls beyond the valid range.


getY

double getY(int i)
Return a specific Y-value. This function returns POSINF (1e300) if index i falls beyond the valid range.


getMaxValue

double getMaxValue(int axis)
Returns the maximum value in the range. Careful, no error checking on the value of axis, which should be less than NAXES, defined in GraphPars.


getMinValue

double getMinValue(int axis)
Returns the minimum value in the range. Careful, no error checking on the value of axis, which should be less than NAXES, defined in GraphPars.


getLowestNonZeroValue

double getLowestNonZeroValue(int axis)
Returns the lowest, but non-zero value in the range. This is a a usefull 'minimum' value for e.g. logarithmic ranges.


getStroke

java.awt.BasicStroke getStroke()
Returns the stroke used to plot these points. By default, a solid line of width 1 is assumed.


setLinePars

void setLinePars(LinePars l)
Sets the drawing style parameters at once.


sort

public void sort(boolean ascending)
Sorts the arrays in ascending or descending order.