transcendental-lisp/src/environment/Environment.java

57 lines
1.1 KiB
Java
Raw Normal View History

package environment;
import java.io.*;
public class Environment {
private static final Environment instance = new Environment();
public static Environment getInstance() {
return instance;
}
private InputStream input;
private PrintStream output;
private PrintStream errorOutput;
private Runnable terminate;
private Environment() {}
public void setInput(InputStream input) {
this.input = input;
}
public void setOutput(PrintStream output) {
this.output = output;
}
public void setErrorOutput(PrintStream errorOutput) {
this.errorOutput = errorOutput;
}
public void setTerminate(Runnable terminate) {
this.terminate = terminate;
}
public InputStream getInput() {
return input;
}
public String getInputName() {
return input.toString();
}
public PrintStream getOutput() {
return output;
}
public PrintStream getErrorOutput() {
return errorOutput;
}
public void terminate() {
terminate.run();
}
}