Package Hack.ComputerParts

Examples of Hack.ComputerParts.TextFileGUI


    private void resetComparisonFile() throws HackTranslatorException {
        try {
            comparisonReader = new BufferedReader(new FileReader(comparisonFileName));

            if (getGui() != null) {
                TextFileGUI comp = ((HackAssemblerGUI) getGui()).getComparison();
                comp.reset();
                comp.setContents(comparisonFileName);

                comparisonProgram = new short[comp.getNumberOfLines()];
                for (int i = 0; i < comp.getNumberOfLines(); i++) {
                    if (comp.getLineAt(i).length() != Definitions.BITS_PER_WORD) {
                        throw new HackTranslatorException("Error in file " + comparisonFileName + ": Line " + i + " does not contain exactly " + Definitions.BITS_PER_WORD + " characters");
                    }
                    try {
                        comparisonProgram[i] = (short) Conversions.binaryToInt(comp.getLineAt(i));
                    } catch (NumberFormatException nfe) {
                        throw new HackTranslatorException("Error in file " + comparisonFileName + ": Line " + i + " does not contain only 1/0 characters");
                    }
                }
            }
View Full Code Here

TOP

Related Classes of Hack.ComputerParts.TextFileGUI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.