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

io.deepsense.neptune.clientlibrary.models.impl.charts.ChartSeriesCollectionImpl 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 io.deepsense.neptune.clientlibrary.models.Channel;
import io.deepsense.neptune.clientlibrary.models.ChartSeries;
import io.deepsense.neptune.clientlibrary.models.ChartSeriesCollection;
import io.deepsense.neptune.clientlibrary.models.ChartSeriesType;

import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class ChartSeriesCollectionImpl extends AbstractList implements ChartSeriesCollection {

    private final List chartSeriesCollection;

    public ChartSeriesCollectionImpl() {
        this.chartSeriesCollection = new ArrayList<>();
    }

    @Override
    public ChartSeries get(int index) {
        return chartSeriesCollection.get(index);
    }

    @Override
    public int size() {
        return chartSeriesCollection.size();
    }

    @Override
    public ChartSeries set(int index, ChartSeries element) {
        return chartSeriesCollection.set(index, element);
    }

    @Override
    public boolean add(ChartSeries chartSeries) {
        return chartSeriesCollection.add(chartSeries);
    }

    @Override
    public boolean add(String name, Channel channel, ChartSeriesType type) {
        return chartSeriesCollection.add(new ChartSeriesImpl(name, channel, type));
    }

    @Override
    public ChartSeries remove(int index) {
        return chartSeriesCollection.remove(index);
    }

    @Override
    public boolean add(Channel channel) {
        return chartSeriesCollection.add(new ChartSeriesImpl(channel.getName(), channel, ChartSeriesType.LINE));
    }

    @Override
    public boolean add(String name, Channel channel) {
        return chartSeriesCollection.add(new ChartSeriesImpl(name, channel, ChartSeriesType.LINE));
    }

    @Override
    public boolean add(Channel channel, ChartSeriesType type) {
        return chartSeriesCollection.add(new ChartSeriesImpl(channel.getName(), channel, type));
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ChartSeriesCollectionImpl that = (ChartSeriesCollectionImpl) o;
        return Objects.equals(chartSeriesCollection, that.chartSeriesCollection);
    }

    @Override
    public int hashCode() {
        return Objects.hash(chartSeriesCollection);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy