# ComparatorNode

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/ast/operators/ComparatorNode.java+class:androidx.appsearch.ast.operators.ComparatorNode) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
@ExperimentalAppSearchApi
class ComparatorNode : Node
```

<br />

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/appsearch/ast/Node` that represents a numeric search expression between a property and a numeric value.

All numeric search expressions are represented by this `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/Node` by passing in a `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode.Comparator` that represent one of the comparator operators available in the query language, a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/PropertyPath` representing the property, and a numeric value to compare the property against.

This node represents comparators as defined in the [Google AIP EBNF Filtering Definition](https://google.aip.dev/assets/misc/ebnf-filtering.txt).

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#EQUALS() = 0` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#GREATER_EQUALS() = 4` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#GREATER_THAN() = 3` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#LESS_EQUALS() = 2` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#LESS_THAN() = 1` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#ComparatorNode(int,androidx.appsearch.app.PropertyPath,long)(comparator: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, propertyPath: https://developer.android.com/reference/kotlin/androidx/appsearch/app/PropertyPath, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Construct a `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/Node` representing a numeric search expression between a property and a numeric value. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#equals(java.lang.Object)(o: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#getComparator()()` Get the `@Comparator` used in the comparison. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/PropertyPath` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#getPropertyPath()()` Get the `PropertyPath` being compared. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#getValue()()` Get the numeric value being compared. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#setComparator(int)(comparator: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Set the `@Comparator` being used to compare the `PropertyPath` and value. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#setPropertyPath(androidx.appsearch.app.PropertyPath)(propertyPath: https://developer.android.com/reference/kotlin/androidx/appsearch/app/PropertyPath)` Set the `PropertyPath` being compared, i.e. the left side of the comparison. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#setValue(long)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Set the numeric value being compared, i.e. the right side of the comparison. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode#toString()()` Get the query string representation of `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode`. |

| ### Inherited functions |
|---|
| From [androidx.appsearch.ast.Node](https://developer.android.com/reference/kotlin/androidx/appsearch/ast/Node) |---|---| | `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/ast/Node!>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/Node#getChildren()()` Get a list of the node's child `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/Node`s. | |

## Constants

### EQUALS

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
const val EQUALS = 0: Int
```

### GREATER_EQUALS

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
const val GREATER_EQUALS = 4: Int
```

### GREATER_THAN

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
const val GREATER_THAN = 3: Int
```

### LESS_EQUALS

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
const val LESS_EQUALS = 2: Int
```

### LESS_THAN

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
const val LESS_THAN = 1: Int
```

## Public constructors

### ComparatorNode

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
ComparatorNode(comparator: Int, propertyPath: PropertyPath, value: Long)
```

Construct a `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/Node` representing a numeric search expression between a property and a numeric value.

| Parameters |
|---|---|
| `comparator: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | An `IntDef` representing what comparison is being made. |
| `propertyPath: https://developer.android.com/reference/kotlin/androidx/appsearch/app/PropertyPath` | A `https://developer.android.com/reference/kotlin/androidx/appsearch/app/PropertyPath` that is property being compared i.e. the left hand side of the comparison. |
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The numeric value being compared i.e. the right hand side of the comparison. |

## Public functions

### equals

```
fun equals(o: Any!): Boolean
```

### getComparator

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
fun getComparator(): Int
```

Get the `@Comparator` used in the comparison.

### getPropertyPath

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
fun getPropertyPath(): PropertyPath
```

Get the `PropertyPath` being compared.

I.e. left hand side of the comparison represented by this node.

### getValue

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
fun getValue(): Long
```

Get the numeric value being compared.

I.e. the right hand side of the comparison represented by this node.

### hashCode

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

### setComparator

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
fun setComparator(comparator: Int): Unit
```

Set the `@Comparator` being used to compare the `PropertyPath` and value.

### setPropertyPath

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
fun setPropertyPath(propertyPath: PropertyPath): Unit
```

Set the `PropertyPath` being compared, i.e. the left side of the comparison.

### setValue

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
fun setValue(value: Long): Unit
```

Set the numeric value being compared, i.e. the right side of the comparison.

### toString

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

Get the query string representation of `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode`.

The string representation is the string representation of the property path joined from the left to the value being compared with the string representation of the `https://developer.android.com/reference/kotlin/androidx/appsearch/ast/operators/ComparatorNode.Comparator`.