//Function to check if a big is in the history
 public bool IsInHistory(BaggageItem bag)
 {
     //Only checks for the bag within a certain range dictated by the invalid range parameter. This is to ensure that previous combinations can occur again, just that they don't occur until a certain
     //Quantity of bags have been spawned
     if (bagHistory.Count > invalidRange)
     {
         //Simple search returning true if the parameters of the bag match a bag within the history list
         for (int i = bagHistory.Count - 1; i > bagHistory.Count - invalidRange; i--)
         {
             if ((bagHistory[i].bagCol == bag.bagCol) && (bagHistory[i].bagModel == bag.bagModel) && (bagHistory[i].bagTex == bag.bagTex))
             {
                 return(true);
             }
         }
     }
     else
     {//Same procedure but for cases in which the history is smaller than the invalid range(usually at the start of the game)
         for (int i = bagHistory.Count - 1; i > -1; i--)
         {
             if ((bagHistory[i].bagCol == bag.bagCol) && (bagHistory[i].bagModel == bag.bagModel) && (bagHistory[i].bagTex == bag.bagTex))
             {
                 return(true);
             }
         }
     }//If it is not found at all, return false
     return(false);
 }
Beispiel #2
0
 /// <summary>
 /// Apply the specified bag.
 /// </summary>
 /// <returns>The apply.</returns>
 /// <param name="bag">Bag.</param>
 void Apply(BaggageItem bag)
 {
     Title     = "Baggage Id#: " + bag.BaggageId;
     BaggageId = bag.BaggageId;
     Weight    = bag.Weight;
     Status    = bag.Status;
     BagId     = bag.Id;
 }
Beispiel #3
0
        public static async Task InsertBags(Flight f)
        {
            // create bags
            for (int i = 0; i < 10; i++)
            {
                var bag = new BaggageItem()
                {
                    //Set properties on bags at checkin
                    FlightNumber      = f.FlightNumber,
                    BaggageId         = i.ToString(),
                    Weight            = BagWeight + Rand.NextDouble() * 15,
                    Status            = "Checked In",
                    LastScanned       = DateTime.Now,
                    LastKnownLocation = "SFO",
                    Destination       = "SEA",
                    Departure         = "SFO"
                };

                await CosmosDataService.Instance("BagCollection").InsertItemAsync(bag);
            }
        }
Beispiel #4
0
 public IEnumerable <KeyValuePair <string, string> > GetBaggageItems() => BaggageItem.ToConvert(BaggageItems);
Beispiel #5
0
 public SpanContext(ISpanContext ctx)
 {
     TraceId      = ctx.TraceId;
     SpanId       = ctx.SpanId;
     BaggageItems = BaggageItem.ToConvert(ctx.GetBaggageItems());
 }
 //Add a new bag to the list
 public void AddToHistory(BaggageItem bag)
 {
     bagHistory.Add(bag);
 }