edu.columbia.cs.ref.model
Class Dataset<E>

java.lang.Object
  extended by edu.columbia.cs.ref.model.Dataset<E>
Type Parameters:
E - the atomic element of the dataset
All Implemented Interfaces:
java.lang.Iterable<E>

public class Dataset<E>
extends java.lang.Object
implements java.lang.Iterable<E>

The Class Dataset represents a dataset of a given type of atomic elements (e.g., Documents, Candidate Setencens).

This class implements all the methods that allow to iterate over the dataset as well as load it.

Since:
2011-09-27
Version:
0.1
Author:
Pablo Barrio, Goncalo Simoes

Constructor Summary
Dataset()
          Instantiates an empty dataset.
Dataset(java.util.Collection<E> list)
          Instantiates a new dataset from a given collection of atomic elements.
Dataset(Loader<E> l, java.io.File f, boolean isListOfFiles)
          Instantiates a new dataset by using a specific loader and a file.
 
Method Summary
 void add(E input)
          Adds the input object to the dataset
 void addAll(java.util.Collection<E> inputs)
          Adds all the objects in the in the input collection to the dataset
 void addAll(Dataset<E> inputs)
          Adds the all the elements that are in the input dataset to the current dataset
 java.util.Iterator<E> iterator()
           
 int size()
          The number of objects in the dataset
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dataset

public Dataset()
Instantiates an empty dataset.


Dataset

public Dataset(java.util.Collection<E> list)
Instantiates a new dataset from a given collection of atomic elements.

Parameters:
list - the collection of atomic elements

Dataset

public Dataset(Loader<E> l,
               java.io.File f,
               boolean isListOfFiles)
Instantiates a new dataset by using a specific loader and a file.

The final parameter indicates whether the file used to load the dataset is a text document containing the paths for the elements of the dataset or if it is a file to be loaded.

Parameters:
l - the loader that will be used to load the dataset
f - the file to be loaded
isListOfFiles - true if f is a text document containing the paths for the elements of the dataset
Method Detail

add

public void add(E input)
Adds the input object to the dataset

Parameters:
input - the new element of the dataset

addAll

public void addAll(java.util.Collection<E> inputs)
Adds all the objects in the in the input collection to the dataset

Parameters:
inputs - the new elements of the dataset

addAll

public void addAll(Dataset<E> inputs)
Adds the all the elements that are in the input dataset to the current dataset

Parameters:
inputs - the dataset to be added

iterator

public java.util.Iterator<E> iterator()
Specified by:
iterator in interface java.lang.Iterable<E>

size

public int size()
The number of objects in the dataset

Returns:
the number of objects in the dataset