# Discriminator


```
class Discriminator : Parcelable
```

<br />

*** ** * ** ***

Represents a Matter discriminator.

A discriminator may either be a long discriminator (12 bits) or a short discriminator (4 bits). For instance, a manual pairing code specifies only a short discriminator, which provides less uniqueness than the long discriminator provided in the QR code or NFC tag data.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator#equals(java.lang.Object)(other: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?)` |
| `java-static https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator!` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator#forLongValue(int)(longDiscriminator: @https://developer.android.com/reference/androidx/annotation/IntRange.html(from = 0, to = 4095) https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Creates a new `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator` representing a full 12-bit discriminator (such as for a QR code). |
| `java-static https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator!` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator#forShortValue(int)(shortDiscriminator: @https://developer.android.com/reference/androidx/annotation/IntRange.html(from = 0, to = 4095) https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Creates a new `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator` representing an abbreviated value (such as for a manual pairing code). |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator#hashCode()()` |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator#matches(com.google.android.gms.home.matter.common.Discriminator)(other: https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator!)` Returns true if the discriminator is a match for another discriminator. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator#toString()()` |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator#writeToParcel(android.os.Parcel,int)(dest: https://developer.android.com/reference/android/os/Parcel.html!, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator#value()` |

### Inherited Constants

From [android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable.html) `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR = 1` `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE = 1`

### Inherited functions

From [android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable.html) `abstract https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/os/Parcelable.html#describeContents()()`

## Public functions

### equals

```
fun equals(other: Any?): Boolean
```

### forLongValue

```
java-static fun forLongValue(longDiscriminator: @IntRange(from = 0, to = 4095) Int): Discriminator!
```

Creates a new `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator` representing a full 12-bit discriminator (such as for a QR code).

| Parameters |
|---|---|
| `longDiscriminator: @https://developer.android.com/reference/androidx/annotation/IntRange.html(from = 0, to = 4095) https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | the 12-bit discriminator value |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the given value is negative, or greater than 12 bits |

### forShortValue

```
java-static fun forShortValue(shortDiscriminator: @IntRange(from = 0, to = 4095) Int): Discriminator!
```

Creates a new `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator` representing an abbreviated value (such as for a manual pairing code). For this discriminator, only the upper 4 bits of the 12-bit value will be used for comparison in `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator#matches(com.google.android.gms.home.matter.common.Discriminator)`.

| Parameters |
|---|---|
| `shortDiscriminator: @https://developer.android.com/reference/androidx/annotation/IntRange.html(from = 0, to = 4095) https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | the 12-bit discriminator value, of which only the upper 4-bits will be kept. For example, given 0xFAB, the value will be masked to 0xF00) |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the given value is negative, or greater than 12 bits |

### hashCode

```
fun hashCode(): Int
```

### matches

```
fun matches(other: Discriminator!): Boolean
```

Returns true if the discriminator is a match for another discriminator. If both are long discriminators, then this is a simple equality test. However, if one or the other being compared is an abbreviated discriminator, then only the upper 4 bits of the discriminator are considered in the comparison.

Note that this is different behavior from `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator#equals(java.lang.Object)` which does not incorporate the mask into the equality test.

| Parameters |
|---|---|
| `other: https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/common/Discriminator!` | the discriminator to compare to |

### toString

```
fun toString(): String!
```

### writeToParcel

```
fun writeToParcel(dest: Parcel!, flags: Int): Unit
```

## Public properties

### value

```
val value: Int
```