public void ejecutarProtocoloRcpPrimeraImplementacion(IInfartable infartable) { int cantidadDeIntentos = 0; this.eliminarObjetosDeLaboca(); this.comprobarEstado(); if (!infartable.estasConciente()) { this.llamarAmbulancia(); this.DescrubirTórax(); this.acomodarCabeza(); while (cantidadDeIntentos < 5 && !infartable.estasRespirando()) { this.hacerCcompresionesTorácicas(); this.hacerInsuflacciones(); if (!infartable.tieneRidmoCardiaco()) { this.usarElDisfribrilador(); } cantidadDeIntentos++; } if (cantidadDeIntentos == 5) { Console.WriteLine("Se ah intentado reanimar a la victima 5 veces... Lamentamos su fallecimiento. "); } else { Console.WriteLine("La victima a vuelto a respirar.... Esperando ambulancia"); } } else { Console.WriteLine("La victima se encuentra conciente"); } }
//METODO DEL MEDICO public virtual void atenderInfarto(IInfartable infartable) { if (this.sucesor != null) { sucesor.atenderInfarto(infartable); } }
public virtual void AtenderInfarto(IInfartable infartable) { if (this.manejador != null) { this.manejador.AtenderInfarto(infartable); } }
public virtual void atenderInfartado(IInfartable infartable) { if (Sucesor != null) { Sucesor.atenderInfartado(infartable); } }
public virtual void atenderInfarto(IInfartable passerby) { if (this.sucesor != null) { this.sucesor.atenderInfarto(passerby); } }
// Métodos protected override void repetirHastaQueRespire(IInfartable paciente) { int intentos = 0; while (!paciente.estasRespirando() && (intentos != 5)) { this.hacerCompresionesToracicas(); this.hacerInsuflaciones(); if (!paciente.tenesRitmoCardiaco()) { this.usarDesfibrilador(); } intentos++; } if (intentos == 5) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(" Se han realizado 5 intentos y el paciente no respira. Desisto con la rehanimación, el paciente ha fallecido"); Console.ForegroundColor = ConsoleColor.White; } else { Console.WriteLine(" EL PACIENTE YA RESPIRA"); } }
virtual public void atenderInfarto(IInfartable paciente) { if (sucesor != null) { sucesor.atenderInfarto(paciente); } }
public void atenderInfarto(IInfartable transeunte) { this.eliminarObjetos(); this.comprobarEstado(); if (!transeunte.estaConciente()) { Console.WriteLine("\nEl transeunte esta inconciente. Se lo llevará al hospital\n"); this.llamarAmbulancia(); this.descubrirTorax(); this.acomodarCabeza(); do { this.hacerCompresion(); this.hacerInsuflacion(); }while (!transeunte.estaRespirando()); if (!transeunte.tieneRitmoCardiaco()) { Console.WriteLine("\nEl transeunte no responde...\n"); this.usarDesfibrilador(); } else { Console.WriteLine("\nEl transeunte se ha salvado\n"); } } else { Console.WriteLine("\nEl transeunte se encuentra a salvo..\n"); } }
//METODOS public override void atenderInfarto(IInfartable t) { if (rcp is RCP_A) { ((RCP_A)rcp).Contador = 1; } if (vehiculo == null && herramienta == null) { this.vehiculo = new Ambulancia(); this.herramienta = new Desfibrilador(); } vehiculo.encenderSirena(); vehiculo.conducir(); if (this.vehiculo.getEstado() is Roto) { Console.WriteLine("La ambulancia se rompio, el medico no pudo completar su tarea"); } else { this.apagarVehiculo(); herramienta.usar(); Console.WriteLine("Atendiendo infarto"); rcp.realizarRCP(t); herramienta.guardar(); } }
public void ejecutarProtocoloRcpSegundaImplementacion(IInfartable infartable) { this.eliminarObjetosDeLaboca(); this.comprobarEstado(); if (!infartable.estasConciente()) { this.llamarAmbulancia(); this.DescrubirTórax(); this.acomodarCabeza(); while (!infartable.estasRespirando()) { this.hacerCcompresionesTorácicas(); this.hacerInsuflacciones(); if (!infartable.tieneRidmoCardiaco()) { this.usarElDisfribrilador(); } } Console.WriteLine("La victima a vuelto a respirar.... Esperando ambulancia"); } else { Console.WriteLine("La victima se encuentra conciente"); } }
public override void AtenderInfarto(IInfartable transeunte) { vehiculo.encenderSirena(); vehiculo.Conducir(); herramienta.usar(); templateMethod.Method(transeunte); herramienta.Guardar(); }
public override void atenderInfartado(IInfartable infartable) { ICuartel hospital = fabricaDeMedicos.crearCuartel(); IResponsable medico = hospital.getPersonal(); ((Medico)medico).atenderInfartado(infartable); hospital.devolverAlICuartl(medico); }
public virtual void AtenderInfarto(IInfartable transeunte) { if (siguiente != null) { siguiente.AtenderInfarto(transeunte); } else { Console.WriteLine("El problema no se pudo solucionar"); } }
public override void AtenderInfarto(IInfartable transeunte) { if (medicoReal == null) { fabrica = new FabricaMedico(siguiente); medicoReal = (Medico)fabrica.crearHeroe(); medicoReal.Herramienta = fabrica.crearHerramienta(); medicoReal.Vehiculo = fabrica.crearVehiculo(); } medicoReal.AtenderInfarto(transeunte); }
// Métodos protected override void repetirHastaQueRespire(IInfartable paciente) { while (!paciente.estasRespirando()) { this.hacerCompresionesToracicas(); this.hacerInsuflaciones(); if (!paciente.tenesRitmoCardiaco()) { this.usarDesfibrilador(); } } Console.WriteLine(" EL PACIENTE YA ESTÁ RESPIRANDO"); }
public void realizarRCP(IInfartable paciente) { this.eliminarObjetosDeBoca(); this.comprobarEstadoConsciente(); if (!paciente.estasConsciente()) { this.llamarAmbulancia(); this.descubrirToraxPaciente(); this.acomodarCabezaPaciente(); this.repetirHastaQueRespire(paciente); } else { Console.WriteLine(" EL PACIENTE YA SE ENCUENTRA CONSCIENTE"); } }
public override void atenderInfarto(IInfartable passerby) { if (kit == true) { vehiculo.encenderSirena(); vehiculo.conducir(); herramienta.usar(); } Console.WriteLine("Un medico esta atendiendo un infarto\n"); protocolo.atenderInfarto(passerby); if (kit == true) { herramienta.guardar(); } }
//metodos public override void atenderInfartado(IInfartable infartable) { if (vehiculo.conducir()) { this.Herramienta.usar(); Console.WriteLine(""); GetProtocoloRcp1().ejecutarProtocoloRcpPrimeraImplementacion(infartable); Console.WriteLine(""); this.Herramienta.guardar(); } else { Console.WriteLine(""); Console.WriteLine("Lo lamento, no se ah podido llegar a destino"); Console.WriteLine(""); } }
//METODO PLANTILLA public void AtenderInfarto(IInfartable infartable) { EliminarObjetosBoca(); ComprobarEstadoConciencia(); if (infartable.estasConciente() == false) { //LlamarAmbulancia(); DescubrirTorax(); AcomodarCabeza(); Boolean respira = infartable.estasRespirando(); if (respira) { Console.WriteLine("EL PACIENTE ESTA RESPIRANDO"); } else { while (respira == false) { HacerCompresionesToracicas(); HacerInsuflaciones(); if (infartable.tenesRitmoCardiaco() == false) { UsarDesfibrilador(); } if (CantidadVecesReanimacion()) { Console.WriteLine("YA NO SE PUEDE HACER NADA, LO PERDIMOS"); respira = true; } respira = infartable.estasRespirando(); if (respira) { Console.WriteLine("EL PACIENTE YA ESTA RESPIRANDO GRACIAS A DIOS"); GuardarDesfibrilador(); } } } } else { Console.WriteLine("EL PACIENTE ESTA CONCIENTE !!!"); } }
// Métodos override public void atenderInfarto(IInfartable paciente) { Console.BackgroundColor = ConsoleColor.DarkGreen; Console.WriteLine(" [MEDICO] "); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("# [¡Se me ha solicitado atender un infarto!] "); Console.ResetColor(); vehiculo.encenderSirena(); vehiculo.conducir(); herramienta.usar(); // 07 - Template Method protocoloRCP.realizarRCP(paciente); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("# [¡He finalizado el protocolo RCP!] "); Console.ResetColor(); herramienta.guardar(); Console.WriteLine("_______________________________________________ \n "); }
//********************************************************************************************************* public override void AtenderInfarto(IInfartable infartable) { this.vehiculo.encenderSirena(); // IMPLEMENTAR CONDICIONAL PARA VER SI EL VEHICULO LLEGA ROTO O NO / CONDUCIR RETORNA UN BOOLEANO if (this.vehiculo.conducir()) { protocolo.AtenderInfarto(infartable); //METODOS ANULADOS CONTEMPLADOS DESDE EL PATRON TEMPLATE METHOD //this.herramienta.usar(); //this.herramienta.guardar(); Console.WriteLine(); } else { Console.WriteLine("TENGO UN INCONVENIENTE NO VOY A PODER ATENDER EL INFARTO. EL VEHICULO SE HA ROTO"); } Console.WriteLine(); }
override public void atenderInfarto(IInfartable paciente) { if (heroeReal == null) { heroeReal = fabrica.crearHeroe(); // casteo para poder setear estrategia (propia de un bombero) heroeReal.setHerramienta(fabrica.crearHerramienta()); heroeReal.setVehiculo(fabrica.crearVehiculo()); // seteo la estrategia de apagado, pero antes creo un aux de tipo Bombero para poder setear apagado Medico aux = (Medico)heroeReal; Console.WriteLine("[MEDICO] Elegir estrategia de protocolo RCP (ingresar número):"); Console.WriteLine(" 1. Intentar sin detenerse"); Console.WriteLine(" 2. Intentar y desistir"); bool opcionvalida = false; while (!opcionvalida) { char op = Console.ReadKey().KeyChar; switch (op) { case '1': aux.setProtocoloRCP(new RCPTipoA()); opcionvalida = true; break; case '2': aux.setProtocoloRCP(new RCPTipoB()); opcionvalida = true; break; default: Console.WriteLine(" \n ERROR: Por favor, ingrese una opción correcta: "); break; } } } heroeReal.atenderInfarto(paciente); // devuelvo el bombero creado al cuartel fabrica.crearCuartel().agregarPersonal(heroeReal); fabrica.crearCuartel().agregarVehiculo(heroeReal.getVehiculo()); fabrica.crearCuartel().agregarHerramienta(heroeReal.getHerramienta()); }
public void Method(IInfartable i) { this.AnalizarBoca(); this.EstadoDelPaciente(); if (!i.estasConciente()) { this.LlamarAmbulancia(); this.DescubrirTorax(); this.AcomodarCabeza(); while (!i.estasRespirando()) { this.CompresionToraxica(); this.HacerInsuflaciones(); while (!i.tenesRitmoCardiaco()) { this.Desfibrilador(); } } } }
public override void atenderInfarto(IInfartable transeunte){ if (fabrica==null) { fabrica= new FabricaDeMedico(); } Medico medico= (Medico)fabrica.crearHeroe(); medico.Herramienta= fabrica.crearHerramienta(); medico.Vehiculo= fabrica.crearVehiculo(); medico.atenderInfarto(transeunte); }
public void realizarRCP(IInfartable paciente) { this.eliminarElementoBoca(); this.comprobarEstadoVictima(); if (!paciente.estasConciente()) { this.llamarAmbulancia(); this.descrubrirTorax(); this.acomodarCabeza(); do { this.hacerCompresionesToraxicas(); this.hacerInsuflaciones(); if (paciente.tenesRitmoCardiaco()) { this.usarDesfibrilador(); return; } }while(!paciente.estasRespirando() && intentoReanimacion()); } }
public DenunciaDeInfarto(IInfartable infartable) { this.infartable = infartable; }
// Constructor public DenunciaDeInfarto(IInfartable paciente) { this.paciente = paciente; }
// Métodos abstract protected void repetirHastaQueRespire(IInfartable paciente);
public DenunciaDeInfarto(IInfartable transeunte) { this.transeunte = transeunte; }
//********************************************************************************************************* //METODO QUE LLAMA ALA METODO PLANTILLA DEL PATRON TEMPLATE METHOD public void AtenderInfartoTemplateMethod(IInfartable infartable) { this.protocolo = new ProtocoloA(); protocolo.AtenderInfarto(infartable); }