gov.sns.tools.plot
Class BasicGraphData

java.lang.Object
  |
  +--gov.sns.tools.plot.BasicGraphData
Direct Known Subclasses:
CubicSplineGraphData, UnwrappedGeneratorGraphData

public class BasicGraphData
extends java.lang.Object

This class is a container class for data used in the FunctionGraphsJPanel class. This class interpolates y-values by the linear interpolation. For spline interpolation use the CubicSplineGraphData class.

See Also:
CubicSplineGraphData

Nested Class Summary
protected  class BasicGraphData.CompareErr
           
protected  class BasicGraphData.CompareX
           
protected  class BasicGraphData.CompareY
           
protected  class BasicGraphData.XYpoint
           
 
Field Summary
protected  java.awt.Color color
           
protected  boolean drawLinesOn
           
protected  boolean drawPointsOn
           
protected  double errYmax
           
protected  java.util.Vector graphDataContainerV
           
protected  boolean immediateContainerUpdate
           
protected  java.awt.BasicStroke lineStroke
           
protected  int lineThick
           
protected  java.lang.Object lockUpObj
           
protected  java.awt.Shape markShape
           
protected  boolean markShapeFilled
           
protected  java.lang.String name
           
protected  int nInterpPoints
           
protected  int pointSize
           
protected  java.util.HashMap propertyMap
           
protected  double xMax
           
protected  double xMin
           
protected  java.util.Vector xyInterpPointV
           
protected  java.util.Vector xyPointV
           
protected  double yMax
           
protected  double yMin
           
 
Constructor Summary
BasicGraphData()
          data set constructor
BasicGraphData(int nPoint, int nInterpPointsIn)
          data set constructor with defined initial capacity for number of (x,y) points and interpolated points
 
Method Summary
 void addPoint(double[] x, double[] y)
          add an array of (x,y) points to the data set
 void addPoint(double[] x, double[] y, double[] err)
          add an array of (x,y, error of y) points to the data set
 void addPoint(double x, double y)
          add (x,y) point to the data set
 void addPoint(double x, double y, double err)
          add (x,y, error of y) point to the data set
protected  void calculateRepresentation()
           
protected  int getCapacity()
           
 boolean getDrawLinesOn()
          returns the "draw lines on/off" state
 boolean getDrawPointsOn()
          returns the "draw points on/off" state
 double getErr(int index)
          returns the error value for certain index
 java.awt.Color getGraphColor()
          returns the color of the graph
 FunctionGraphsJPanel getGraphDataContainer(int index)
          returns the graph containers where this data set has been registered
 java.lang.String getGraphName()
          returns the name of the graph
 java.awt.Shape getGraphPointShape()
          returns the shape of the point during drawing.
 int getGraphPointSize()
          returns the size of the point during drawing.
 java.lang.Object getGraphProperty(java.lang.Object keyObj)
          sets the value of the data set property by the key-value
 java.util.Set getGraphPropertyKeys()
          returns the set of the keys
 int getGraphPropertySize()
          returns the number of pairs (key,value)
 boolean getImmediateContainerUpdate()
          returns true if data changes cause the immediate graph container update.
 double getInterpX(int index)
          returns x-value for a particular point in the interpolating data set
 double getInterpY(int index)
          returns interpolated y-value from the interpolating data set
 int getLineThick()
          returns the line thickness during drawing.
 double getMaxErr()
          returns the maximal y-error
 double getMaxX()
          returns the maximal x
 double getMaxY()
          returns the maximal y
 double getMinX()
          returns the minimal x
 double getMinY()
          returns the minimal y
 int getNumberOfGraphDataContainers()
          returns the number of graph containers where this data set has been registered
 int getNumbOfInterpPoints()
          returns the number of data points in the interpolation
 int getNumbOfPoints()
          returns the number of data points
protected  java.awt.BasicStroke getStroke()
          returns the stroke for drawing.
 double getValueDerivativeY(double x)
          get y'-value for certain x-value
 double getValueY(double x)
          get y-value for certain x-value
 double getX(int index)
          returns x-value from the container
 double getY(int index)
          returns y-value from the container
protected  void init(int nPoint, int nInterpPoints)
          initializes graph data containers
 boolean isGraphPointShapeFilled()
          returns the filling shape property of the point during drawing.
