public boolean readFile(String filename)
    {
        try
        {
            BufferedReader reader = new BufferedReader(new FileReader(filename));
            String currentLine = reader.readLine();
            while(currentLine!=null)
            {
                switch(currentLine.charAt(0))
                {
                    case 99: //99 = c comment line.
                    currentLine = reader.readLine();
                    break;

                    case 112: //112 = p "p cnf" line
                    getCounts(currentLine.substring(6));
                    currentLine = reader.readLine();
                    formula = new Formula(clauseCount);  //we will have clause count by this time.
                    break;

                    default: //remaining lines
                    makeClause(currentLine);
                    currentLine = reader.readLine();
                    break;
                }
            }
            return true; //file successfully read
        }
        catch(IOException ioe)
        {
            System.out.println("Invalid filename '"+filename+"'");
            return false;
        }
    }