ComparatorNode


@ExperimentalAppSearchApi
public class ComparatorNode implements Node


Node that represents a numeric search expression between a property and a numeric value.

All numeric search expressions are represented by this Node by passing in a Comparator that represent one of the comparator operators available in the query language, a 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.

Summary

Constants

static final int
EQUALS = 0
static final int
static final int
static final int
static final int

Public constructors

ComparatorNode(
    int comparator,
    @NonNull PropertyPath propertyPath,
    long value
)

Construct a Node representing a numeric search expression between a property and a numeric value.

Public methods

int

Get the @Comparator used in the comparison.

@NonNull PropertyPath

Get the PropertyPath being compared.

long

Get the numeric value being compared.

void
setComparator(int comparator)

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

void

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

void
setValue(long value)

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

Inherited methods

From androidx.appsearch.ast.Node
@NonNull List<Node>

Get a list of the node's child Nodes.

Constants

EQUALS

Added in 1.1.0-alpha06
public static final int EQUALS = 0

GREATER_EQUALS

Added in 1.1.0-alpha06
public static final int GREATER_EQUALS = 4

GREATER_THAN

Added in 1.1.0-alpha06
public static final int GREATER_THAN = 3

LESS_EQUALS

Added in 1.1.0-alpha06
public static final int LESS_EQUALS = 2

LESS_THAN

Added in 1.1.0-alpha06
public static final int LESS_THAN = 1

Public constructors

ComparatorNode

Added in 1.1.0-alpha06
public ComparatorNode(
    int comparator,
    @NonNull PropertyPath propertyPath,
    long value
)

Construct a Node representing a numeric search expression between a property and a numeric value.

Parameters
int comparator

An IntDef representing what comparison is being made.

@NonNull PropertyPath propertyPath

A PropertyPath that is property being compared i.e. the left hand side of the comparison.

long value

The numeric value being compared i.e. the right hand side of the comparison.

Public methods

getComparator

Added in 1.1.0-alpha06
public int getComparator()

Get the @Comparator used in the comparison.

getPropertyPath

Added in 1.1.0-alpha06
public @NonNull PropertyPath getPropertyPath()

Get the PropertyPath being compared.

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

getValue

Added in 1.1.0-alpha06
public long getValue()

Get the numeric value being compared.

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

setComparator

Added in 1.1.0-alpha06
public void setComparator(int comparator)

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

setPropertyPath

Added in 1.1.0-alpha06
public void setPropertyPath(@NonNull PropertyPath propertyPath)

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

setValue

Added in 1.1.0-alpha06
public void setValue(long value)

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