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

io.deepsense.neptune.clientlibrary.models.impl.charts.ChartImpl 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.Chart;
import io.deepsense.neptune.clientlibrary.models.ChartSeriesCollection;

import java.util.Objects;
import java.util.UUID;

public class ChartImpl implements Chart {

    private final UUID id;

    private final String name;

    private final ChartSeriesCollection series;

    public ChartImpl(String name, ChartSeriesCollection series) {
        this.id = UUID.randomUUID();
        this.name = Preconditions.checkNotNull(name);
        this.series = Preconditions.checkNotNull(series);
    }

    @Override
    public UUID getId() {
        return id;
    }

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

    @Override
    public ChartSeriesCollection getSeries() {
        return series;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ChartImpl chart = (ChartImpl) o;
        return Objects.equals(id, chart.id)
                && Objects.equals(name, chart.name)
                && Objects.equals(series, chart.series);
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy