Class ProjogConsole


  • public class ProjogConsole
    extends java.lang.Object
    Command line interface to Prolog.

    Provides a mechanism for users to interact with Projog via a read-evaluate-print loop (REPL).

    • Constructor Summary

      Constructors 
      Constructor Description
      ProjogConsole​(java.io.InputStream in, java.io.PrintStream out)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void consultScript​(java.lang.String startupScriptName)  
      private void consultScripts​(java.util.List<java.lang.String> scriptFilenames)  
      private boolean evaluateOnce​(QueryResult r, java.util.Set<java.lang.String> variableIds)
      Returns true if QueryResult can be re-tried
      private static boolean isNotEmpty​(java.lang.String input)  
      static void main​(java.lang.String[] args)  
      private void parseAndExecute​(java.lang.String inputSyntax)  
      private void printOutcome​(boolean success, long timing)  
      private void printPrompt()  
      private void printVariableAssignments​(QueryResult r, java.util.Set<java.lang.String> variableIds)  
      private void processThrowable​(java.lang.Throwable e)  
      (package private) void run​(java.util.List<java.lang.String> startupScriptFilenames)  
      private boolean shouldContinue()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • QUIT_COMMAND

        private static final PredicateKey QUIT_COMMAND
        Command user can enter to exit the console application.
      • CONTINUE_EVALUATING

        private static final java.lang.String CONTINUE_EVALUATING
        See Also:
        Constant Field Values
      • in

        private final java.util.Scanner in
      • out

        private final java.io.PrintStream out
      • projog

        private final Projog projog
      • quit

        private boolean quit
    • Constructor Detail

      • ProjogConsole

        ProjogConsole​(java.io.InputStream in,
                      java.io.PrintStream out)
    • Method Detail

      • run

        void run​(java.util.List<java.lang.String> startupScriptFilenames)
          throws java.io.IOException
        Throws:
        java.io.IOException
      • printPrompt

        private void printPrompt()
      • isNotEmpty

        private static boolean isNotEmpty​(java.lang.String input)
      • consultScripts

        private void consultScripts​(java.util.List<java.lang.String> scriptFilenames)
      • consultScript

        private void consultScript​(java.lang.String startupScriptName)
      • parseAndExecute

        private void parseAndExecute​(java.lang.String inputSyntax)
      • shouldContinue

        private boolean shouldContinue()
      • processThrowable

        private void processThrowable​(java.lang.Throwable e)
      • evaluateOnce

        private boolean evaluateOnce​(QueryResult r,
                                     java.util.Set<java.lang.String> variableIds)
        Returns true if QueryResult can be re-tried
      • printVariableAssignments

        private void printVariableAssignments​(QueryResult r,
                                              java.util.Set<java.lang.String> variableIds)
      • printOutcome

        private void printOutcome​(boolean success,
                                  long timing)
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Throws:
        java.io.IOException