static void main(java.lang.String[] args)
          this is a test method
 void registerInContainer(FunctionGraphsJPanel gdc)
          registers this data set into a graph container.
 void removeAllPoints()
          remove all points from the data set
 void removeContainer(java.lang.Object obj)
          removes this data set from a graph container.
 void removePoint(int index)
          remove a point from the data set
 void setDrawLinesOn(boolean drawLinesOn)
          sets "draw lines" on/off
 void setDrawPointsOn(boolean drawPointsOn)
          sets "draw points" on/off
 void setGraphColor(java.awt.Color color)
          sets the color of the graph
 void setGraphName(java.lang.String name)
          sets the name of the graph
 void setGraphPointFillingShape(boolean fillShape)
          sets the filling shape property of the point during drawing.
 void setGraphPointShape(java.awt.Shape markShape)
          sets the shape of the point during drawing.
 void setGraphPointSize(int pointSize)
          sets the size of the point during drawing.
 void setGraphProperty(java.lang.Object keyObj, java.lang.Object propObj)
          sets the (key,value) of the data set properties
 void setImmediateContainerUpdate(boolean immediateContainerUpdate)
          sets the immediate graph container update if data has been changed.
 void setLineThick(int lineThick)
          sets the line thickness during drawing.
protected  void updateContainer()
          calls the method refreshGraphJPanel() of all graph containers FunctionGraphsJPanel where this data set has been registered.
protected  void updateData()
           
 void updatePoint(int index, double x, double y)
          update the y-value and x-value with certain index into the data set
 void updatePoint(int index, double x, double y, double err)
          update the y-value, x-value and error with certain index into the data set
 void updateValues(double[] x, double[] y)
          update all points if they do exist or create new if they do not
 void updateValues(double[] x, double[] y, double[] err)
          update all points if they do exist or create new if they do not
 void updateValuesY(double[] y)
          update the y-array into the data set
 void updateValuesY(double[] y, double[] err)
          update the y-array with errors into the data set
 void updateValueY(int index, double y)
          update the y-value with certain index into the data set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyMap

protected java.util.HashMap propertyMap

lockUpObj

protected java.lang.Object lockUpObj

graphDataContainerV

protected java.util.Vector graphDataContainerV

immediateContainerUpdate

protected boolean immediateContainerUpdate

xyPointV

protected java.util.Vector xyPointV

xyInterpPointV

protected java.util.Vector xyInterpPointV

nInterpPoints

protected int nInterpPoints

xMax

protected double xMax

yMax

protected double yMax

xMin

protected double xMin

yMin

protected double yMin

errYmax

protected double errYmax

color

protected java.awt.Color color

name

protected java.lang.String name

drawLinesOn

protected boolean drawLinesOn

drawPointsOn

protected boolean drawPointsOn

pointSize

protected int pointSize

lineThick

protected int lineThick

lineStroke

protected java.awt.BasicStroke lineStroke

markShape

protected java.awt.Shape markShape

markShapeFilled

protected boolean markShapeFilled
Constructor Detail

BasicGraphData

public BasicGraphData()
data set constructor


BasicGraphData

public BasicGraphData(int nPoint,
                      int nInterpPointsIn)
data set constructor with defined initial capacity for number of (x,y) points and interpolated points

Method Detail

init

protected void init(int nPoint,
                    int nInterpPoints)
initializes graph data containers


addPoint

public void addPoint(double x,
                     double y)
add (x,y) point to the data set


addPoint

public void addPoint(double x,
                     double y,
                     double err)
add (x,y, error of y) point to the data set


addPoint

public void addPoint(double[] x,
                     double[] y)
add an array of (x,y) points to the data set


addPoint

public void addPoint(double[] x,
                     double[] y,
                     double[] err)
add an array of (x,y, error of y) points to the data set


updateValues

public void updateValues(double[] x,
                         double[] y,
                         double[] err)
update all points if they do exist or create new if they do not


updateValues

public void updateValues(double[] x,
                         double[] y)
update all points if they do exist or create new if they do not


updateValuesY

public void updateValuesY(double[] y,
                          double[] err)
update the y-array with errors into the data set


updateValuesY

public void updateValuesY(double[] y)
update the y-array into the data set


updateValueY

public void updateValueY(int index,
                         double y)
update the y-value with certain index into the data set


updatePoint

public void updatePoint(int index,
                        double x,
                        double y)
update the y-value and x-value with certain index into the data set


updatePoint

public void updatePoint(int index,
                        double x,
                        double y,
                        double err)
update the y-value, x-value and error with certain index into the data set


removePoint

public void removePoint(int index)
remove a point from the data set


removeAllPoints

public void removeAllPoints()
remove all points from the data set


calculateRepresentation

protected void calculateRepresentation()

getValueY

public double getValueY(double x)
get y-value for certain x-value


getValueDerivativeY

