Class BasicGraphData

java.lang.Object
xal.extension.widgets.plot.BasicGraphData
Direct Known Subclasses:
CubicSplineGraphData, EnvelopeCurve, ParticleCurve, UnwrappedGeneratorGraphData

public class BasicGraphData extends 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.
Version:
1.0
Author:
A. Shishlo
See Also:
  • Field Details

    • propertyMap

      protected HashMap<Object,Object> propertyMap
      Description of the Field
    • lockUpObj

      protected final Object lockUpObj
      Description of the Field
    • graphDataContainerV

      protected Vector<Object> graphDataContainerV
      Description of the Field
    • immediateContainerUpdate

      protected boolean immediateContainerUpdate
      Description of the Field
    • xyPointV

      protected Vector<BasicGraphData.XYpoint> xyPointV
      Description of the Field
    • xyInterpPointV

      protected Vector<BasicGraphData.XYpoint> xyInterpPointV
      Description of the Field
    • nInterpPoints

      protected int nInterpPoints
      Description of the Field
    • xMax

      protected double xMax
      Description of the Field
    • yMax

      protected double yMax
    • xMin

      protected double xMin
    • yMin

      protected double yMin
    • errYmax

      protected double errYmax
    • color

      protected Color color
      Description of the Field
    • name

      protected String name
      Description of the Field
    • drawLinesOn

      protected boolean drawLinesOn
      Description of the Field
    • drawPointsOn

      protected boolean drawPointsOn
      Description of the Field
    • pointSize

      protected int pointSize
      Description of the Field
    • lineThick

      protected int lineThick
      Description of the Field
    • lineStroke

      protected BasicStroke lineStroke
      Description of the Field
    • markShape

      protected Shape markShape
      Description of the Field
    • markShapeFilled

      protected boolean markShapeFilled
      Description of the Field
  • Constructor Details

    • 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
      Parameters:
      nPoint - Description of the Parameter
      nInterpPointsIn - Description of the Parameter
  • Method Details

    • init

      protected void init(int nPoint, int nInterpPoints)
      initializes graph data containers
      Parameters:
      nPoint - Description of the Parameter
      nInterpPoints - Description of the Parameter
    • addPoint

      public void addPoint(double x, double y)
      add (x,y) point to the data set
      Parameters:
      x - The feature to be added to the Point attribute
      y - The feature to be added to the Point attribute
    • addPoint

      public void addPoint(double x, double y, double err)
      add (x,y, error of y) point to the data set
      Parameters:
      x - The feature to be added to the Point attribute
      y - The feature to be added to the Point attribute
      err - The feature to be added to the Point attribute
    • addPoint

      public void addPoint(double[] x, double[] y)
      add an array of (x,y) points to the data set
      Parameters:
      x - The feature to be added to the Point attribute
      y - The feature to be added to the Point attribute
    • addPoint

      public void addPoint(double[] x, double[] y, double[] err)
      add an array of (x,y, error of y) points to the data set
      Parameters:
      x - The feature to be added to the Point attribute
      y - The feature to be added to the Point attribute
      err - The feature to be added to the Point attribute
    • updateValues

      public void updateValues(double[] x, double[] y, double[] err)
      update all points if they do exist or create new if they do not
      Parameters:
      x - Description of the Parameter
      y - Description of the Parameter
      err - Description of the Parameter
    • updateValues

      public void updateValues(double[] x, double[] y)
      update all points if they do exist or create new if they do not
      Parameters:
      x - Description of the Parameter
      y - Description of the Parameter
    • updateValuesY

      public void updateValuesY(double[] y, double[] err)
      update the y-array with errors into the data set
      Parameters:
      y - Description of the Parameter
      err - Description of the Parameter
    • updateValuesY

      public void updateValuesY(double[] y)
      update the y-array into the data set
      Parameters:
      y - Description of the Parameter
    • updateValueY

      public void updateValueY(int index, double y)
      update the y-value with certain index into the data set
      Parameters:
      index - Description of the Parameter
      y - Description of the Parameter
    • updatePoint

      public void updatePoint(int index, double x, double y)
      update the y-value and x-value with certain index into the data set
      Parameters:
      index - Description of the Parameter
      x - Description of the Parameter
      y - Description of the Parameter
    • 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
      Parameters:
      index - Description of the Parameter
      x - Description of the Parameter
      y - Description of the Parameter
      err - Description of the Parameter
    • removePoint

      public void removePoint(int index)
      remove a point from the data set
      Parameters:
      index - Description of the Parameter
    • removeAllPoints

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

      protected void calculateRepresentation()
      Description of the Method
    • getValueY

      public double getValueY(double x)
      get y-value for certain x-value
      Parameters:
      x - Description of the Parameter
      Returns:
      The valueY value
    • getValueDerivativeY

      public double getValueDerivativeY(double x)
      get y'-value for certain x-value
      Parameters:
      x - Description of the Parameter
      Returns:
      The valueDerivativeY value
    • getCapacity

      protected int getCapacity()
      Returns the capacity attribute of the BasicGraphData object
      Returns:
      The capacity value
    • getNumbOfPoints

      public int getNumbOfPoints()
      returns the number of data points
      Returns:
      The numbOfPoints value
    • getNumbOfInterpPoints

      public int getNumbOfInterpPoints()
      returns the number of data points in the interpolation
      Returns:
      The numbOfInterpPoints value
    • getX

      public double getX(int index)
      returns x-value from the container
      Parameters:
      index - Description of the Parameter
      Returns:
      The x value
    • getY

      public double getY(int index)
      returns y-value from the container
      Parameters:
      index - Description of the Parameter
      Returns:
      The y value
    • getInterpX

      public double getInterpX(int index)
      returns x-value for a particular point in the interpolating data set
      Parameters:
      index - Description of the Parameter
      Returns:
      The interpX value
    • getInterpY

      public double getInterpY(int index)
      returns interpolated y-value from the interpolating data set
      Parameters:
      index - Description of the Parameter
      Returns:
      The interpY value
    • getErr

      public double getErr(int index)
      returns the error value for certain index
      Parameters:
      index - Description of the Parameter
      Returns:
      The err value
    • getMaxErr

      public double getMaxErr()
      returns the maximal y-error
      Returns:
      The maxErr value
    • getMinX

      public double getMinX()
      returns the minimal x
      Returns:
      The minX value
    • getMaxX

      public double getMaxX()
      returns the maximal x
      Returns:
      The maxX value
    • getMinY

      public double getMinY()
      returns the minimal y
      Returns:
      The minY value
    • getMaxY

      public double getMaxY()
      returns the maximal y
      Returns:
      The maxY value
    • updateData

      protected void updateData()
      Description of the Method
    • 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
      Parameters:
      gdc - Description of the Parameter
    • getNumberOfGraphDataContainers

      public int getNumberOfGraphDataContainers()
      returns the number of graph containers where this data set has been registered
      Returns:
      The numberOfGraphDataContainers value
    • removeContainer

      public void removeContainer(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
      Parameters:
      obj - Description of the Parameter
    • getGraphDataContainer

      public FunctionGraphsJPanel getGraphDataContainer(int index)
      returns the graph containers where this data set has been registered
      Parameters:
      index - Description of the Parameter
      Returns:
      The graphDataContainer value
    • 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.
      Parameters:
      immediateContainerUpdate - The new immediateContainerUpdate value
    • getImmediateContainerUpdate

      public boolean getImmediateContainerUpdate()
      returns true if data changes cause the immediate graph container update.
      Returns:
      The immediateContainerUpdate value
    • setGraphColor

      public void setGraphColor(Color color)
      sets the color of the graph
      Parameters:
      color - The new graphColor value
    • setGraphName

      public void setGraphName(String name)
      sets the name of the graph
      Parameters:
      name - The new graphName value
    • getGraphColor

      public Color getGraphColor()
      returns the color of the graph
      Returns:
      The graphColor value
    • getGraphName

      public String getGraphName()
      returns the name of the graph
      Returns:
      The graphName value
    • setGraphProperty

      public void setGraphProperty(Object keyObj, Object propObj)
      sets the (key,value) of the data set properties
      Parameters:
      keyObj - The new graphProperty value
      propObj - The new graphProperty value
    • getGraphProperty

      public Object getGraphProperty(Object keyObj)
      sets the value of the data set property by the key-value
      Parameters:
      keyObj - Description of the Parameter
      Returns:
      The graphProperty value
    • getGraphPropertySize

      public int getGraphPropertySize()
      returns the number of pairs (key,value)
      Returns:
      The graphPropertySize value
    • getGraphPropertyKeys

      public Set<Object> getGraphPropertyKeys()
      returns the set of the keys
      Returns:
      The graphPropertyKeys value
    • setDrawLinesOn

      public void setDrawLinesOn(boolean drawLinesOn)
      sets "draw lines" on/off
      Parameters:
      drawLinesOn - The new drawLinesOn value
    • getDrawLinesOn

      public boolean getDrawLinesOn()
      returns the "draw lines on/off" state
      Returns:
      The drawLinesOn value
    • setDrawPointsOn

      public void setDrawPointsOn(boolean drawPointsOn)
      sets "draw points" on/off
      Parameters:
      drawPointsOn - The new drawPointsOn value
    • getDrawPointsOn

      public boolean getDrawPointsOn()
      returns the "draw points on/off" state
      Returns:
      The drawPointsOn value
    • 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.
      Parameters:
      pointSize - The new graphPointSize value
    • 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.
      Returns:
      The graphPointSize value
    • setGraphPointShape

      public void setGraphPointShape(Shape markShape)
      sets the shape of the point during drawing. The input parameter could be null . By default it will be a circle.
      Parameters:
      markShape - The new graphPointShape value
    • getGraphPointShape

      public Shape getGraphPointShape()
      returns the shape of the point during drawing.
      Returns:
      The graphPointShape value
    • setGraphPointFillingShape

      public void setGraphPointFillingShape(boolean fillShape)
      sets the filling shape property of the point during drawing. By default it will be true.
      Parameters:
      fillShape - The new graphPointFillingShape value
    • isGraphPointShapeFilled

      public boolean isGraphPointShapeFilled()
      returns the filling shape property of the point during drawing.
      Returns:
      The graphPointShapeFilled value
    • setLineThick

      public void setLineThick(int lineThick)
      sets the line thickness during drawing. The default value is 1.
      Parameters:
      lineThick - The new lineThick value
    • getLineThick

      public int getLineThick()
      returns the line thickness during drawing.
      Returns:
      The lineThick value
    • setLineDashPattern

      public void setLineDashPattern(float... dashPattern)
      Set the line stroke dash pattern.
      Parameters:
      dashPattern - array of dash segment lengths
    • setLineStroke

      public void setLineStroke(float width, float... dashPattern)
      Set the line stroke (both width and dash pattern).
      Parameters:
      width - line width (aka thickness)
      dashPattern - array of dash segment lengths
    • getStroke

      protected BasicStroke getStroke()
      returns the stroke for drawing.
      Returns:
      The stroke value
    • getLockObject

      public Object getLockObject()
      Returns the lock object of the BasicGraphData object
      Returns:
      The lock object
    • main

      public static void main(String[] args)
      this is a test method
      Parameters:
      args - Description of the Parameter