Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| GNU Prolog for Java
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gnu.prolog.vm
Class Environment

    java.lang.Object
      gnu.prolog.vm.Environment

All Implemented Interfaces:
  PredicateListener, EventListener

    public class Environment

extends Object
implements PredicateListener

this class represent prolog processor.

Nested Class Summary
`static class` | `Environment.DoubleQuotesValue` The possible values of the `double_quotes flag`
`protected static class` | `Environment.PrologCodeListenerRef`

Field Summary
`protected Map<AtomTerm,PrologStream>` | `alias2stream`
`protected Map<AtomTerm,Term>` | `atom2flag` atom to flag
`static AtomTerm` | `boundedAtom`
`protected Set<AtomTerm>` | `changableFlags`
`static AtomTerm` | `charConversionAtom`
`protected PrologStream` | `currentInput`
`protected PrologStream` | `currentOutput`
`static AtomTerm` | `debugAtom`
`static AtomTerm` | `dialectAtom`
`static AtomTerm` | `dialectTerm`
`static AtomTerm` | `doubleQuotesAtom`
`static AtomTerm` | `downAtom`
`static AtomTerm` | `errorAtom`
`static AtomTerm` | `flagValueAtom`
`static AtomTerm` | `integerRoundingFunctionAtom`
`static IntegerTerm` | `maxIntegerTerm`
`static IntegerTerm` | `minIntegerTerm`
`static AtomTerm` | `modifyAtom`
`static AtomTerm` | `offAtom`
`static AtomTerm` | `onAtom`
`protected List<PrologStream>` | `openStreams`
`protected OperatorSet` | `opSet`
`static CompoundTermTag` | `plusTag`
`protected ReferenceQueue<? super PrologCodeListener>` | `prologCodeListenerReferenceQueue`
`static AtomTerm` | `prologFlagAtom`
`protected PrologTextLoaderState` | `prologTextLoaderState` current state of loaded database
`protected Map<CompoundTermTag,PrologCode>` | `tag2code` PredicateTag to code mapping
`protected Map<CompoundTermTag,List<Environment.PrologCodeListenerRef>>` | `tag2listeners`
`static AtomTerm` | `towardZeroAtom`
`protected PrologCode` | `undefinedPredicate` predicate which used instead of real code when predicate is not defined
`static AtomTerm` | `unknownAtom`
`protected PrologStream` | `userInput`
`protected PrologStream` | `userOutput`
`static AtomTerm` | `versionAtom`
`static IntegerTerm` | `versionTerm`
`static AtomTerm` | `warningAtom`

Constructor Summary
`Environment()` constructor of environment, it loads buildins to database at start.
`Environment(InputStream stdin, OutputStream stdout)`

