/** * Defines collection for storing commands executed on the command line at one time. * @author Jan Horký */ package kernel; import java.util.ArrayList; public class CommandList { private ArrayList commands; // input file (file) - given to the first command in pipe // string, in case of stdin private String input; // output of a command (file) - given to the last command in pipe; empty // string, in case of stdout private String output; // true, if last redirection was >> private boolean isAppend; public ArrayList getCommands() { return commands; } public void setCommands(ArrayList commands) { this.commands = commands; } public String getInput() { return input; } public void setInput(String input) { this.input = input; } public boolean isAppend() { return isAppend; } public void setAppend(boolean isAppend) { this.isAppend = isAppend; } public String getOutput() { return output; } public void setOutput(String output) { this.output = output; } public CommandList(ArrayList commands, String input, String output, boolean isAppend) { this.commands = commands; this.input = input; this.output = output; this.isAppend = isAppend; } public CommandList() { this.commands = new ArrayList(); } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(String.format("Vstup: %s\n", this.input)); sb.append(String.format("Vystup: %s\n", this.output)); sb.append(String.format("IsAppend: %b\n-------------------\n", this.isAppend)); for (Command com : this.commands) { sb.append(String.format("%s\n", com.toString())); } return sb.toString(); } }