sbrt.shell.io
Class RomiFile<K,V>

java.lang.Object
  extended by sbrt.shell.io.AbstractMapInputFile<K,V>
      extended by sbrt.shell.io.RomiFile<K,V>
Type Parameters:
K - the key type.
V - the value type.
All Implemented Interfaces:
java.lang.Iterable<java.util.Map<K,V>>, InputFile<java.util.Map<K,V>>, MapInputFile<K,V>, MapTextFile<K,V>, MapTextInputFile<K,V>, SbrtFile
Direct Known Subclasses:
ProcessInputFile

public class RomiFile<K,V>
extends AbstractMapInputFile<K,V>

This class is used to read row-oriented map input files. These files contain only a single map.

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
RomiFile(java.lang.String fileName, FileFormat fileFormat, MapFormat<K,V> mapFormat)
          Constructs a new row-oriented map input file from the provided arguments.
RomiFile(java.lang.String fileName, FileFormat fileFormat, java.util.Set<? extends K> requiredKeys, MapFormat<K,V> mapFormat)
          Constructs a new row-oriented map input file from the provided arguments.
RomiFile(java.lang.String fileName, MapFormat<K,V> mapFormat)
          Constructs a new row-oriented map input file from the provided arguments.
RomiFile(java.lang.String fileName, java.util.Set<? extends K> requiredKeys, MapFormat<K,V> mapFormat)
          Constructs a new row-oriented map input file from the provided arguments.
 
Method Summary
 UnmodifiableSet<K> getKeys()
          Returns the keys of the map contained in this file.
 UnmodifiableMap<K,V> getMap()
          Returns the map contained in this file.
 java.util.Iterator<java.util.Map<K,V>> iterator()
          Returns an iterator over this file.
 
Methods inherited from class sbrt.shell.io.AbstractMapInputFile
close, getCanonicalName, getMapFormat, getOriginalName, getRequiredKeys, isClosed, lineIterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RomiFile

public RomiFile(java.lang.String fileName,
                FileFormat fileFormat,
                java.util.Set<? extends K> requiredKeys,
                MapFormat<K,V> mapFormat)
Constructs a new row-oriented map input file from the provided arguments.

Parameters:
fileName - the name of the file to read.
fileFormat - the format of the file.
requiredKeys - the keys that are required to be in the file.
mapFormat - the format used to parse the file.

RomiFile

public RomiFile(java.lang.String fileName,
                FileFormat fileFormat,
                MapFormat<K,V> mapFormat)
Constructs a new row-oriented map input file from the provided arguments.

Parameters:
fileName - the name of the file to read.
fileFormat - the format of the file.
mapFormat - the format used to parse the file.

RomiFile

public RomiFile(java.lang.String fileName,
                MapFormat<K,V> mapFormat)
Constructs a new row-oriented map input file from the provided arguments.

Parameters:
fileName - the name of the file to read.
mapFormat - the format used to parse the file.

RomiFile

public RomiFile(java.lang.String fileName,
                java.util.Set<? extends K> requiredKeys,
                MapFormat<K,V> mapFormat)
Constructs a new row-oriented map input file from the provided arguments.

Parameters:
fileName - the name of the file to read.
requiredKeys - the keys that are required to be in the file.
mapFormat - the format used to parse the file.
Method Detail

getMap

public UnmodifiableMap<K,V> getMap()
Returns the map contained in this file.

Returns:
the map contained in this file.
Throws:
FormatException - if the file does not contain a required variable, contains a single variable multiple times, or contains any other formatting errors.

getKeys

public UnmodifiableSet<K> getKeys()
Returns the keys of the map contained in this file.

Returns:
the keys of the map contained in this file.
Throws:
FormatException - if the file does not contain a required variable, contains a single variable multiple times, or contains any other formatting errors.

iterator

public java.util.Iterator<java.util.Map<K,V>> iterator()
Returns an iterator over this file. This iterator returns only a single map.

Returns:
an iterator over this file.
See Also:
getMap()