public void createJavaSourceFile() {
        String famNumber = Character.toString(_architecture.charAt(_architecture.length()-1));
        String namePrefix = "V" + famNumber;
        String fileName = namePrefix + "PartLibrary.java";
            
        try {
            BufferedWriter buf = new BufferedWriter(new FileWriter(fileName));        
            createFileHeader(buf);            
            buf.write("package edu.byu.ece.bitstreamTools.configurationSpecification;\n\n");
            buf.write("import java.util.ArrayList;\nimport java.util.Arrays;\n\n");
    
            buf.write("public class " + namePrefix + "PartLibrary extends PartLibrary {\n\n");
            
            // constructor
            buf.write("\tpublic " + namePrefix + "PartLibrary() {\n");
            buf.write("\t\tsuper();\n");
            buf.write("\t}\n\n");
    
            // add parts method
            buf.write("\tprotected void addParts() {\n");
            for (String currPartName : _partNames) {
                buf.write("\t\taddPart(new " + currPartName.toUpperCase() + "());\n");
            }
            buf.write("\t}\n\n");
            
            // define parts
            int i = 0;
            for (String currPartName : _partNames) {
    
                buf.write("\tclass " + currPartName.toUpperCase() +" extends V"+famNumber+"ConfigurationSpecification {\n\n" );
                buf.write("\t\tpublic " +currPartName.toUpperCase() + "() {\n");
                buf.write("\t\t\tsuper();\n");
                buf.write("\t\t\t_deviceName = \""+currPartName.toUpperCase()+"\";\n");
                buf.write("\t\t\t_deviceIDCode = \""+ _deviceIDCodes.get(i)+"\";\n");
    
                // Write out Packages
                buf.write("\t\t\t_validPackages = new String[] {");
                for(String pkg : _validPackages.get(i)){
                    buf.write("\""+ pkg + "\", ");
                }
                buf.write("};\n");
    
                // Write out Speed Grades
                buf.write("\t\t\t_validSpeedGrades = new String[] {");
                for(String speeds : _validSpeedGrades.get(i)){
                    buf.write("\""+ speeds + "\", ");
                }
                buf.write("};\n");
    
                buf.write("\t\t\t_topRows = " + _numTopRows.get(i) + ";\n");
                buf.write("\t\t\t_bottomRows = " + _numBottomRows.get(i) + ";\n");
                
                buf.write("\t\t\t_blockTypeLayouts = new ArrayList<BlockTypeInstance>(Arrays.asList(new BlockTypeInstance[] {\n");
                buf.write("\t\t\t\t\tnew BlockTypeInstance(LOGIC_BLOCK_TYPE, new BlockSubType[] {\n\t\t\t\t\t\t");
                for (BlockSubType blk : _logicLayouts.get(i)) {
                    buf.write(blk + ", ");
                }
                buf.write("\n\t\t\t\t\t}),\n");
                buf.write("\t\t\t\t\tnew BlockTypeInstance(BRAM_INTERCONNECT_BLOCK_TYPE, new BlockSubType[] {\n\t\t\t\t\t\t");
                for (BlockSubType blk : _bramInterconnectLayouts.get(i)){
                    buf.write(blk + ", ");
                }
                buf.write("\n\t\t\t\t\t}),\n");
                buf.write("\t\t\t\t\tnew BlockTypeInstance(BRAM_BLOCK_TYPE, new BlockSubType[] {\n\t\t\t\t\t\t");
                for (BlockSubType blk : _bramContentLayouts.get(i)){
                    buf.write(blk + ", ");
                }
                buf.write("\n\t\t\t\t\t}),\n");
                buf.write("\t\t\t}));\n");
                
                buf.write("\t\t\t_overallColumnLayout = new ArrayList<BlockSubType>(Arrays.asList(new BlockSubType[] {");
                for (BlockSubType blk : _overallColumnLayouts.get(i)) {
                    buf.write(blk + ", ");
                }
                buf.write("}));\n");
                                
                buf.write("\t\t}\n");
                buf.write("\t}\n\n");
                i++;
            }
            
            buf.write("}\n");
            buf.flush();
    
        } catch (IOException e) {
            e.printStackTrace();
            System.err.println("Error writing file: " + fileName);
            System.exit(1);
        }
    
    }