Package com.digitizer.core
Class Dataset
java.lang.Object
com.digitizer.core.Dataset
Represents a dataset with a name, color and a mutable collection of
Points.
Each dataset contains a user-visible name and a CSS hex color string.
The color is cached as a Color for efficient
rendering on the CanvasPanel. While datasets
may be modified at runtime, callers should generally avoid changing
internal lists directly unless intentionally editing the dataset state.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a point to this dataset.voidClears all points from this dataset.booleanjavafx.scene.paint.ColorgetColor()Gets the cachedColorused for rendering.Gets the dataset color expressed as a hex string (e.g.getName()Gets the dataset name (label shown in the UI).intGets the number of points in this dataset.Returns the mutable list of points belonging to this dataset.inthashCode()booleanReturns whether this dataset should be plotted against the secondary Y axis.booleanReturns whether the dataset is visible on the canvas.removePoint(int index) Removes a point at the specified index.booleanremovePoint(Point point) Removes a point from this dataset.voidsetHexColor(String hexColor) Sets the dataset hex color and updates the cachedColor.voidSets the dataset name.voidReplaces the internal points list.voidsetUseSecondaryYAxis(boolean useSecondaryYAxis) Sets whether this dataset should use the secondary Y axis.voidsetVisible(boolean visible) Sets the dataset visibility.toString()
-
Constructor Details
-
Dataset
Constructs a new Dataset with the given name and hex color.- Parameters:
name- the dataset name (user-visible label)hexColor- the color as a hex string (e.g., "#0072B2")
-
Dataset
Copy constructor for creating a new instance with the same data.- Parameters:
other- the dataset to copy
-
-
Method Details
-
isVisible
public boolean isVisible()Returns whether the dataset is visible on the canvas.- Returns:
- true if visible
-
setVisible
public void setVisible(boolean visible) Sets the dataset visibility.- Parameters:
visible- true to show the dataset
-
getName
Gets the dataset name (label shown in the UI).- Returns:
- the dataset name
-
setName
Sets the dataset name.- Parameters:
name- the new dataset name (must not be null)
-
getHexColor
Gets the dataset color expressed as a hex string (e.g. "#0072B2").- Returns:
- the hex color string
-
setHexColor
Sets the dataset hex color and updates the cachedColor.- Parameters:
hexColor- the hex color string (must not be null)
-
getColor
public javafx.scene.paint.Color getColor()Gets the cachedColorused for rendering.- Returns:
- the JavaFX Color for this dataset
-
isUseSecondaryYAxis
public boolean isUseSecondaryYAxis()Returns whether this dataset should be plotted against the secondary Y axis.- Returns:
- true if using the secondary Y axis
-
setUseSecondaryYAxis
public void setUseSecondaryYAxis(boolean useSecondaryYAxis) Sets whether this dataset should use the secondary Y axis.- Parameters:
useSecondaryYAxis- true to map this dataset to the secondary Y axis
-
getPoints
Returns the mutable list of points belonging to this dataset.- Returns:
- list of
Pointobjects (never null)
-
setPoints
Replaces the internal points list. Caller must provide a non-null list.- Parameters:
points- the new list of points (must not be null)
-
addPoint
Adds a point to this dataset.- Parameters:
point- the point to add (must not be null)
-
removePoint
Removes a point from this dataset.- Parameters:
point- the point to remove- Returns:
- true if the point was removed, false if it was not in the list
-
removePoint
Removes a point at the specified index.- Parameters:
index- the index of the point to remove- Returns:
- the removed point
- Throws:
IndexOutOfBoundsException- if the index is out of range
-
clearPoints
public void clearPoints()Clears all points from this dataset. -
getPointCount
public int getPointCount()Gets the number of points in this dataset.- Returns:
- the point count
-
toString
-
equals
-
hashCode
public int hashCode()
-