package org.opentrafficsim.kpi.sampling;
import java.util.Collection;
import org.djunits.Throw;
import org.djutils.immutablecollections.ImmutableArrayList;
import org.djutils.immutablecollections.ImmutableList;
/**
* Abstract {@code Table} implementation taking care of the columns.
*
* Copyright (c) 2020-2021 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License.
*
* @author Alexander Verbraeck
* @author Peter Knoppers
* @author Wouter Schakel
*/
public abstract class AbstractTable implements Table
{
/** Id. */
private final String id;
/** Description. */
private final String description;
/** Columns. */
private final ImmutableList> columns;
/**
* Constructor.
* @param id String; id
* @param description String; description
* @param columns Collection<Column<?>>; columns
*/
public AbstractTable(final String id, final String description, final Collection> columns)
{
Throw.whenNull(id, "Id may not be null.");
Throw.whenNull(description, "Description may not be null.");
this.id = id;
this.description = description;
this.columns = new ImmutableArrayList<>(columns);
}
/** {@inheritDoc} */
@Override
public ImmutableList> getColumns()
{
return this.columns;
}
/** {@inheritDoc} */
@Override
public String getId()
{
return this.id;
}
/** {@inheritDoc} */
@Override
public String getDescription()
{
return this.description;
}
}