Escolar Documentos
Profissional Documentos
Cultura Documentos
Nome: Leonardo
- RA:
((document.getElementById('textCarregado').value !=
"" ) && (!isNaN(document.getElementById('textCarregado').value))) &&
((document.getElementById('textUltima').value != "" )
&& (!isNaN(document.getElementById('textUltima').value))) &&
((document.getElementById('textR').value != "" ) &&
(!isNaN(document.getElementById('textR').value))) &&
((document.getElementById('textM').value != "" ) &&
(!isNaN(document.getElementById('textM').value))))
{
v1.push(parseInt(document.getElementById('textPagina').value));
v2.push(parseInt(document.getElementById('textCarregado').value));
v3.push(parseInt(document.getElementById('textUltima').value));
v4.push(parseInt(document.getElementById('textR').value));
v5.push(parseInt(document.getElementById('textM').value));
var position = 0;
for (i = 0; i < v2.length; i++){
if (v2[i] < menor){
menor = v2[i];
position = i;
}
}
v1.splice(position, 1);
v2.splice(position, 1);
v3.splice(position, 1);
v4.splice(position, 1);
v5.splice(position, 1);
//Cham funo que muda as tabelas
showDinamicColumns(v1,v2,v3,v4,v5);
}
else {
alert("A tabela est vazia!");
}
}
//Segunda Chance
function algSegChance(v1,v2,v3,v4,v5){
console.log(v1,v2,v3,v4,v5);
}
//LRU
function algLRU(v1,v2,v3,v4,v5){
if (!isNaN(v3[0])){
var menor = v3[0];
var position = 0;
for (i = 0; i < v3.length; i++){
if (v3[i] < menor){
menor = v3[i];
position = i;
}
}
v1.splice(position, 1);
v2.splice(position, 1);
v3.splice(position, 1);
v4.splice(position, 1);
v5.splice(position, 1);
//Cham funo que muda as tabelas
showDinamicColumns(v1,v2,v3,v4,v5);
}
else {
alert("A tabela est vazia!");
}
}
//--------------------------------------------------------------//Vetores com os dados
"<input type='text'
id='textUltima' name='textUltima' />" +
"</td>" +
"<td>" +
"<input type='text' id='textR'
name='textR' />" +
"</td>" +
"<td>" +
"<input type='text' id='textM'
name='textM' />" +
"</td>" +
"</tr>" +
"</table>" +
"</div>"
);
document.write(
"<br />"
);
//Boto para atualizar a tabela
document.write(
"<input type='button' id='buttonAtualizar'
name='buttonAtualizar' onClick='addVetor(pagina,carregado,ultima,r,m)' value='Atualizar' />"
);
document.write(
"<br />" +
"<br />"
);
//--------------------------------------------------------------//Algoritmos
document.write(
"<input type='button' id='buttonRelogio' name='buttonRelogio'
value='Relogio' onClick='algRelogio(pagina,carregado,ultima,r,m)' />"
);
document.write(
"<input type='button' id='buttonRelogio' name='buttonRelogio'
value='NRU' onClick='algNRU(pagina,carregado,ultima,r,m)' />"
);
document.write(
"<input type='button' id='buttonRelogio' name='buttonRelogio'
value='FIFO' onClick='algFIFO(pagina,carregado,ultima,r,m)' />"
);
document.write(
"<input type='button' id='buttonRelogio' name='buttonRelogio'
value='Segunda Chance' onClick='algSegChance(pagina,carregado,ultima,r,m)' />"
);
document.write(
"<input type='button' id='buttonRelogio' name='buttonRelogio'
value='LRU' onClick='algLRU(pagina,carregado,ultima,r,m)' />"
);
</script>
</head>
<body>
</body>
</html>