-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEmergencia.java
More file actions
53 lines (49 loc) · 1.41 KB
/
Emergencia.java
File metadata and controls
53 lines (49 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Vector;
// TODO: Auto-generated Javadoc
/**
* The Class Emergencia.
*/
public class Emergencia{
/** The pacientes. */
private Vector<Paciente> pacientes = new Vector<Paciente>();
/**
* Entrar pacientes.
*
* @param file the file
* @throws FileNotFoundException the file not found exception
*/
public void entrarPacientes(String file) throws FileNotFoundException{
File archivo = new File(file);
String palabra = "";
String[] palabras;
BufferedReader br = new BufferedReader(new FileReader(file));
String line = null;
try {
while ((line = br.readLine()) != null) {
palabras=line.split(",");
pacientes.add(new Paciente(palabras[0].replace(" ", ""), palabras[1].replace(" ", ""),palabras[2].replace(" ", "")));
}
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Devolver pacientes en orden.
*
* @return the string
*/
public String devolverPacientesEnOrden(){
String pacientesEnOrden="";
VectorHeap heap = new VectorHeap(pacientes);
while(heap.iterator().hasNext()){
Paciente paciente = (Paciente) heap.poll();
pacientesEnOrden=pacientesEnOrden+paciente.getNombrePaciente()+" "+","+paciente.getEnfermedad()+" "+","+paciente.getPrioridad()+"\n";
}
return pacientesEnOrden;
}
}