Added in API level 34

Power


class Power : Comparable<Power!>
kotlin.Any
   ↳ android.health.connect.datatypes.units.Power

Represents a unit of power. Supported units: watts

Summary

Public methods
Int
compareTo(other: Power)

Compares this object with the specified object for order.

Boolean
equals(other: Any?)

Indicates whether some other object is "equal to" this one.

static Power
fromWatts(value: Double)

Creates a Power object with the specified value in Watts.

Double

Returns power in watts

Int

Returns a hash code value for the object.

String

Public methods

compareTo

Added in API level 34
fun compareTo(other: Power): Int

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters
o the object to be compared.
other Power: the object to be compared. This value cannot be null.
Return
Int a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Exceptions
java.lang.NullPointerException if the specified object is null
java.lang.ClassCastException if the specified object's type prevents it from being compared to this object.

equals

Added in API level 34
fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one.

Parameters
obj the reference object with which to compare.
object the reference object with which to compare.
Return
Boolean true if this object is the same as the object argument; false otherwise.

fromWatts

Added in API level 34
static fun fromWatts(value: Double): Power

Creates a Power object with the specified value in Watts.

Parameters
value Double: value to be set as watts.
Return
Power This value cannot be null.

getInWatts

Added in API level 34
fun getInWatts(): Double

Returns power in watts

hashCode

Added in API level 34
fun hashCode(): Int

Returns a hash code value for the object.

Return
Int a hash code value for this object.

toString

Added in API level 34
fun toString(): String
Return
String a string representation of the object.