-
-
Save anonymous/2f22caf95d36cef9e33a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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