\newpage 

\subsection{package PIANOS.io}

This package contains the classes that read the input or write the output.

\Subsubsection{ComputationalModelParser}

The parser is the part of the generator that reads the model and simulation input files, puts the data into correct places and returns the data structure to the main generator program. 

\subsubsubsection{Operations}

\begin{tabular}[]{| p{5.5cm} | p{2.5cm} | p{7.0cm} |}
\hline
\textbf{Operation}&\textbf{Return type}&\textbf{Description} \\
\hline
readModel( String modelFileName, String initialValueFileName, String simulationFileName, String proposalFileName, String updateFileName, String toOutputFileName, DistributionFactory factory) throws IOException, SyntaxException, MissingDistributionException & Computational- Model & Parses all the files and constructs a ComputationalModel instance that represents the model files given to the Parser. Calls other methods of the Parser. Called by the Generator. \\
\hline	
readModelFile( File file, LinkedList  <Variable> variableList,
            LinkedList  <Entity> entityList, HashMap  <String, Entity> entityMapper,
            HashMap  <String, Variable> variableMapper, DistributionFactory fact)
throws IOException, SyntaxException, MissingDistributionException & void & Reads the model file and puts the information into the maps and lists provided. \\
\hline
parseVariable( File file, boolean isInteger, String toParse,
            HashMap  <String, Variable> variableMapper, DistributionFactory fact) throws
            SyntaxException, MissingDistributionException & Variable & Reads a variable definition line and returns a representation of the variable, public for testing purposes. \\
\hline
readEntity( File file, LinkedList <Entity> entityList,
            HashMap <String, Entity> entityMapper, HashMap <String, Variable> variableMapper,
            String header, Scanner reader, DistributionFactory fact)
            throws SyntaxException, MissingDistributionException
& void & Reads an entity section in the model file and saves the information into the structures provided. \\
\hline
\end{tabular}

\begin{tabular}[]{| p{5.5cm} | p{2.5cm} | p{7.5cm} |}
\hline 
readSimulation( File file)  throws SyntaxException, IOException & int[] &   Reads a simulation parameter file that gives burn-in and thinning. Returns \{burn-in, thinning\}. \\
\hline
readUpdate( File file, HashMap <String, Variable> variableMapper,
            String updateStrategy)  throws SyntaxException, IOException & Object[] & Reads the update strategy file, saves individual updates ( if any) into the variables in the maps, returns \{String updateStrategy, int iterations\} \\
\hline
 readOutput( File file, HashMap <String, Variable> variableMapper)
    throws SyntaxException, IOException
& String[]  &  Reads the parameter names to output -file and sets isPrinted-flags. \\
\hline
      readProposal( File file, HashMap  <String, Variable> variableMapper,
            DistributionFactory fact) throws SyntaxException, IOException,
            MissingDistributionException & void & Reads the proposal distributions/strategies file, sets them for specified variables.  \\
\hline
      readEntityData( LinkedList  <Entity> entityList) throws IOException,
            SyntaxException & void &  Reads through entities' data files to see if they are correct. builds the missing values matrix files. \\
\hline

      readInitialValues( File file, HashMap <String, Variable> variableMapper)
    throws IOException, SyntaxException & void &  Reads the initial values definition file and checks that the format is correct and all missing values of data are present. \\
\hline

countNeighbours(  LinkedList  <Entity> entityList) throws SyntaxException,
            FileNotFoundException
& int & Counts the maximum number of spatial neighbours in the model. \\
\hline  
\end{tabular}
\vspace{.5cm}




\newpage 

\Subsubsection{FortranWriter}

FortranWriter receives lines of Fortran source code and writes them to a file correctly indented and wrapped to 79 characters in length.

\subsubsubsection{Interface}


\begin{tabular}[]{| p{5.5cm} | p{2.5cm} | p{7.5cm} |}
\hline
\textbf{Operation}&\textbf{Return type}&\textbf{Description} \\
\hline
\textbf{FortranWriter}( String fileName) & - & Constructor, specifies which file to write\\
\hline
\textbf{write}( ArrayList  <String> lines) throws IOException & & Writes \textit{lines} to the specified file,  correctly indented and multilined if longer than 79 characters\\
\hline
\textbf{write}( String[] lines) throws IOException & & Writes \textit{lines} to the specified file,  correctly indented and multilined if longer than 79 characters\\
\hline
\end{tabular}
\vspace{.5cm}


\subsubsubsection{Indentation}

If one of the following keywords is found on a line, the next line begins an indented section.
\begin{itemize}
\item BLOCK DATA
\item DO
\item FORALL
\item FUNCTION
\item IF
\item INTERFACE
\item MODULE
\item PROGRAM
\item SELECT CASE
\item SUBROUTINE
\item TYPE typename
\item WHERE
\end{itemize}

If END is found on a line, the previous line was the last line of an indented section.

Keywords that mark both the ending of the previous indented section and the beginning of another:
\begin{itemize}
\item CASE
\item CONTAINS
\item ELSE
\item ELSEWHERE
\end{itemize}

\subsubsubsection{Line wrapping}

If a line is over 79 characters long, it's cut at the last whitespace found so that it's no longer than 77 characters. ` \&' is added to the end of the line and the rest of it is moved to the next line, indented. If the line is cut from the middle of a character string literal, `\&' is appended to the beginning of the cut, too. If the remaining line is too long as well, it receives the same treatment excluding the indenting of the following line.
