public abstract class RemoteInt
internal constructor(
@get:Suppress("AutoBoxing") public override val constantValueOrNull: Int?,
cacheKey: RemoteStateCacheKey,
internal val arrayProvider: (creationState: RemoteComposeCreationState) -> LongArray,
) : BaseRemoteState<Int>(cacheKey)
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).
Properties
absoluteValue
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public val absoluteValue: RemoteInt
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. |
toRemoteLong
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun toRemoteLong(): RemoteLong
Converts this RemoteInt to a RemoteLong.
Returns
| A RemoteLong representing this integer as a long. |
toRemoteString
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
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
isEqualTo
public fun isEqualTo(other: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if other is equal to the value of this RemoteInt or false otherwise.
eq
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun eq(other: RemoteInt): RemoteBoolean
isNotEqualTo
public fun isNotEqualTo(other: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if other is not equal to the value of this RemoteInt or false otherwise.
ne
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun ne(other: RemoteInt): RemoteBoolean
isLessThan
public fun isLessThan(other: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if other is less than the value of this RemoteInt or false otherwise.
lt
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun lt(other: RemoteInt): RemoteBoolean
isLessThanOrEqual
public fun isLessThanOrEqual(other: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if other is less than or equal to the value of this RemoteInt or false otherwise.
le
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun le(other: RemoteInt): RemoteBoolean
isGreaterThan
public fun isGreaterThan(other: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if other is greater than the value of this RemoteInt or false otherwise.
gt
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun gt(other: RemoteInt): RemoteBoolean
isGreaterThanOrEqual
public fun isGreaterThanOrEqual(other: RemoteInt): RemoteBoolean
Returns a RemoteBoolean that evaluates to true if other is greater than or equal to the value of this RemoteInt or false otherwise.
ge
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun ge(other: RemoteInt): RemoteBoolean
shl
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun shl(other: RemoteInt): RemoteInt
Returns a RemoteInt that evaluates to the value of this RemoteInt shifted left by the value of other.
This is designed to align with the standard Kotlin Int.shl infix function.
shr
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun shr(other: RemoteInt): RemoteInt
Returns a RemoteInt that evaluates to the value of this RemoteInt shifted right by the value of other.
This is designed to align with the standard Kotlin Int.shr infix function.
or
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun or(other: RemoteInt): RemoteInt
Returns a RemoteInt that evaluates to the value of this RemoteInt logic or with the value of other.
This is designed to align with the standard Kotlin Int.or infix function.
and
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun and(other: RemoteInt): RemoteInt
Returns a RemoteInt that evaluates to the value of this RemoteInt logic and with the value of other.
This is designed to align with the standard Kotlin Int.and infix function.
xor
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public infix fun xor(other: RemoteInt): RemoteInt
Returns a RemoteInt that evaluates to the value of this RemoteInt logic xor with the value of other.
This is designed to align with the standard Kotlin Int.xor infix function.
Companion Object
Methods
public operator fun invoke(value: Int): RemoteInt
@JvmStatic
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun createForId(v: Long): RemoteInt
Creates a RemoteInt referencing a remote ID.
Parameters
| v | The remote ID. |
Returns
| A RemoteInt referencing the ID. |
@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. |
@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. |
@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. |