public abstract class RemoteFloat internal constructor() : BaseRemoteState<Float>()
Abstract base class for all remote float representations.
RemoteFloat represents a floating-point value that can be a constant, a possibly named variable, or a dynamic expression (e.g., an arithmetic operation).
Functions
toRemoteInt
public fun toRemoteInt(): RemoteInt
Returns a RemoteInt that evaluates to the result of this RemoteFloat converted to Int.
toRemoteString
public fun toRemoteString(
before: Int,
after: Int = 2,
flags: Int = PAD_AFTER_ZERO,
): RemoteString
Returns a RemoteString that converts the result of this RemoteFloat with specified formatting.
Parameters
| before | The number of digits to show before the decimal point. |
| after | The number of digits to show after the decimal point (defaults to 2). |
| flags | Formatting flags for the string conversion (defaults to TextFromFloat.PAD_AFTER_ZERO). |
Returns
| A RemoteString representing the formatted float. |
toRemoteString
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun toRemoteString(
format: android.icu.text.DecimalFormat = DefaultDecimalFormat
): RemoteString
Returns a RemoteString that evaluates to the result of this RemoteFloat formatted according to the provided android.icu.text.DecimalFormat.
This method maps the localized ICU android.icu.text.DecimalFormat configuration (including padding, rounding, and digit constraints) to a remote-compatible string representation. It specifically handles complex padding logic and threshold-based selections to ensure the formatted output remains consistent when evaluated on the remote target.
Parameters
| format | The ICU android.icu.text.DecimalFormat to use for determining formatting options like separators, grouping, and padding width. |
Returns
| A RemoteString representing the formatted float. |
toRemoteString
public fun toRemoteString(format: DecimalFormat): RemoteString
Returns a RemoteString that evaluates to the result of this RemoteFloat formatted according to the provided DecimalFormat.
This method maps the localized DecimalFormat symbols (such as separators and grouping sizes) and configuration (such as padding and rounding) to a remote-compatible string representation.
Parameters
| format | The DecimalFormat to use for determining separators, grouping, and padding. |
Returns
| A RemoteString representing the formatted float. |
unaryMinus
public operator fun unaryMinus(): RemoteFloat
Returns a new RemoteFloat that evaluates to the negative of this RemoteFloat.
rem
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun rem(v: Float): RemoteFloat
Returns a new RemoteFloat that evaluates to this RemoteFloat modulo v.
rem
public operator fun rem(v: RemoteFloat): RemoteFloat
Returns a new RemoteFloat that evaluates to this RemoteFloat modulo v.
min
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun min(v: Float): RemoteFloat
Returns a new RemoteFloat that evaluates to minimum of this RemoteFloat and v.
min
public fun min(v: RemoteFloat): RemoteFloat
Returns a new RemoteFloat that evaluates to minimum of this RemoteFloat and v.
plus
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun plus(v: Float): RemoteFloat
Returns a new RemoteFloat that evaluates to this RemoteFloat plus v.
plus
public operator fun plus(v: RemoteFloat): RemoteFloat
Returns a new RemoteFloat that evaluates to this RemoteFloat plus v.
minus
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun minus(v: Float): RemoteFloat
Returns a new RemoteFloat that evaluates to this RemoteFloat minus v.
minus
public operator fun minus(v: RemoteFloat): RemoteFloat
Returns a new RemoteFloat that evaluates to this RemoteFloat minus v.
times
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun times(v: Float): RemoteFloat
Returns a new RemoteFloat that evaluates to this RemoteFloat times v.
times
public operator fun times(v: RemoteFloat): RemoteFloat
Returns a new RemoteFloat that evaluates to this RemoteFloat times v.
div
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun div(v: Float): RemoteFloat
Returns a new RemoteFloat that evaluates to this RemoteFloat div v.
div
public operator fun div(v: RemoteFloat): RemoteFloat
Returns a new RemoteFloat that evaluates to this RemoteFloat div v.
createReference
@JvmOverloads
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun createReference(forceRemote: Boolean = false): RemoteFloat
Returns a RemoteFloat that is a reference of this RemoteFloat.
This is temporarily useful because the floatArray has a maximum size.
Parameters
| forceRemote | If true, forces the creation of a remote reference even if the value is constant. |
eq
public infix fun eq(b: RemoteFloat): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is equal to the value of this RemoteFloat or false otherwise.
ne
public infix fun ne(b: RemoteFloat): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is not equal to the value of this RemoteFloat or false otherwise.
lt
public infix fun lt(b: RemoteFloat): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is less than the value of this RemoteFloat or false otherwise.
le
public infix fun le(b: RemoteFloat): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is less than or equal to the value of this RemoteFloat or false otherwise.
gt
public infix fun gt(b: RemoteFloat): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is greater than the value of this RemoteFloat or false otherwise.
ge
public infix fun ge(b: RemoteFloat): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is greater than or equal to the value of this RemoteFloat or false otherwise.
Companion Object
Methods
invoke
public operator fun invoke(float: Float): RemoteFloat
Creates a RemoteFloat from a constant Float value.
Parameters
| float | The value to wrap. |
Returns
| A RemoteFloat representing the given constant or encoded id. |
createNamedRemoteFloat
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@JvmStatic
public fun createNamedRemoteFloat(
name: String,
defaultValue: Float,
domain: RemoteState.Domain = RemoteState.Domain.User,
): RemoteFloat
Creates a named RemoteFloat with an initial value. This allows referring to a float by a symbolic name in the remote document. Named remote ints can be set via AndroidRemoteContext.setNamedFloat.
Parameters
| name | The name of the remote float. |
| defaultValue | The initial value of the remote float. |
| domain | The domain of the named float (defaults to RemoteState.Domain.User). This helps avoid name collisions. |
Returns
| A RemoteFloat representing the named float. |
createNamedRemoteFloatExpression
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@JvmStatic
public fun createNamedRemoteFloatExpression(
name: String,
domain: RemoteState.Domain = RemoteState.Domain.User,
expression: RemoteFloatContext.() -> RemoteFloat,
): RemoteFloat