Attributes modify->modified

This commit is contained in:
Alexander Nozik 2024-03-27 08:51:56 +03:00
parent ec88d6be9e
commit ecb5d28110
5 changed files with 7 additions and 7 deletions

View File

@ -83,8 +83,8 @@ public fun <A : Attribute<Unit>> Attributes.withAttribute(attribute: A): Attribu
/**
* Create a new [Attributes] by modifying the current one
*/
public fun <T> Attributes.modify(block: AttributesBuilder<T>.() -> Unit): Attributes = Attributes<T> {
putAll(this@modify)
public fun <T> Attributes.modified(block: AttributesBuilder<T>.() -> Unit): Attributes = Attributes<T> {
putAll(this@modified)
block()
}

View File

@ -26,7 +26,7 @@ public fun <T, A : Any> MultivariateIntegrand<T>.withAttribute(
public fun <T> MultivariateIntegrand<T>.withAttributes(
block: AttributesBuilder<MultivariateIntegrand<T>>.() -> Unit,
): MultivariateIntegrand<T> = withAttributes(attributes.modify(block))
): MultivariateIntegrand<T> = withAttributes(attributes.modified(block))
public inline fun <reified T : Any> MultivariateIntegrand(
attributeBuilder: AttributesBuilder<MultivariateIntegrand<T>>.() -> Unit,

View File

@ -27,7 +27,7 @@ public fun <T, A : Any> UnivariateIntegrand<T>.withAttribute(
public fun <T> UnivariateIntegrand<T>.withAttributes(
block: AttributesBuilder<UnivariateIntegrand<T>>.() -> Unit,
): UnivariateIntegrand<T> = withAttributes(attributes.modify(block))
): UnivariateIntegrand<T> = withAttributes(attributes.modified(block))
public inline fun <reified T : Any> UnivariateIntegrand(
attributeBuilder: AttributesBuilder<UnivariateIntegrand<T>>.() -> Unit,

View File

@ -65,7 +65,7 @@ public fun <T> FunctionOptimization<T>.withAttributes(
modifier: AttributesBuilder<FunctionOptimization<T>>.() -> Unit,
): FunctionOptimization<T> = FunctionOptimization(
expression,
attributes.modify(modifier),
attributes.modified(modifier),
)
/**

View File

@ -108,7 +108,7 @@ public fun XYOptimization(
public fun XYFit.withAttributes(
modifier: AttributesBuilder<XYFit>.() -> Unit,
): XYFit = XYFit(data, model, attributes.modify(modifier), pointToCurveDistance, pointWeight, xSymbol)
): XYFit = XYFit(data, model, attributes.modified(modifier), pointToCurveDistance, pointWeight, xSymbol)
public suspend fun XYColumnarData<Double, Double, Double>.fitWith(
optimizer: Optimizer<Double, XYFit>,
@ -123,7 +123,7 @@ public suspend fun XYColumnarData<Double, Double, Double>.fitWith(
val problem = XYFit(
this,
modelExpression,
attributes.modify<XYFit> {
attributes.modified<XYFit> {
set(OptimizationStartPoint(), startingPoint)
if (!hasAny<OptimizationLog>()) {
set(OptimizationLog, Loggable.console)