public ExitStatus run(List<File> filenames)
	{
		String line = "";
		String lastline = "";
		boolean carryOn = true;
		long timestamp = System.currentTimeMillis();

		while (carryOn)
		{
			for (File file : filenames)
			{
				if (file.lastModified() > timestamp)
				{
					println("File " + file + " has changed");
				}
			}

			try
			{
				print(prompt);
				line = getStdin().readLine();

				if (line == null)
				{
					carryOn = doQuit("");
					continue;
				}

				if (line.equals("."))
				{
					line = lastline;
					println(prompt + line);
				}

				if (line.equals("") || line.startsWith("--"))
				{
					continue;
				}

				lastline = line;

				if (line.equals("quit") || line.equals("q"))
				{
					carryOn = doQuit(line);
				} else if (line.startsWith("reload"))
				{
					carryOn = doReLoad(line);

					if (!carryOn)
					{
						return ExitStatus.RELOAD;
					}
				} else if (line.startsWith("load"))
				{
					carryOn = doLoad(line, filenames);

					if (!carryOn)
					{
						return ExitStatus.RELOAD;
					}
				} else if (line.startsWith("save"))
				{
					carryOn = doSave(line);
				} else if (line.equals("files"))
				{
					carryOn = doFiles();
				} else if (line.startsWith("set"))
				{
					carryOn = doSet(line);
				} else if (line.equals("stop"))
				{
					carryOn = doStop(line);
				} else if (line.equals("help") || line.equals("?"))
				{
					doHelp(line);
				} else if (line.startsWith("assert"))
				{
					carryOn = doAssert(line);
				} else if (line.equals("continue") || line.equals("c"))
				{
					carryOn = doContinue(line);
				} else if (line.equals("stack"))
				{
					carryOn = doStack(line);
				} else if (line.equals("up"))
				{
					carryOn = doUp(line);
				} else if (line.equals("down"))
				{
					carryOn = doDown(line);
				} else if (line.equals("step") || line.equals("s"))
				{
					carryOn = doStep(line);
				} else if (line.equals("next") || line.equals("n"))
				{
					carryOn = doNext(line);
				} else if (line.equals("out") || line.equals("o"))
				{
					carryOn = doOut(line);
				} else if (line.startsWith("trace"))
				{
					carryOn = doTrace(line);
				} else if (line.startsWith("break"))
				{
					carryOn = doBreak(line);
				} else if (line.equals("list"))
				{
					carryOn = doList(line);
				} else if (line.equals("threads"))
				{
					carryOn = doThreads(line);
				} else if (line.equals("source"))
				{
					carryOn = doSource(line);
				} else if (line.startsWith("coverage"))
				{
					carryOn = doCoverage(line);
				} else if (line.startsWith("latexdoc"))
				{
					carryOn = doLatex(line, true);
				} else if (line.startsWith("latex"))
				{
					carryOn = doLatex(line, false);
				} else if (line.startsWith("word"))
				{
					carryOn = doWord(line);
				} else if (line.startsWith("remove"))
				{
					carryOn = doRemove(line);
				} else if (line.equals("init"))
				{
					carryOn = doInit(line);
				} else if (line.equals("env"))
				{
					carryOn = doEnv(line);
				} else if (line.equals("state"))
				{
					carryOn = doState(line);
				} else if (line.startsWith("default"))
				{
					carryOn = doDefault(line);
				} else if (line.equals("classes"))
				{
					carryOn = doClasses(line);
				} else if (line.startsWith("create"))
				{
					carryOn = doCreate(line);
				} else if (line.equals("modules"))
				{
					carryOn = doModules(line);
				} else if (line.startsWith("pog"))
				{
					carryOn = doPog(line);
				} else if (line.startsWith("log"))
				{
					carryOn = doLog(line);
				} else if (line.startsWith("print ") || line.startsWith("p "))
				{
					carryOn = doEvaluate(line);
				} else if (line.startsWith("runtrace "))
				{
					carryOn = doRuntrace(line, false);
				} else if (line.startsWith("debugtrace "))
				{
					carryOn = doRuntrace(line, true);
				} else if (line.startsWith("filter"))
				{
					carryOn = doFilter(line);
				} else
				{
					println("Bad command. Try 'help'");
				}
			} catch (Exception e)
			{
				carryOn = doException(e);
			}

			if (singlePass)
			{
				break;
			}
		}

		return ExitStatus.EXIT_OK;
	}
public ExitStatus run ( List < File > filenames ) { String line = "" ; String lastline = "" ; boolean carryOn = true ; long timestamp = System . currentTimeMillis ( ) ; while ( carryOn ) { for ( File file : filenames ) { if ( file . lastModified ( ) > timestamp ) { println ( "File " + file + " has changed" ) ; } } try { print ( prompt ) ; line = getStdin ( ) . readLine ( ) ; if ( line == null ) { carryOn = doQuit ( "" ) ; continue ; } if ( line . equals ( "." ) ) { line = lastline ; println ( prompt + line ) ; } if ( line . equals ( "" ) || line . startsWith ( "--" ) ) { continue ; } lastline = line ; if ( line . equals ( "quit" ) || line . equals ( "q" ) ) { carryOn = doQuit ( line ) ; } else if ( line . startsWith ( "reload" ) ) { carryOn = doReLoad ( line ) ; if ( ! carryOn ) { return ExitStatus . RELOAD ; } } else if ( line . startsWith ( "load" ) ) { carryOn = doLoad ( line , filenames ) ; if ( ! carryOn ) { return ExitStatus . RELOAD ; } } else if ( line . startsWith ( "save" ) ) { carryOn = doSave ( line ) ; } else if ( line . equals ( "files" ) ) { carryOn = doFiles ( ) ; } else if ( line . startsWith ( "set" ) ) { carryOn = doSet ( line ) ; } else if ( line . equals ( "stop" ) ) { carryOn = doStop ( line ) ; } else if ( line . equals ( "help" ) || line . equals ( "?" ) ) { doHelp ( line ) ; } else if ( line . startsWith ( "assert" ) ) { carryOn = doAssert ( line ) ; } else if ( line . equals ( "continue" ) || line . equals ( "c" ) ) { carryOn = doContinue ( line ) ; } else if ( line . equals ( "stack" ) ) { carryOn = doStack ( line ) ; } else if ( line . equals ( "up" ) ) { carryOn = doUp ( line ) ; } else if ( line . equals ( "down" ) ) { carryOn = doDown ( line ) ; } else if ( line . equals ( "step" ) || line . equals ( "s" ) ) { carryOn = doStep ( line ) ; } else if ( line . equals ( "next" ) || line . equals ( "n" ) ) { carryOn = doNext ( line ) ; } else if ( line . equals ( "out" ) || line . equals ( "o" ) ) { carryOn = doOut ( line ) ; } else if ( line . startsWith ( "trace" ) ) { carryOn = doTrace ( line ) ; } else if ( line . startsWith ( "break" ) ) { carryOn = doBreak ( line ) ; } else if ( line . equals ( "list" ) ) { carryOn = doList ( line ) ; } else if ( line . equals ( "threads" ) ) { carryOn = doThreads ( line ) ; } else if ( line . equals ( "source" ) ) { carryOn = doSource ( line ) ; } else if ( line . startsWith ( "coverage" ) ) { carryOn = doCoverage ( line ) ; } else if ( line . startsWith ( "latexdoc" ) ) { carryOn = doLatex ( line , true ) ; } else if ( line . startsWith ( "latex" ) ) { carryOn = doLatex ( line , false ) ; } else if ( line . startsWith ( "word" ) ) { carryOn = doWord ( line ) ; } else if ( line . startsWith ( "remove" ) ) { carryOn = doRemove ( line ) ; } else if ( line . equals ( "init" ) ) { carryOn = doInit ( line ) ; } else if ( line . equals ( "env" ) ) { carryOn = doEnv ( line ) ; } else if ( line . equals ( "state" ) ) { carryOn = doState ( line ) ; } else if ( line . startsWith ( "default" ) ) { carryOn = doDefault ( line ) ; } else if ( line . equals ( "classes" ) ) { carryOn = doClasses ( line ) ; } else if ( line . startsWith ( "create" ) ) { carryOn = doCreate ( line ) ; } else if ( line . equals ( "modules" ) ) { carryOn = doModules ( line ) ; } else if ( line . startsWith ( "pog" ) ) { carryOn = doPog ( line ) ; } else if ( line . startsWith ( "log" ) ) { carryOn = doLog ( line ) ; } else if ( line . startsWith ( "print " ) || line . startsWith ( "p " ) ) { carryOn = doEvaluate ( line ) ; } else if ( line . startsWith ( "runtrace " ) ) { carryOn = doRuntrace ( line , false ) ; } else if ( line . startsWith ( "debugtrace " ) ) { carryOn = doRuntrace ( line , true ) ; } else if ( line . startsWith ( "filter" ) ) { carryOn = doFilter ( line ) ; } else { println ( "Bad command. Try 'help'" ) ; } } catch ( Exception e ) { carryOn = doException ( e ) ; } if ( singlePass ) { break ; } } return ExitStatus . EXIT_OK ; }
Read and execute commands from standard input. The prompt passed to the constructor is used to prompt the user,
and the interpreter passed is used to execute commands. Each command is directed through the corresponding "do"
method in this class, the defaults for which print that the command is not available from the current context.
Subclasses of CommandReader implement the "do" methods that apply to them. The only methods implemented at this
level are the ones which are globally applicable.
<p>
The "do" methods return a boolean which indicates whether the command reader should loop and read/dispatch more
commands, or exit.

@param filenames
the files
@return