示例#1
0
 public FloorSpec(string tag, IEnumerable <RoomSpecs> rooms, IEnumerable <ToiletSpec> toilet, IEnumerable <BathRoomSpec> baths, KitchenSpec kitchen)
 {
     Tag       = tag;
     Rooms     = rooms;
     Toilets   = toilet;
     BathRooms = baths;
     Kitchen   = kitchen;
 }
示例#2
0
        public Construction WithFloor(string floorTag, string floor, int room, string roomprefix, int toilet, string toiletprefix, int baths, string bathprefix, string kitTag)
        {
            var rooms     = new List <RoomSpecs>();
            var toilets   = new List <ToiletSpec>();
            var bathrooms = new List <BathRoomSpec>();

            for (var i = 0; i <= room; ++i)
            {
                rooms.Add(new RoomSpecs {
                    Tag = roomprefix + i.ToString("00")
                });
            }
            for (var i = 0; i <= toilet; ++i)
            {
                var tolet = new ToiletSpec
                {
                    Tag = toiletprefix + floor + i.ToString("00")
                };
                tolet.Sensors = new List <SensorSpec>(new[]
                {
                    new SensorSpec($"{tolet.Tag}", "Dirt"),
                    new SensorSpec($"{tolet.Tag}", "Smell"),
                    new SensorSpec($"{tolet.Tag}", "Flush")
                });
                toilets.Add(tolet);
            }
            for (var i = 0; i <= baths; ++i)
            {
                var bath = new BathRoomSpec
                {
                    Tag = bathprefix + floor + i.ToString("00")
                };
                bath.Sensors = new List <SensorSpec>(new[]
                {
                    new SensorSpec($"{bath.Tag}_A", "Dirt"),
                    new SensorSpec($"{bath.Tag}_B", "Dirt"),
                    new SensorSpec($"{bath.Tag}", "Smell")
                });
                bathrooms.Add(bath);
            }
            var kitchen = new KitchenSpec
            {
                Tag = kitTag + floor
            };

            kitchen.Sensors = new List <SensorSpec>(new[]
            {
                new SensorSpec($"{kitchen.Tag}_A", "Dirt"),
                new SensorSpec($"{kitchen.Tag}_B", "Dirt"),
                new SensorSpec($"{kitchen.Tag}", "Smell")
            });
            Floors.Add(new FloorSpec(floorTag, rooms, toilets, bathrooms, kitchen));
            return(this);
        }