public abstract class RemoteInt
internal constructor(
@get:Suppress("AutoBoxing") public override val constantValueOrNull: Int?,
internal val arrayProvider: (creationState: RemoteComposeCreationState) -> LongArray,
) : BaseRemoteState<Int>()
Abstract base class for all remote integer representations.
RemoteInt represents an integer value that can be a constant, a named variable, or a dynamic expression (e.g., a bitwise OR).
Functions
toRemoteFloat
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun toRemoteFloat(): RemoteFloat
Converts this RemoteInt to a RemoteFloat. If the RemoteInt is a literal, it\'s directly converted to a float. Otherwise, a RemoteFloatExpression is created that references the remote float ID of this integer.
Returns
A RemoteFloatExpression representing this integer as a float. |
toRemoteString
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun toRemoteString(before: Int, flags: Int = TextFromFloat.PAD_PRE_SPACE): RemoteString
Converts this RemoteInt to a RemoteString. The conversion includes formatting options such as the number of digits to display and padding flags.
Parameters
| before | The number of digits to display. |
| flags | The flags that control how the number is formatted. See TextFromFloat. |
toRemoteString
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun toRemoteString(
format: android.icu.text.DecimalFormat = DefaultIntegerFormat
): RemoteString
Converts this RemoteInt to a RemoteString using the specified format.
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 android.icu.text.DecimalFormat used to format the integer value. Defaults to DefaultIntegerFormat. |
Returns
| A RemoteString representing the formatted integer value. |
toRemoteString
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun toRemoteString(format: DecimalFormat): RemoteString
Converts this RemoteInt to a RemoteString.
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. |
createReference
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun createReference(): RemoteInt
Returns a RemoteInt that is a reference of this RemoteInt.
This is temporarily useful because the floatArray has a maximum size.
plus
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun plus(v: Int): RemoteInt
minus
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun minus(v: Int): RemoteInt
times
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun times(v: Int): RemoteInt
div
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun div(v: Int): RemoteInt
rem
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun rem(v: Int): RemoteInt
plus
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun plus(v: RemoteInt): RemoteInt
minus
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun minus(v: RemoteInt): RemoteInt
times
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun times(v: RemoteInt): RemoteInt
div
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun div(v: RemoteInt): RemoteInt
rem
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun rem(v: RemoteInt): RemoteInt
unaryMinus
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun unaryMinus(): RemoteInt
inv
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun inv(): RemoteInt
eq
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun eq(b: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is equal to the value of this RemoteInt or false otherwise.
ne
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun ne(b: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is not equal to the value of this RemoteInt or false otherwise.
lt
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun lt(b: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is less than the value of this RemoteInt or false otherwise.
le
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun le(b: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is less than or equal to the value of this RemoteInt or false otherwise.
gt
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun gt(b: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is greater than the value of this RemoteInt or false otherwise.
ge
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun ge(b: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if b is greater than or equal to the value of this RemoteInt or false otherwise.
shl
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun shl(v: RemoteInt): RemoteInt
Returns a RemoteInt that evaluates to the value of this RemoteInt shifted left by the value of v.
shr
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun shr(v: RemoteInt): RemoteInt
Returns a RemoteInt that evaluates to the value of this RemoteInt shifted right by the value of v.
or
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun or(v: RemoteInt): RemoteInt
Returns a RemoteInt that evaluates to the value of this RemoteInt logic or with the value of v.
and
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun and(v: RemoteInt): RemoteInt
Returns a RemoteInt that evaluates to the value of this RemoteInt logic and with the value of v.
xor
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun xor(v: RemoteInt): RemoteInt
Returns a RemoteInt that evaluates to the value of this RemoteInt logic xor with the value of v.
Companion Object
Methods
invoke
public operator fun invoke(value: Int): RemoteInt
isLiteral
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun isLiteral(v: Long): Boolean
Checks if a given Long value is considered a literal (i.e., not an ID or an OP code).
Parameters
| v | The Long value to check. |
Returns
true if the value is a literal, false otherwise. |
isConstant
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun isConstant(v: Long): Boolean
Checks if a given Long value representing a remote integer is considered constant. This performs a conservative check, assuming that variables are not constant unless explicitly determined otherwise.
Parameters
| v | The Long value representing a remote integer (could be a literal or an ID). |
Returns
true if the value is constant, false otherwise. |
Deprecated Use createForId
invoke
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public operator fun invoke(v: Long): RemoteInt
Creates a RemoteInt instance from a Long value, which could be a literal or an ID. The hasConstantValue is determined by calling isConstant.
Parameters
| v | The constant Long value. |
Returns
A RemoteIntExpression representing the constant integer. |
createNamedRemoteInt
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@JvmStatic
public fun createNamedRemoteInt(
name: String,
defaultValue: Int,
domain: RemoteState.Domain = RemoteState.Domain.User,
): RemoteInt
Creates a named RemoteInt with an initial value. Named remote ints can be set via AndroidRemoteContext.setNamedInt.
Parameters
| name | The unique name for this remote long. |
| defaultValue | The initial Int value for the named remote int. |
| domain | The domain of the named integer (defaults to RemoteState.Domain.User). |
Returns
| A RemoteInt representing the named int. |