Skip to content

Instantly share code, notes, and snippets.

Created February 22, 2013 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2f22caf95d36cef9e33a to your computer and use it in GitHub Desktop.
Save anonymous/2f22caf95d36cef9e33a to your computer and use it in GitHub Desktop.
public NextCommand(String fileName) throws FileNotFoundException {
if (fileName.length() > 0){
scan = new Scanner(new FileReader(fileName));
while (scan.hasNextLine()) {
String holder = scan.nextLine();
if (holder.substring(0, holder.indexOf(" ")).equalsIgnoreCase("do")) {
Command newCmd = new Command(holder);
stackerz.push(newCmd);
} else {
Command newCmd = new Command(holder);
stackerz.push(newCmd);
}
}
}
while(!stackerz.isEmpty()){
reverse.push(stackerz.pop());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment