0
I’m having trouble adding values that are in a list called Processes to the Aptos list. Always shows only the last process, and in duplicate form. Still removes 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 you can understand, anything I clarify the doubts about my question.
Can you put it in code? I can’t see the image.
– Gustavo Cinque
how I format the code here?
– Rodrigo Segatto
Give 4 spaces at the beginning of the line, he already does the 'rest'
– emanuelsn
in the fear "saiDeProcersParaAptos()", you are always picking up Filaprocessos.get(0). I do not advise you to try to manipulate the content of a for. It can also get in the way!
– Gilvan André
You’d also find it interesting that you put the code in, not a photo!
– Gilvan André
If it is too large, four spaces in each line of code, if it is small, thing of a method or reserved word, use Shift+ before and after the highlighted snippet.
– Gustavo Cinque