import java.util.Table;

public class TableTimer extends CollectionTimer {
    private  Table<Integer> table;

    public TableTimer(Table<Integer> table) {
        this.table = table;
    }

    /* Constructor that creates a TableTimer instance for the given table.
     * Parameters:
     * table - instance of the data structure that is to be benchmarked
     * */

    public TableTimer(Table<Integer> table, long elemGenSeed) {
        super(elemGenSeed);
        this.table = table;
    }

    /* Constructor that creates a TableTimer instance for the given table that
     * will populate it with data generated using the specified seed.
     * Parameters:
     *   table - instance of the table that is to be benchmarked
     *   elemGenSeed - seed for the generator of random elements.*/

    public TableTimer(Table<Integer> table, Long elemGenSeed) {
        super((long)elemGenSeed);
        this.table = table;
    }

    public void addElement(Integer elem) {
        table.add(elem.toString(), elem);
    }

    public void removeElement() {
        if (!isEmpty())
            table.remove(0);
    }

    public int getSize() {
        return table.size();
    }

    public boolean isEmpty() {
        return table.isEmpty();
    }
}
