//returns the value for a statistics type for an airline for a year
 public double getStatisticsValue(int year, Airline airline, StatisticsType type)
 {
     if (this.Stats.ContainsKey(year))
     {
         AirportStatisticsValue value = this.Stats[year].Find(asv => asv.Airline == airline && asv.Stat == type);
         if (value != null)
         {
             return(value.Value);
         }
     }
     return(0);
 }
Beispiel #2
0
        //adds the value for a statistics type to an airline for a year
        public void addStatisticsValue(int year, Airline airline, StatisticsType type, int value)
        {
            AirportStatisticsValue item = this.Stats.Find(s => s.Year == year && s.Airline == airline && s.Stat.Shortname == type.Shortname);

            if (item == null)
            {
                this.Stats.Add(new AirportStatisticsValue(airline, year, type, value));
            }
            else
            {
                item.Value += value;
            }
        }
Beispiel #3
0
        //returns the value for a statistics type for an airline for a year
        public double getStatisticsValue(int year, Airline airline, StatisticsType type)
        {
            AirportStatisticsValue item = this.Stats.Find(s => s.Year == year && s.Airline == airline && s.Stat.Shortname == type.Shortname);

            if (item == null)
            {
                return(0);
            }
            else
            {
                return(item.Value);
            }
        }
        //sets the value for a statistics type for an airline for a year
        public void setStatisticsValue(int year, Airline airline, StatisticsType type, int value)
        {
            if (!(this.Stats.ContainsKey(year)))
            {
                this.Stats.Add(year, new List <AirportStatisticsValue>());
            }
            AirportStatisticsValue statValue = this.Stats[year].Find(asv => asv.Airline == airline && asv.Stat == type);

            if (statValue != null)
            {
                statValue.Value = value;
            }
            else
            {
                this.Stats[year].Add(new AirportStatisticsValue(airline, type, value));
            }
        }