Package xal.extension.widgets.plot
Class BasicGraphData
java.lang.Object
xal.extension.widgets.plot.BasicGraphData
- Direct Known Subclasses:
CubicSplineGraphData,EnvelopeCurve,ParticleCurve,UnwrappedGeneratorGraphData
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classDescription of the Classprotected static classDescription of the Classprotected static classDescription of the Classprotected static classDescription of the Class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ColorDescription of the Fieldprotected booleanDescription of the Fieldprotected booleanDescription of the Fieldprotected doubleDescription of the Fieldprotected booleanDescription of the Fieldprotected BasicStrokeDescription of the Fieldprotected intDescription of the Fieldprotected final ObjectDescription of the Fieldprotected ShapeDescription of the Fieldprotected booleanDescription of the Fieldprotected StringDescription of the Fieldprotected intDescription of the Fieldprotected intDescription of the FieldDescription of the Fieldprotected doubleDescription of the Fieldprotected doubleprotected Vector<BasicGraphData.XYpoint>Description of the Fieldprotected Vector<BasicGraphData.XYpoint>Description of the Fieldprotected doubleprotected double -
Constructor Summary
ConstructorsConstructorDescriptiondata set constructorBasicGraphData(int nPoint, int nInterpPointsIn) data set constructor with defined initial capacity for number of (x,y) points and interpolated points -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPoint(double[] x, double[] y) add an array of (x,y) points to the data setvoidaddPoint(double[] x, double[] y, double[] err) add an array of (x,y, error of y) points to the data setvoidaddPoint(double x, double y) add (x,y) point to the data setvoidaddPoint(double x, double y, double err) add (x,y, error of y) point to the data setprotected voidDescription of the Methodprotected intReturns the capacity attribute of the BasicGraphData objectbooleanreturns the "draw lines on/off" statebooleanreturns the "draw points on/off" statedoublegetErr(int index) returns the error value for certain indexreturns the color of the graphgetGraphDataContainer(int index) returns the graph containers where this data set has been registeredreturns the name of the graphreturns the shape of the point during drawing.intreturns the size of the point during drawing.getGraphProperty(Object keyObj) sets the value of the data set property by the key-valuereturns the set of the keysintreturns the number of pairs (key,value)booleanreturns true if data changes cause the immediate graph container update.doublegetInterpX(int index) returns x-value for a particular point in the interpolating data setdoublegetInterpY(int index) returns interpolated y-value from the interpolating data setintreturns the line thickness during drawing.Returns the lock object of the BasicGraphData objectdoublereturns the maximal y-errordoublegetMaxX()returns the maximal xdoublegetMaxY()returns the maximal ydoublegetMinX()returns the minimal xdoublegetMinY()returns the minimal yintreturns the number of graph containers where this data set has been registeredintreturns the number of data points in the interpolationintreturns the number of data pointsprotected BasicStrokereturns the stroke for drawing.doublegetValueDerivativeY(double x) get y'-value for certain x-valuedoublegetValueY(double x) get y-value for certain x-valuedoublegetX(int index) returns x-value from the containerdoublegetY(int index) returns y-value from the containerprotected voidinit(int nPoint, int nInterpPoints) initializes graph data containersbooleanreturns the filling shape property of the point during drawing.static voidthis is a test methodvoidregisters this data set into a graph container.voidremove all points from the data setvoidremoveContainer(Object obj) removes this data set from a graph container.voidremovePoint(int index) remove a point from the data setvoidsetDrawLinesOn(boolean drawLinesOn) sets "draw lines" on/offvoidsetDrawPointsOn(boolean drawPointsOn) sets "draw points" on/offvoidsetGraphColor(Color color) sets the color of the graphvoidsetGraphName(String name) sets the name of the graphvoidsetGraphPointFillingShape(boolean fillShape) sets the filling shape property of the point during drawing.voidsetGraphPointShape(Shape markShape) sets the shape of the point during drawing.voidsetGraphPointSize(int pointSize) sets the size of the point during drawing.voidsetGraphProperty(Object keyObj, Object propObj) sets the (key,value) of the data set propertiesvoidsetImmediateContainerUpdate(boolean immediateContainerUpdate) sets the immediate graph container update if data has been changed.voidsetLineDashPattern(float... dashPattern) Set the line stroke dash pattern.voidsetLineStroke(float width, float... dashPattern) Set the line stroke (both width and dash pattern).voidsetLineThick(int lineThick) sets the line thickness during drawing.protected voidcalls the methodrefreshGraphJPanel()of all graph containersFunctionGraphsJPanelwhere this data set has been registered.protected voidDescription of the MethodvoidupdatePoint(int index, double x, double y) update the y-value and x-value with certain index into the data setvoidupdatePoint(int index, double x, double y, double err) update the y-value, x-value and error with certain index into the data setvoidupdateValues(double[] x, double[] y) update all points if they do exist or create new if they do notvoidupdateValues(double[] x, double[] y, double[] err) update all points if they do exist or create new if they do notvoidupdateValuesY(double[] y) update the y-array into the data setvoidupdateValuesY(double[] y, double[] err) update the y-array with errors into the data setvoidupdateValueY(int index, double y) update the y-value with certain index into the data set
-
Field Details
-
propertyMap
Description of the Field -
lockUpObj
Description of the Field -
graphDataContainerV
Description of the Field -
immediateContainerUpdate
protected boolean immediateContainerUpdateDescription of the Field -
xyPointV
Description of the Field -
xyInterpPointV
Description of the Field -
nInterpPoints
protected int nInterpPointsDescription of the Field -
xMax
protected double xMaxDescription of the Field -
yMax
protected double yMax -
xMin
protected double xMin -
yMin
protected double yMin -
errYmax
protected double errYmax -
color
Description of the Field -
name
Description of the Field -
drawLinesOn
protected boolean drawLinesOnDescription of the Field -
drawPointsOn
protected boolean drawPointsOnDescription of the Field -
pointSize
protected int pointSizeDescription of the Field -
lineThick
protected int lineThickDescription of the Field -
lineStroke
Description of the Field -
markShape
Description of the Field -
markShapeFilled
protected boolean markShapeFilledDescription 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 ParameternInterpPointsIn- Description of the Parameter
-
-
Method Details
-
init
protected void init(int nPoint, int nInterpPoints) initializes graph data containers- Parameters:
nPoint- Description of the ParameternInterpPoints- 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 attributey- 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 attributey- The feature to be added to the Point attributeerr- 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 attributey- 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 attributey- The feature to be added to the Point attributeerr- 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 Parametery- Description of the Parametererr- 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 Parametery- 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 Parametererr- 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 Parametery- 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 Parameterx- Description of the Parametery- 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 Parameterx- Description of the Parametery- Description of the Parametererr- 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
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
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
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 methodrefreshGraphJPanel()of all graph containersFunctionGraphsJPanelwhere 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
sets the color of the graph- Parameters:
color- The new graphColor value
-
setGraphName
sets the name of the graph- Parameters:
name- The new graphName value
-
getGraphColor
returns the color of the graph- Returns:
- The graphColor value
-
getGraphName
returns the name of the graph- Returns:
- The graphName value
-
setGraphProperty
sets the (key,value) of the data set properties- Parameters:
keyObj- The new graphProperty valuepropObj- The new graphProperty value
-
getGraphProperty
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
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
sets the shape of the point during drawing. The input parameter could benull. By default it will be a circle.- Parameters:
markShape- The new graphPointShape value
-
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
returns the stroke for drawing.- Returns:
- The stroke value
-
getLockObject
Returns the lock object of the BasicGraphData object- Returns:
- The lock object
-
main
this is a test method- Parameters:
args- Description of the Parameter
-