Class StoredValue<T>

    • Constructor Detail

      • StoredValue

        public StoredValue​(Object key)
        Initialize a stored value key using any Java Object.
        Parameters:
        key - unique identity of the stored value. This will be the hash key in the Prolog Environments's hash map.
      • StoredValue

        public StoredValue()
        Initializes a stored value key with a new unique key.
    • Method Detail

      • create

        public static <T> StoredValue<T> create()
        Construct a new unique key that does not match any other key.
      • create

        public static <T> StoredValue<T> create​(Class<T> clazz)
        Construct a key based on a Java Class object, useful for singletons.
      • getOrNull

        public T getOrNull​(com.googlecode.prolog_cafe.lang.Prolog engine)
        Look up the value in the engine, or return null.
      • get

        public T get​(com.googlecode.prolog_cafe.lang.Prolog engine)
        Get the value from the engine, or throw SystemException.
      • set

        public void set​(com.googlecode.prolog_cafe.lang.Prolog engine,
                        T obj)
      • set

        public void set​(PrologEnvironment env,
                        T obj)
        Set the value into the environment's interpreter.
      • createValue

        protected T createValue​(com.googlecode.prolog_cafe.lang.Prolog engine)
        Creates a value to store, returns null by default.
        Parameters:
        engine - Prolog engine.
        Returns:
        new value.