Class Dataset

java.lang.Object
com.digitizer.core.Dataset

public class Dataset extends Object
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 Details

    • Dataset

      public Dataset(String name, String hexColor)
      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

      public Dataset(Dataset other)
      Copy constructor for creating a new instance with the same data.
      Parameters:
      other - the dataset to copy
  • Method Details

    • isVisible

      public boolean isVisible()
    • setVisible

      public void setVisible(boolean visible)
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getHexColor

      public String getHexColor()
    • setHexColor

      public void setHexColor(String hexColor)
    • getColor

      public javafx.scene.paint.Color getColor()
    • isUseSecondaryYAxis

      public boolean isUseSecondaryYAxis()
    • setUseSecondaryYAxis

      public void setUseSecondaryYAxis(boolean useSecondaryYAxis)
    • getPoints

      public List<Point> getPoints()
    • setPoints

      public void setPoints(List<Point> points)
    • addPoint

      public void addPoint(Point point)
      Adds a point to this dataset.
      Parameters:
      point - the point to add
    • removePoint

      public boolean removePoint(Point point)
      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

      public Point removePoint(int index)
      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

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object