Example #1
0
        public Place Construct(Dictionary <string, string> placeParams, ThingsOfFoi thingsOfFoi)
        {
            Foi foi = Foi.GetInstance();

            RandomGeneratorFacade randomGeneratorFacade = new RandomGeneratorFacade();

            if (DoesPlaceExists(Converter.StringToInt(placeParams["id"]), foi))
            {
                Console.WriteLine("Mjesto sa identifikatorom: " + placeParams["id"] + "(" + placeParams["naziv"] + ") vec postoji, preskacem!");
                return(null);
            }

            return(_builder
                   .SetUniqueIdentifier(Converter.StringToInt(placeParams["id"]))
                   .SetName(placeParams["naziv"])
                   .SetType(Converter.StringToInt(placeParams["tip"]))
                   .SetNumberOfSensors(Converter.StringToInt(placeParams["broj senzora"]))
                   .SetNumberOfActuators(Converter.StringToInt(placeParams["broj aktuatora"]))
                   .Build());
        }
Example #2
0
 public static Foi GetInstance()
 {
     return(_foi ?? (_foi = new Foi()));
 }
Example #3
0
 private bool DoesPlaceExists(int?placeId, Foi foi)
 {
     return(foi.Places.Any(p => p.UniqueIdentifier == placeId));
 }