%% genereate_file
% generate the cvc file to be inputted into cvc, calls the generate grid
% function. generates all the variable declarations.
%
% inputs:
%   object:CVC_checker - current object.
%
% outputs;
%   filename:string - the filename of the generated file
%   queries:cell arrray - a list of queries generated by the grids.
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification

function [ filename, queries ] = generate_file( object )

table = TableBlock.convert_table_to_java_table(object.data);

% output the input variables
inputs = table.getVariables.getInputVariablesList();
code = char(object.generator.GenerateVariablesDeclaration(inputs));

%generate type check conditions
[new_code,queries] = object.generate_cvc_tccs(table);
code = [code new_code];

filename = [char(table.getName()) '.cvc'];
fileid = fopen(filename,'w');
fprintf(fileid,'%s',char(code));
fclose(fileid);


end