Method Summary
`void` | `addPrologCodeListener(CompoundTermTag tag, PrologCodeListener listener)` add prolog code listener
`boolean` | `close(PrologStream stream)`
`void` | `closeStreams()` Closes all open streams
`Interpreter` | `createInterpreter()` create interpreter for this environment
`protected void` | `createTextLoader()`
`void` | `ensureLoaded(Term term)` Ensure that prolog text designated by term is loaded You must use `#runInitialization()` after using this and before expecting answers.
`CharConversionTable` | `getConversionTable()`
`PrologStream` | `getCurrentInput()`
`PrologStream` | `getCurrentOutput()`
`static InputStream` | `getDefaultInputStream()`
`static OutputStream` | `getDefaultOutputStream()`
`List<PrologTextLoaderError>` | `getLoadingErrors()`
`Module` | `getModule()`
`OperatorSet` | `getOperatorSet()`
`PrologCode` | `getPrologCode(CompoundTermTag tag)` get prolog code
`Term` | `getPrologFlag(AtomTerm term)` get flag for this environment
`Map<AtomTerm,Term>` | `getPrologFlags()` get get copy of current state of flags for this environment
`PrologTextLoaderState` | `getPrologTextLoaderState()`
`Map<PrologStream,List<Term>>` | `getStreamProperties()`
`PrologTextLoaderState` | `getTextLoaderState()` Deprecated.
`PrologCode` | `getUndefinedPredicateCode(CompoundTermTag tag)` get undefined predicate code
`PrologStream` | `getUserInput()`
`PrologStream` | `getUserOutput()`
`protected void` | `initEnvironment()` Initialize the environment
`protected void` | `initStreams(InputStream stdin, OutputStream stdout)`
`boolean` | `isInitialized()` true if the environment was already initialized
`PrologCode` | `loadPrologCode(CompoundTermTag tag)` load code for prolog
`Term` | `open(AtomTerm source_sink, AtomTerm mode, PrologStream.OpenOptions options)`
`protected void` | `pollPrologCodeListeners()`
`void` | `predicateUpdated(PredicateUpdatedEvent evt)`
`void` | `removePrologCodeListener(CompoundTermTag tag, PrologCodeListener listener)` remove prolog code listener
`PrologStream` | `resolveStream(Term stream_or_alias)`
`void` | `runIntialization(Interpreter interpreter)` Run the initialization.
`void` | `setCurrentInput(PrologStream stream)`
`void` | `setCurrentOutput(PrologStream stream)`
`static void` | `setDefaultInputStream(InputStream defaultInputStream)`
`static void` | `setDefaultOutputStream(OutputStream defaultOutputStream)`
`protected void` | `setNewPrologFlag(AtomTerm flag, Term newValue, boolean changable)` set flag for this environment
`void` | `setPrologFlag(AtomTerm flag, Term newValue)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### opSet

    protected OperatorSet opSet

### prologTextLoaderState

    protected PrologTextLoaderState prologTextLoaderState

  current state of loaded database

### undefinedPredicate

    protected PrologCode undefinedPredicate

  predicate which used instead of real code when predicate is not defined

### tag2code

    protected Map<CompoundTermTag,PrologCode> tag2code

  PredicateTag to code mapping

### boundedAtom

    public static final AtomTerm boundedAtom

### integerRoundingFunctionAtom

    public static final AtomTerm integerRoundingFunctionAtom

### downAtom

    public static final AtomTerm downAtom

### towardZeroAtom

    public static final AtomTerm towardZeroAtom

### charConversionAtom

    public static final AtomTerm charConversionAtom

### onAtom

    public static final AtomTerm onAtom

### offAtom

    public static final AtomTerm offAtom

### debugAtom

    public static final AtomTerm debugAtom

### unknownAtom

    public static final AtomTerm unknownAtom

### errorAtom

    public static final AtomTerm errorAtom

### warningAtom

    public static final AtomTerm warningAtom

### doubleQuotesAtom

    public static final AtomTerm doubleQuotesAtom

### dialectAtom

    public static final AtomTerm dialectAtom

### versionAtom

    public static final AtomTerm versionAtom

### maxIntegerTerm

    public static final IntegerTerm maxIntegerTerm

### minIntegerTerm

    public static final IntegerTerm minIntegerTerm

### dialectTerm

    public static final AtomTerm dialectTerm

### versionTerm

    public static final IntegerTerm versionTerm

### prologFlagAtom

    public static final AtomTerm prologFlagAtom

### flagValueAtom

    public static final AtomTerm flagValueAtom

### modifyAtom

    public static final AtomTerm modifyAtom

### plusTag

    public static final CompoundTermTag plusTag

### atom2flag

    protected Map<AtomTerm,Term> atom2flag

  atom to flag

### changableFlags

    protected Set<AtomTerm> changableFlags

### tag2listeners

    protected Map<CompoundTermTag,List<Environment.PrologCodeListenerRef>> tag2listeners

### prologCodeListenerReferenceQueue

    protected ReferenceQueue<? super PrologCodeListener> prologCodeListenerReferenceQueue

### userInput

    protected PrologStream userInput

### userOutput

    protected PrologStream userOutput

### currentInput

    protected PrologStream currentInput

### currentOutput

    protected PrologStream currentOutput

### openStreams

    protected List<PrologStream> openStreams

### alias2stream

    protected Map<AtomTerm,PrologStream> alias2stream

Constructor Detail

### Environment

    public Environment()

  constructor of environment, it loads buildins to database at start.

### Environment

    public Environment(InputStream stdin,
                       OutputStream stdout)

Method Detail

### getDefaultInputStream

    public static InputStream getDefaultInputStream()

  Returns:
    the defaultInputStream

### setDefaultInputStream

    public static void setDefaultInputStream(InputStream defaultInputStream)

  Parameters:
    `defaultInputStream` - the defaultInputStream to set

### getDefaultOutputStream

    public static OutputStream getDefaultOutputStream()

  Returns:
    the defaultOutputStream

### setDefaultOutputStream

    public static void setDefaultOutputStream(OutputStream defaultOutputStream)

  Parameters:
    `defaultOutputStream` - the defaultOutputStream to set

### initEnvironment

    protected void initEnvironment()

  Initialize the environment

### createTextLoader

    protected void createTextLoader()

### getTextLoaderState

    @Deprecated
    public PrologTextLoaderState getTextLoaderState()

  Deprecated.

### isInitialized

    public boolean isInitialized()

  true if the environment was already initialized

### getPrologFlags

    public Map<AtomTerm,Term> getPrologFlags()

  get get copy of current state of flags for this environment

### runIntialization

    public void runIntialization(Interpreter interpreter)

  Run the initialization. This executes any goals loaded into the initailization list by the :-initialization(Goal). directive or by the use of the NONISO abbreviation :- Goal. This should be run after `ensureLoaded(Term)` with the `Interpreter` obtained from `createInterpreter()`.

  Parameters:
    `interpreter` -

### getPrologFlag

    public Term getPrologFlag(AtomTerm term)

  get flag for this environment

### setNewPrologFlag

    protected void setNewPrologFlag(AtomTerm flag,
                                    Term newValue,
                                    boolean changable)

  set flag for this environment

### setPrologFlag

    public void setPrologFlag(AtomTerm flag,
                              Term newValue)
                       throws PrologException

  Throws:
    `PrologException`

### getLoadingErrors

    public List<PrologTextLoaderError> getLoadingErrors()

### getPrologTextLoaderState

    public PrologTextLoaderState getPrologTextLoaderState()

### ensureLoaded

    public void ensureLoaded(Term term)

  Ensure that prolog text designated by term is loaded You must use `#runInitialization()` after using this and before expecting answers.

  See Also:
    `src.gnu.prolog.vm.buildins.io.Predicate_ensure_loaded`

