/** Memento playground * Alex Lo, Brian Kiefer * CS490: design patterns **/ import java.io.*; import java.util.*; public class memento { public static String backCommand = "!back"; public static String forwardCommand = "!forward"; public static String saveCommand = "!save"; public static String loadCommand = "!load"; public static String quitCommand = "!quit"; public static void main(String[] args) { BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); String currentAddress = "http://www.alexlo.net/patterns/"; String lineIn = "duh"; // ... while( true ) { System.out.println('\n' + "currently at: " + currentAddress + ", new address? "); try { lineIn = in.readLine(); } catch(IOException e) { System.exit(1); // whatever } if( lineIn.equals(quitCommand) ) { break; } // ... currentAddress = lineIn; } } }