Record Class ChartPoint
java.lang.Object
java.lang.Record
com.arbergashi.charts.model.ChartPoint
- All Implemented Interfaces:
Serializable, Comparable<ChartPoint>
public record ChartPoint(double x, double y, double weight, double min, double max, String label)
extends Record
implements Serializable, Comparable<ChartPoint>
Enterprise data point representation for the ArberGashi engine.
Optimized for JDK 25+: value-object semantics and fluent API.
Suitable for high-frequency trading, scientific data and IoT sensor streams.
- Since:
- 2025-12-30
- Version:
- 1.0.0
- Author:
- Arber Gashi
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionChartPoint(double x, double y) ChartPoint(double x, double y, double weight, double min, double max, String label) Compact canonical constructor with validation for numerical stability.ChartPoint(double x, double y, String label) -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ChartPoint other) doubledelta()Computes the span between max and min (e.g., volatility).final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks whether the point lies within its min/max range.label()Returns the value of thelabelrecord component.doublemax()Returns the value of themaxrecord component.doublemin()Returns the value of theminrecord component.static ChartPointof(double x, double y) static ChartPointofOHLC(double x, double open, double high, double low, double close) Specialized for candlestick semantics: y==close, weight==open.static ChartPointofRange(double x, double y, double min, double max) Specialized for error bars or box plots.final StringtoString()Returns a string representation of this record class.doubleweight()Returns the value of theweightrecord component.Returns a copy with a new label.withWeight(double weight) Returns a copy with the provided weight, original remains unchanged.doublex()Returns the value of thexrecord component.doubley()Returns the value of theyrecord component.
-
Constructor Details
-
ChartPoint
Compact canonical constructor with validation for numerical stability. -
ChartPoint
public ChartPoint(double x, double y) -
ChartPoint
-
-
Method Details
-
of
-
ofOHLC
Specialized for candlestick semantics: y==close, weight==open. -
ofRange
Specialized for error bars or box plots. -
withWeight
Returns a copy with the provided weight, original remains unchanged. -
withLabel
Returns a copy with a new label. -
isWithinRange
public boolean isWithinRange()Checks whether the point lies within its min/max range. -
delta
public double delta()Computes the span between max and min (e.g., volatility). -
compareTo
- Specified by:
compareToin interfaceComparable<ChartPoint>
-
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. -
x
public double x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public double y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
weight
public double weight()Returns the value of theweightrecord component.- Returns:
- the value of the
weightrecord component
-
min
public double min()Returns the value of theminrecord component.- Returns:
- the value of the
minrecord component
-
max
public double max()Returns the value of themaxrecord component.- Returns:
- the value of the
maxrecord component
-
label
Returns the value of thelabelrecord component.- Returns:
- the value of the
labelrecord component
-