I am having trouble adding values that are in a List named Processes to the Aptos list. Always show only the last process, and duplicate. Even so, remove all previous processes.
Code below:
public void verificaTodosProcessosAptos(){
int i;
for(i=0;i<FilaProcessos.size();i++){
if(FilaProcessos.get(i).getTempoCriacao()<TSP){
saiDeProcessoParaAptos();
i--;
}
}
}
public void saiDeProcessoParaAptos(){
//apto=FilaAptos.get(indiceAptos);
processo=FilaProcessos.get(0);
apto.setPid(processo.getPid());
apto.setNome(processo.getNome());
apto.setTempoCriacao(processo.getTempoCriacao());
apto.setTempoExecucao(processo.getTempoExecucao());
if (TSF == 0)
apto.setEsperaFila(0);
else
apto.setEsperaFila(TSP - apto.getTempoCriacao());
apto.setSaidaFila(apto.getTempoCriacao() + apto.getEsperaFila());
TSF=apto.getSaidaFila();
armazenarFilaApto(apto);
indiceAptos++;
excluirFilaProcessos(processo);
indiceProcesso--;
}
public void armazenarFilaApto(Aptos a){
FilaAptos.add(a);
}
I do not know if they could understand, I clarify any doubts about my question.