public FileDefinition buildFileDefinition ( Collection < Instance > rootInstances , File targetFile , boolean addComment , boolean saveRuntimeInformation ) { FileDefinition result = new FileDefinition ( targetFile ) ; result . setFileType ( FileDefinition . INSTANCE ) ; if ( addComment ) { String s = "# File created from an in-memory model,\n# without a binding to existing files." ; BlockComment initialComment = new BlockComment ( result , s ) ; result . getBlocks ( ) . add ( initialComment ) ; result . getBlocks ( ) . add ( new BlockBlank ( result , "\n" ) ) ; } for ( Instance rootInstance : rootInstances ) result . getBlocks ( ) . addAll ( buildInstanceOf ( result , rootInstance , addComment , saveRuntimeInformation ) ) ; return result ; }
Builds a file definition from a collection of instances .