jpel.language
Class EnvironmentImpl

java.lang.Object
  |
  +--jpel.language.EnvironmentImpl
All Implemented Interfaces:
Environment

public class EnvironmentImpl
extends java.lang.Object
implements Environment

Implementação básica de um ambiente da linguagem.


Constructor Summary
EnvironmentImpl()
           
 
Method Summary
 void addContext()
          Incrementa o contexto do ambiente de execução, criando um novo elemento na pilha de bindings.
 void bind(jpel.language.ExpressionId id, jpel.language.Abstraction abstraction)
          Cria uma relação entre um identificador e sua abstração.
 void bind(jpel.language.ExpressionId id, jpel.language.Environment subEnvironment)
          Cria uma relação entre um identificador e seu submódulo.
 jpel.language.Environment createClone()
          Retorna uma cópia do ambiente.
 java.util.Iterator keys()
          Retorna uma listagem de todos os identificadores disponíveis no ambiente.
 jpel.language.Abstraction lookup(jpel.language.ExpressionId id)
          Retorna a abstração associada ao identificador.
 jpel.language.Environment lookupSub(jpel.language.ExpressionId id)
          Retorna o sub-ambiente associado ao identificador.
static void main(java.lang.String[] args)
           
 void removeContext()
          Decrementa a pilha de execução.
 void resolveRelatives()
          Resolve substitui todas os identificadores relativos aos módulos ("."
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnvironmentImpl

public EnvironmentImpl()
Method Detail

bind

public void bind(jpel.language.ExpressionId id,
                 jpel.language.Abstraction abstraction)
Description copied from interface: Environment
Cria uma relação entre um identificador e sua abstração.

Specified by:
bind in interface Environment
Parameters:
id - Nome da abstração.
abstraction - Abstração.

bind

public void bind(jpel.language.ExpressionId id,
                 jpel.language.Environment subEnvironment)
Description copied from interface: Environment
Cria uma relação entre um identificador e seu submódulo.

Specified by:
bind in interface Environment
Parameters:
id - Nome da abstração.
subEnvironment - O sub-ambiente.

lookup

public jpel.language.Abstraction lookup(jpel.language.ExpressionId id)
                                 throws IdNotFoundException
Description copied from interface: Environment
Retorna a abstração associada ao identificador.

Specified by:
lookup in interface Environment
Parameters:
id - Identificador da abstração.
Returns:
A abstração associada.
Throws:
IdNotFoundException - Quando a abstração com o nome dado não é encontrado.

lookupSub

public jpel.language.Environment lookupSub(jpel.language.ExpressionId id)
                                    throws IdNotFoundException
Description copied from interface: Environment
Retorna o sub-ambiente associado ao identificador.

Specified by:
lookupSub in interface Environment
Parameters:
id - Identificador da abstração.
Returns:
O corpo da abstração associada.
Throws:
IdNotFoundException - Quando a abstração com o nome dado não é encontrado.

keys

public java.util.Iterator keys()
Description copied from interface: Environment
Retorna uma listagem de todos os identificadores disponíveis no ambiente.

Specified by:
keys in interface Environment
Returns:
Um iterator sobre todos o identificadores do ambiente.

addContext

public void addContext()
Description copied from interface: Environment
Incrementa o contexto do ambiente de execução, criando um novo elemento na pilha de bindings.

Specified by:
addContext in interface Environment

removeContext

public void removeContext()
Description copied from interface: Environment
Decrementa a pilha de execução.

Specified by:
removeContext in interface Environment

resolveRelatives

public void resolveRelatives()
Description copied from interface: Environment
Resolve substitui todas os identificadores relativos aos módulos ("."Id) prefixando o nome do módulo ao identificador.

Specified by:
resolveRelatives in interface Environment

createClone

public jpel.language.Environment createClone()
Description copied from interface: Environment
Retorna uma cópia do ambiente.

Specified by:
createClone in interface Environment
Returns:
A cópia.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)