### createInterpreter

    public Interpreter createInterpreter()

  create interpreter for this environment

### getModule

    public Module getModule()

### loadPrologCode

    public PrologCode loadPrologCode(CompoundTermTag tag)
                              throws PrologException

  load code for prolog

  Throws:
    `PrologException`

### getUndefinedPredicateCode

    public PrologCode getUndefinedPredicateCode(CompoundTermTag tag)

  get undefined predicate code

### getPrologCode

    public PrologCode getPrologCode(CompoundTermTag tag)
                             throws PrologException

  get prolog code

  Throws:
    `PrologException`

### pollPrologCodeListeners

    protected void pollPrologCodeListeners()

### addPrologCodeListener

    public void addPrologCodeListener(CompoundTermTag tag,
                                      PrologCodeListener listener)

  add prolog code listener

### removePrologCodeListener

    public void removePrologCodeListener(CompoundTermTag tag,
                                         PrologCodeListener listener)

  remove prolog code listener

### predicateUpdated

    public void predicateUpdated(PredicateUpdatedEvent evt)

  Specified by:
    `predicateUpdated` in interface `PredicateListener`

### getOperatorSet

    public OperatorSet getOperatorSet()

### initStreams

    protected void initStreams(InputStream stdin,
                               OutputStream stdout)

### getUserInput

    public PrologStream getUserInput()
                              throws PrologException

  Throws:
    `PrologException`

### getUserOutput

    public PrologStream getUserOutput()
                               throws PrologException

  Throws:
    `PrologException`

### getCurrentInput

    public PrologStream getCurrentInput()
                                 throws PrologException

  Throws:
    `PrologException`

### getCurrentOutput

    public PrologStream getCurrentOutput()
                                  throws PrologException

  Throws:
    `PrologException`

### setCurrentInput

    public void setCurrentInput(PrologStream stream)
                         throws PrologException

  Throws:
    `PrologException`

### setCurrentOutput

    public void setCurrentOutput(PrologStream stream)
                          throws PrologException

  Throws:
    `PrologException`

### getStreamProperties

    public Map<PrologStream,List<Term>> getStreamProperties()
                                                     throws PrologException

  Throws:
    `PrologException`

### resolveStream

    public PrologStream resolveStream(Term stream_or_alias)
                               throws PrologException

  Throws:
    `PrologException`

### open

    public Term open(AtomTerm source_sink,
                     AtomTerm mode,
                     PrologStream.OpenOptions options)
              throws PrologException

  Throws:
    `PrologException`

### close

    public boolean close(PrologStream stream)
                  throws PrologException

  Parameters:
    `stream` -
  Returns:
    true if we closed and false if we did not close.
  Throws:
    `PrologException`

### closeStreams

    public void closeStreams()

  Closes all open streams

### getConversionTable

    public CharConversionTable getConversionTable()

  Returns:
    the convTable

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| GNU Prolog for Java
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD