package le2.plp.expressions2.memory; import java.util.HashMap; import java.util.Stack; import java.util.Map.Entry; import le2.plp.expressions2.expression.Id; import le2.plp.expressions2.expression.Valor; public class ContextoExecucao extends Contexto implements AmbienteExecucao { public ContextoExecucao clone() { ContextoExecucao retorno = new ContextoExecucao(); Stack> novaPilha = new Stack>(); HashMap novoMap = new HashMap(); novaPilha.add(novoMap); for (HashMap map : this.pilha){ for(Entry entry : map.entrySet()){ novoMap.put(entry.getKey(), entry.getValue()); } } retorno.setPilha(novaPilha); return retorno; } }