public double getValueDerivativeY(double x)
get y'-value for certain x-value


getCapacity

protected int getCapacity()

getNumbOfPoints

public int getNumbOfPoints()
returns the number of data points


getNumbOfInterpPoints

public int getNumbOfInterpPoints()
returns the number of data points in the interpolation


getX

public double getX(int index)
returns x-value from the container


getY

public double getY(int index)
returns y-value from the container


getInterpX

public double getInterpX(int index)
returns x-value for a particular point in the interpolating data set


getInterpY

public double getInterpY(int index)
returns interpolated y-value from the interpolating data set


getErr

public double getErr(int index)
returns the error value for certain index


getMaxErr

public double getMaxErr()
returns the maximal y-error


getMinX

public double getMinX()
returns the minimal x


getMaxX

public double getMaxX()
returns the maximal x


getMinY

public double getMinY()
returns the minimal y


getMaxY

public double getMaxY()
returns the maximal y


updateData

protected void updateData()

registerInContainer

public void registerInContainer(FunctionGraphsJPanel gdc)
registers this data set into a graph container. Warning: do not use this method. This method is supposed to be used by the FunctionGraphsJPanel class. Use the addGraphData - method of the FunctionGraphsJPanel class


getNumberOfGraphDataContainers

public int getNumberOfGraphDataContainers()
returns the number of graph containers where this data set has been registered


removeContainer

public void removeContainer(java.lang.Object obj)
removes this data set from a graph container. Warning: do not use this method. This method is supposed to be used by the FunctionGraphsJPanel class. Use the removeGraphData - method of the FunctionGraphsJPanel class


getGraphDataContainer

public FunctionGraphsJPanel getGraphDataContainer(int index)
returns the graph containers where this data set has been registered


updateContainer

protected void updateContainer()
calls the method refreshGraphJPanel() of all graph containers FunctionGraphsJPanel where this data set has been registered.


setImmediateContainerUpdate

public void setImmediateContainerUpdate(boolean immediateContainerUpdate)
sets the immediate graph container update if data has been changed.


getImmediateContainerUpdate

public boolean getImmediateContainerUpdate()
returns true if data changes cause the immediate graph container update.


setGraphColor

public void setGraphColor(java.awt.Color color)
sets the color of the graph


setGraphName

public void setGraphName(java.lang.String name)
sets the name of the graph


getGraphColor

public java.awt.Color getGraphColor()
returns the color of the graph


getGraphName

public java.lang.String getGraphName()
returns the name of the graph


setGraphProperty

public void setGraphProperty(java.lang.Object keyObj,
                             java.lang.Object propObj)
sets the (key,value) of the data set properties


getGraphProperty

public java.lang.Object getGraphProperty(java.lang.Object keyObj)
sets the value of the data set property by the key-value


getGraphPropertySize

public int getGraphPropertySize()
returns the number of pairs (key,value)


getGraphPropertyKeys

public java.util.Set getGraphPropertyKeys()
returns the set of the keys


setDrawLinesOn

public void setDrawLinesOn(boolean drawLinesOn)
sets "draw lines" on/off


getDrawLinesOn

public boolean getDrawLinesOn()
returns the "draw lines on/off" state


setDrawPointsOn

public void setDrawPointsOn(boolean drawPointsOn)
sets "draw points" on/off


getDrawPointsOn

public boolean getDrawPointsOn()
returns the "draw points on/off" state


setGraphPointSize

public void setGraphPointSize(int pointSize)
sets the size of the point during drawing. This parameter is used if no external shape is set, and the filled circle is used to represent points.


getGraphPointSize

public int getGraphPointSize()
returns the size of the point during drawing. This parameter is used if no external shape is set, and the filled circle is used to represent points.


setGraphPointShape

public void setGraphPointShape(java.awt.Shape markShape)
sets the shape of the point during drawing. The input parameter could be null . By default it will be a circle.


getGraphPointShape

public java.awt.Shape getGraphPointShape()
returns the shape of the point during drawing.


setGraphPointFillingShape

public void setGraphPointFillingShape(boolean fillShape)
sets the filling shape property of the point during drawing. By default it will be true.


isGraphPointShapeFilled

public boolean isGraphPointShapeFilled()
returns the filling shape property of the point during drawing.


setLineThick

public void setLineThick(int lineThick)
sets the line thickness during drawing. The default value is 1.


getLineThick

public int getLineThick()
returns the line thickness during drawing.


getStroke

protected java.awt.BasicStroke getStroke()
returns the stroke for drawing.


main

public static void main(java.lang.String[] args)
this is a test method