Record Class HierarchicalDataPoint
java.lang.Object
java.lang.Record
com.arbergashi.charts.model.HierarchicalDataPoint
- Record Components:
name- The name of the data point (e.g., "Users", "System").value- The quantitative value of this node. For parent nodes, this is often the sum of its children.children- A list of child nodes.
public record HierarchicalDataPoint(String name, double value, List<HierarchicalDataPoint> children)
extends Record
Represents a node in a hierarchical data structure, used for charts like Sunburst or Treemaps.
- Since:
- 2025-06-01
- Version:
- 1.0.0
- Author:
- Arber Gashi
-
Constructor Summary
ConstructorsConstructorDescriptionHierarchicalDataPoint(String name, double value) Convenience constructor for a leaf node (a node with no children).HierarchicalDataPoint(String name, double value, List<HierarchicalDataPoint> children) Creates a hierarchical data point, ensuring the children list is never null. -
Method Summary
Modifier and TypeMethodDescriptionchildren()Returns the value of thechildrenrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisLeaf()Checks if this node is a leaf (has no children).name()Returns the value of thenamerecord component.final StringtoString()Returns a string representation of this record class.doublevalue()Returns the value of thevaluerecord component.
-
Constructor Details
-
HierarchicalDataPoint
Creates a hierarchical data point, ensuring the children list is never null. -
HierarchicalDataPoint
Convenience constructor for a leaf node (a node with no children).- Parameters:
name- The name of the leaf node.value- The value of the leaf node.
-
-
Method Details
-
isLeaf
public boolean isLeaf()Checks if this node is a leaf (has no children).- Returns:
- true if this node has no children, false otherwise.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
name
-
value
-
children
-