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

io.deepsense.neptune.clientlibrary.models.impl.charts.ChartParamsImpl Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
/**
 * Copyright (c) 2016, CodiLime Inc.
 */

package io.deepsense.neptune.clientlibrary.models.impl.charts;

import com.google.common.base.Preconditions;
import io.deepsense.neptune.clientlibrary.models.ChartParams;
import io.deepsense.neptune.clientlibrary.models.ChartSeries;

import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

public class ChartParamsImpl implements ChartParams {

    private final String name;

    private final Iterable seriesCollection;

    public ChartParamsImpl(String name, Iterable seriesCollection) {
        this.name = Preconditions.checkNotNull(name);
        this.seriesCollection = StreamSupport
                .stream(Preconditions.checkNotNull(seriesCollection).spliterator(), false)
                .collect(Collectors.toList());
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public Iterable getSeries() {
        return seriesCollection;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ChartParamsImpl chartParams = (ChartParamsImpl) o;
        return Objects.equals(name, chartParams.name)
                && Objects.equals(seriesCollection, chartParams.seriesCollection);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, seriesCollection);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy