// This file contains a stub for a halting detector class. Since we // haven't yet fleshed out the details of what a halting detector // might look like, this one just tells its user that it is running // and (for now) gets the answer from him or her. import javax.swing.JOptionPane; class HaltingDetector { // The "runsForever" method, which for now just gets its answer // from the user: public boolean runsForever( String method ) { String answer = JOptionPane.showInputDialog( "Does '" + method + "' run forever? (Y/N)" ); if ( answer.equalsIgnoreCase( "y" ) ) { return true; } else if ( answer.equalsIgnoreCase( "n" ) ) { return false; } else { System.out.println( "Invalid input '" + answer + "' -- I'll assume you meant 'n'." ); return false; } } }