\subsection{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. 

\subsubsection{Interface}

\begin{tabular}[]{| p{5.5cm} | l | p{7.5cm} |}
\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, MissingFunctionException & ComputationalModel & Parses all the files and constructs a ComputationalModel instance with Variables linked to their Entities, Entities to each other and Equations and Distributions set for variables.\\
\hline	
\end{tabular}
\vspace{.5cm}

\subsubsection{Internal operations}

\begin{tabular}[]{| p{5.5cm} | l | p{7.5cm} |}
\hline
\textbf{Operation}&\textbf{Return type}&\textbf{Description} \\
\hline
readInitialValues(File file, HashMap <String, Variable> variableMapper, File missingFile) & void & Reads the initial values for the variables from \textit{file} and assigns them to the correct Variables. Incorrect file format will cause a \textit{SyntaxException} to be thrown, missing initial values will cause an error message and stop the program execution. \\
\hline
readData(File file, Variable datavar, File missingFile) & void & Reads the data for a single variable and sets the fields: datavar.missingValues, datavar.belongsTo.size. Reads out the missing values and writes the datafile\_missing.txt and creates \textit{missingFile} to be used by later methods (readInitialValues). Invalid symbols or uneven line lengths in the data will generate a \textit{SyntaxException}.\\
\hline
readProposal(File file, HashMap <String, Variable> variableMapper) & void & Reads proposal distributions from \textit{file} and assigns them for the correct Variables. Missing distributions will cause an error message and stop execution. \\
\hline
readUpdate(File file, String updateStrategy, int iterations) & void & Reads the file, parses the update strategy into \textit{updateStrategy} and iterations into \textit{iterations}. If the update strategy is random, parses each iterations value into the correct Variable's updates field.\\
\hline
readSimulation(File file, int burnIn, int thinning) & void & Reads values from the file into burnIn and thinning. \\
\hline
readOutput(File file, HashMap <String, Variable> variableMapper) & void & Reads the variables to be output from the file sets variable.setPrinted() for those variables. \\
\hline
\end{tabular}
\vspace{.5cm}


\Subsubsection{Fields filled in by the parser}



\subsubsubsection{ComputationalModel}

\begin{tabular}[]{| p{5.5cm} | l |}
\hline
\textbf{Field name} & \textbf{type} \\
\hline
iterations & int \\
\hline
burnIn & int \\
\hline
thinning & int \\
\hline
updateStrategy & String \\
\hline
variableList & LinkedList <Variable> \\
\hline
entityList & LinkedList <Entity> \\
\hline
variableMapper & HashMap <String, Variable> \\
\hline
entityMapper & HashMap <String, Entity> \\
\hline
\end{tabular}
\vspace{.5cm}

\subsubsubsection{Entity}

\begin{tabular}[]{| p{5.5cm} | l |}
\hline
\textbf{Field name}&\textbf{Type}\\
\hline
data & String \\
\hline
isMatrix & boolean \\
\hline
name & String \\
\hline
size & int \\
\hline
spatialMatrix & String\\
\hline
variableList & LinkedList <Variable> \\
\hline
xCoordinateString & String \\
\hline
yCoordinateString & String \\
\hline
\end{tabular}
\vspace{.5cm}

\subsubsubsection{Variable}

\begin{tabular}[]{| p{5.5cm} | l |}
\hline
\textbf{Field name}&\textbf{Type}\\
\hline
name & String \\
\hline
belongsTo & Entity \\
\hline
data & boolean \\
\hline
column & int \\
\hline
functional & boolean \\
\hline
equation & Equation \\
\hline
distribution & Distribution \\
\hline
proposal & Distribution \\
\hline
missingValues & int \\
\hline
algorithm & String \\
\hline
proposalStrategy & String \\
\hline
typeInteger & boolean \\
\hline
updates & int \\
\hline
\end{tabular}
\vspace{.5cm}

