Class Console



  • public class Console
    extends Object
    A java console program to run the evaluator interactivly.
    • Constructor Detail

      • Console

        public Console​()
        Instantiates a new console.
    • Method Detail

      • main

        public static void main​(String[] args)
        The main method.
        Parameters:
        args - the arguments
      • interpreter

        public String interpreter​(String strEval)
        Evaluates the given string-expression and returns the result in OutputForm.
        Parameters:
        strEval - the str eval
        Returns:
        the string
      • printPrompt

        public void printPrompt​(PrintStream out,
                                String prompt)
        prints a prompt on the console but doesn't print a newline.
        Parameters:
        out - the out
        prompt - the prompt string to display
      • readString

        public String readString​(PrintStream out)
        read a string from the console. The string is terminated by a newline
        Parameters:
        out - Description of Parameter
        Returns:
        the input string (without the newline)
      • readString

        public String readString​(PrintStream out,
                                 String prompt)
        read a string from the console. The string is terminated by a newline
        Parameters:
        out - Description of Parameter
        prompt - the prompt string to display
        Returns:
        the input string (without the newline)
      • setFile

        public void setFile​(File file)
        Sets the file.
        Parameters:
        file - the new file
      • getFile

        public File getFile​()
        Gets the file.
        Returns:
        the file with which the program was started or null