umontreal.iro.lecuyer.util.io.DataReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ssj Show documentation
Show all versions of ssj Show documentation
SSJ is a Java library for stochastic simulation, developed under the direction of Pierre L'Ecuyer,
in the Département d'Informatique et de Recherche Opérationnelle (DIRO), at the Université de Montréal.
It provides facilities for generating uniform and nonuniform random variates, computing different
measures related to probability distributions, performing goodness-of-fit tests, applying quasi-Monte
Carlo methods, collecting (elementary) statistics, and programming discrete-event simulations with both
events and processes.
The newest version!
/*
* Class: DataReader
* Description: Data reader interface
* Environment: Java
* Software: SSJ
* Copyright (C) 2001 Pierre L'Ecuyer and Université de Montréal
* Organization: DIRO, Université de Montréal
* @author David Munger
* @since August 2009
* SSJ is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License (GPL) as published by the
* Free Software Foundation, either version 3 of the License, or
* any later version.
* SSJ 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 General Public License for more details.
* A copy of the GNU General Public License is available at
GPL licence site.
*/
package umontreal.iro.lecuyer.util.io;
import java.io.IOException;
import java.util.Map;
/**
* Data reader interface.
*
*/
public interface DataReader {
/**
* Reads the first field labeled as label and returns its String value.
*
*/
public String readString (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its int value.
*
*/
public int readInt (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its float value.
*
*/
public float readFloat (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its double value.
*
*/
public double readDouble (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its value as a one-dimensional array of String's.
*
*/
public String[] readStringArray (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its value as a one-dimensional array of int's.
*
*/
public int[] readIntArray (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its value as a one-dimensional array of float's.
*
*/
public float[] readFloatArray (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its value as a one-dimensional array of double's.
*
*/
public double[] readDoubleArray (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its value as a two-dimensional array of String's.
*
*/
public String[][] readStringArray2D (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its value as a two-dimensional array of int's.
*
*/
public int[][] readIntArray2D (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its value as a two-dimensional array of float's.
*
*/
public float[][] readFloatArray2D (String label) throws IOException;
/**
* Reads the first field labeled as label and returns its value as a two-dimensional array of double's.
*
*/
public double[][] readDoubleArray2D (String label) throws IOException;
/**
* Reads all remaining fields in the file and returns a hashmap indexed
* by field labels. Anonymous fields are mapped to "_data01_"
, "_data02_"
, ...
*
*/
public Map readAllNextFields() throws IOException;
/**
* Reads all fields in the file and returns a hashmap indexed
* by field labels. Anonymous fields are mapped to "_data01_"
, "_data02_"
, ...
*
*/
public Map readAllFields() throws IOException;
/**
* Reads the next available field.
*
* @return a newly created DataField instance or null if not found
*
*/
public DataField readNextField() throws IOException;
/**
* Reads the first field labeled as label.
*
* @return a newly created DataField instance or null if not found
*
*/
public DataField readField (String label) throws IOException;
/**
* Closes the input stream.
*
*/
public void close() throws IOException;
/**
* Resets the reader to its initial state, i.e. goes back to the beginning of the data stream, if possible.
*
*/
public void reset() throws IOException;
/**
* Returns true if there remains data to be read.
*
*/
public boolean dataPending() throws IOException;
}