Subversion Repositories hibernate-spatial

Rev

Rev 242 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * $Id: TestData.java 244 2010-10-01 20:55:56Z maesenka $
 *
 * This file is part of Hibernate Spatial, an extension to the
 * hibernate ORM solution for geographic data.
 *
 * Copyright © 2007-2010 Geovise BVBA
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * For more information, visit: http://www.hibernatespatial.org/
 */

package org.hibernatespatial.test;

import java.io.InputStream;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

/**
 * A <code>TestData</code> instance is a list object
 * that contains all the <code>TestDataElement</code>s that
 * are used in a unit testsuite-suite suite.
 *
 * @author Karel Maesen, Geovise BVBA
 */
public class TestData implements List<TestDataElement> {

    private List<TestDataElement> testDataElements;
    private InputStream in;

    protected TestData() {
    }

    ;

    public int size() {
        return testDataElements.size();
    }

    public boolean isEmpty() {
        return testDataElements.isEmpty();
    }

    public boolean contains(Object o) {
        return testDataElements.contains(o);
    }

    public Iterator<TestDataElement> iterator() {
        return testDataElements.iterator();
    }

    public Object[] toArray() {
        return testDataElements.toArray();
    }

    public <T> T[] toArray(T[] a) {
        return testDataElements.toArray(a);
    }

    public boolean add(TestDataElement testDataElement) {
        return testDataElements.add(testDataElement);
    }

    public boolean remove(Object o) {
        return testDataElements.remove(o);
    }

    public boolean containsAll(Collection<?> c) {
        return testDataElements.containsAll(c);
    }

    public boolean addAll(Collection<? extends TestDataElement> c) {
        return testDataElements.addAll(c);
    }

    public boolean addAll(int index, Collection<? extends TestDataElement> c) {
        return testDataElements.addAll(index, c);
    }

    public boolean removeAll(Collection<?> c) {
        return testDataElements.removeAll(c);
    }

    public boolean retainAll(Collection<?> c) {
        return testDataElements.retainAll(c);
    }

    public void clear() {
        testDataElements.clear();
    }

    public boolean equals(Object o) {
        return testDataElements.equals(o);
    }

    public int hashCode() {
        return testDataElements.hashCode();
    }

    public TestDataElement get(int index) {
        return testDataElements.get(index);
    }

    public TestDataElement set(int index, TestDataElement element) {
        return testDataElements.set(index, element);
    }

    public void add(int index, TestDataElement element) {
        testDataElements.add(index, element);
    }

    public TestDataElement remove(int index) {
        return testDataElements.remove(index);
    }

    public int indexOf(Object o) {
        return testDataElements.indexOf(o);
    }

    public int lastIndexOf(Object o) {
        return testDataElements.lastIndexOf(o);
    }

    public ListIterator<TestDataElement> listIterator() {
        return testDataElements.listIterator();
    }

    public ListIterator<TestDataElement> listIterator(int index) {
        return testDataElements.listIterator(index);
    }

    public List<TestDataElement> subList(int fromIndex, int toIndex) {
        return testDataElements.subList(fromIndex, toIndex);
    }

    public static TestData fromFile(String fileName) {
        TestDataReader reader = new TestDataReader();
        return fromFile(fileName, reader);
    }

    public static TestData fromFile(String fileName, TestDataReader reader) {
        List<TestDataElement> elements = reader.read(fileName);
        TestData testData = new TestData();
        testData.testDataElements = elements;
        return testData;
    }

}