Class PrologEnvironment


  • public class PrologEnvironment
    extends com.googlecode.prolog_cafe.lang.BufferingPrologControl
    Per-thread Prolog interpreter.

    This class is not thread safe.

    A single copy of the Prolog interpreter, for the current thread.

    • Field Summary

      • Fields inherited from class com.googlecode.prolog_cafe.lang.PrologControl

        code, engine
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addToCleanup​(Runnable task)
      Adds cleanup task to run when close() is called
      void close()
      Release resources stored in interpreter's hash manager.
      void copyStoredValues​(PrologEnvironment child)
      Copy the stored values from another interpreter to this one.
      <T> T get​(StoredValue<T> sv)
      Lookup a stored value in the interpreter's hash manager.
      PrologEnvironment.Args getArgs()  
      <T> void set​(StoredValue<T> sv, T obj)
      Set a stored value on the interpreter's hash manager.
      void setCleanup​(List<Runnable> newCleanupList)
      Assign the environment a cleanup list (in order to use a centralized list) If this enivronment's list is non-empty, append its cleanup tasks to the assigning list.
      void setPredicate​(com.googlecode.prolog_cafe.lang.Predicate goal)  
      • Methods inherited from class com.googlecode.prolog_cafe.lang.BufferingPrologControl

        all, all, execute, fail, initialize, isEngineStopped, once, once, success
      • Methods inherited from class com.googlecode.prolog_cafe.lang.PrologControl

        configureUserIO, executePredicate, getMaxDatabaseSize, getPrologClassLoader, getReductions, isEnabled, printStackTrace, setEnabled, setEnabled, setMaxDatabaseSize, setPredicate, setPredicate, setPrologClassLoader, setReductionLimit
    • Method Detail

      • setPredicate

        public void setPredicate​(com.googlecode.prolog_cafe.lang.Predicate goal)
        Overrides:
        setPredicate in class com.googlecode.prolog_cafe.lang.PrologControl
      • get

        public <T> T get​(StoredValue<T> sv)
        Lookup a stored value in the interpreter's hash manager.
        Type Parameters:
        T - type of stored Java object.
        Parameters:
        sv - unique key.
        Returns:
        the value; null if not stored.
      • set

        public <T> void set​(StoredValue<T> sv,
                            T obj)
        Set a stored value on the interpreter's hash manager.
        Type Parameters:
        T - type of stored Java object.
        Parameters:
        sv - unique key.
        obj - the value to store under sv.
      • copyStoredValues

        public void copyStoredValues​(PrologEnvironment child)
        Copy the stored values from another interpreter to this one. Also gets the cleanup from the child interpreter
      • setCleanup

        public void setCleanup​(List<Runnable> newCleanupList)
        Assign the environment a cleanup list (in order to use a centralized list) If this enivronment's list is non-empty, append its cleanup tasks to the assigning list.
      • addToCleanup

        public void addToCleanup​(Runnable task)
        Adds cleanup task to run when close() is called
        Parameters:
        task - is run when close() is called
      • close

        public void close()
        Release resources stored in interpreter's hash manager.