Class ResultDoubleValue
java.lang.Object
com.amalgamasimulation.studies.result.ResultElement
com.amalgamasimulation.studies.result.ResultDoubleValue
- All Implemented Interfaces:
ResultValue
- Direct Known Subclasses:
SummaryResultGroup
A result element representing a double precision floating-point value.
Extends
ResultElement and implements ResultValue to provide
numeric value functionality within a hierarchical result structure.
This class provides methods to get and set the double value. It also provides
formatting capabilities through the DoubleFormats enum.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionResultDoubleValue(double value) Constructs a new ResultDoubleValue with the specified value.ResultDoubleValue(Supplier<Double> valueSupplier) Constructs a new ResultDoubleValue with a value supplier for lazy initialization. -
Method Summary
Modifier and TypeMethodDescriptionformat()Gets the current formatter function based on the configured format.format(DoubleFormats format) Sets the display format for this value.Gets the current display format for this value.Sets the identifier for this element.value()Gets the double value of this element.Methods inherited from class com.amalgamasimulation.studies.result.ResultElement
children, descendants, element, element, element, element, element, element, element, element, element, element, find, findByTags, findOrThrow, findOrThrow, getChildrenDoubleResults, getChildrenDoubleResults, getChildrenGroups, getChildrenGroups, getDateTimeOrThrow, getDateTimeOrThrow, getFunctionOrDefault, getFunctionOrThrow, getGroupOrThrow, getOrDefault, getOrThrow, getOrThrow, getStringOrThrow, getStringOrThrow, group, group, hasSiblingWithSameId, id, id, parent, path, root, setParent, summaryResultGroup, summaryResultGroup, tag, tagsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.amalgamasimulation.studies.result.ResultValue
path
-
Field Details
-
valueSupplier
-
-
Constructor Details
-
ResultDoubleValue
public ResultDoubleValue(double value) Constructs a new ResultDoubleValue with the specified value.- Parameters:
value- the double value to store
-
ResultDoubleValue
Constructs a new ResultDoubleValue with a value supplier for lazy initialization. The supplier will be called exactly once when the value is first requested.- Parameters:
valueSupplier- the supplier providing the double value (cannot be null)- Throws:
NullPointerException- if the valueSupplier parameter is null
-
-
Method Details
-
value
Gets the double value of this element. If constructed with a supplier, this will trigger the first (and only) call to the supplier.- Specified by:
valuein interfaceResultValue- Returns:
- the double value, which may be Double.NaN
-
format
Gets the current formatter function based on the configured format.- Returns:
- a function that formats double values according to the current format
-
format
Sets the display format for this value.- Parameters:
format- the format to use (cannot be null)- Returns:
- this element for method chaining
- Throws:
NullPointerException- if the format parameter is null
-
getFormat
Gets the current display format for this value. Default formatDoubleFormats.KMB.- Returns:
- the current format setting
-
id
Description copied from class:ResultElementSets the identifier for this element. The ID must be unique among siblings.- Overrides:
idin classResultElement- Parameters:
id- the unique identifier for this element- Returns:
- this element for method chaining
-