All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.azure.documentdb.internal.query.aggregation.MaxAggregator Maven / Gradle / Ivy

package com.microsoft.azure.documentdb.internal.query.aggregation;

import com.microsoft.azure.documentdb.Undefined;
import com.microsoft.azure.documentdb.internal.query.ItemComparator;

public class MaxAggregator implements Aggregator {
    private Object value;

    public MaxAggregator() {
        this.value = Undefined.Value();
    }

    @Override
    public void aggregate(Object item) {
        if (Undefined.Value().equals(this.value)) {
            this.value = item;
        } else if (ItemComparator.getInstance().compare(item, this.value) > 0) {
            this.value = item;
        }

    }

    @Override
    public Object getResult() {
        return this.value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy