public static void PatronBuilder() { IStrategy estrategia = new Secuencial(); Director director = new Director(); var builder = new BuilderFavorable(); Casa casa = new Casa(410, 9, 12, director, builder); Decorator pasto = new PastoSeco(casa.crearSector(1, 15, 10)); Calle calle = new Calle(12, 12, 100); IResponsable responsable = null; FabricaBombero FBombero = new FabricaBombero(estrategia, pasto, responsable); crearHeroe(FBombero).getPersonal().ApagarIncendio(casa, calle); }
public static void PatronFactoryMethod() { IStrategy estrategia = new Secuencial(); Director director = new Director(); var builder = new BuilderFavorable(); Casa casa = new Casa(10, 9, 12, director, builder); Calle calle = new Calle(10, 12, 10); IResponsable responsable = null; Decorator pastoSeco = new PastoSeco(FactorySectores.crearSector(1)); FabricaBombero FBombero = new FabricaBombero(estrategia, pastoSeco, responsable); ICuartel cuartel = crearHeroe(FBombero); cuartel.getPersonal().ApagarIncendio(casa, calle); }
public static void patronObserver() { IStrategy estrategia = new Secuencial(); Director director = new Director(); var builder = new BuilderFavorable(); Casa casa = new Casa(410, 9, 12, director, builder); Decorator pasto = new PastoSeco(casa.crearSector(1, 15, 10)); IResponsable responsable = null; FabricaBombero FBombero = new FabricaBombero(estrategia, pasto, responsable); ICuartel cuartel = crearHeroe(FBombero); Calle calle = new Calle(12, 12, 20); casa.Calle = calle; casa.agregar((Bombero)cuartel.getPersonal()); casa.Chispa(); }
public static void PatronAbstractFactory() { Director director = new Director(); var builder = new BuilderFavorable(); Casa casa = new Casa(10, 4, 12, director, builder); IStrategy estrategia = new Secuencial(); Decorator pasto = new PastoSeco(casa.crearSector(10, 10, 10)); Transeunte persona = new Transeunte(); Esquina esquina = new Esquina(12); IResponsable responsable = null; responsable = new Electricista(responsable); FabricaElectricista FElectricista = new FabricaElectricista(responsable); FabricaBombero FBombero = new FabricaBombero(estrategia, pasto, responsable); crearHeroe(FElectricista).getPersonal().Revisar(esquina); crearHeroe(FBombero); }
public static void PatronSingleton() { IStrategy estrategia = new Secuencial(); Director director = new Director(); var builder = new BuilderFavorable(); Casa casa = new Casa(410, 9, 12, director, builder); Decorator pasto = new PastoSeco(casa.crearSector(1, 15, 10)); IResponsable responsable = null; FabricaBombero fabrica = new FabricaBombero(estrategia, pasto, responsable); crearHeroe(fabrica); CuartelDeBomberos cb = CuartelDeBomberos.getInstancia(); //cb.agregarHerramienta(fabrica.crearHerramienta()); //cb.agregarVehiculo(fabrica.crearVehiculo()); IResponsable b1 = cb.getPersonal(); IResponsable b2 = cb.getPersonal(); IResponsable b3 = cb.getPersonal(); IResponsable b4 = cb.getPersonal(); Console.WriteLine("El patron funciono"); }
public static void PatronIterator() { Director director = new Director(); var builder = new BuilderFavorable(); Casa casa = new Casa(10, 10, 10, director, builder); casa.Superficie = 4; casa.Calle = new Calle(10, 10, 5); IStrategy estrategia = new Secuencial(); Decorator pasto = new PastoSeco(casa.crearSector(10, 10, 10)); IResponsable responsable = null; FabricaBombero fabrica = new FabricaBombero(estrategia, pasto, responsable); BomberoSecretario bombero = new BomberoSecretario(); bombero.bombero.Herramienta = fabrica.crearHerramienta(); bombero.bombero.Vehiculo = fabrica.crearVehiculo(); DenunciaPorTablero tablero = new DenunciaPorTablero(); casa.agregar(tablero); casa.Chispa(); casa.Chispa(); bombero.atenderdenuncias(tablero); }