예제 #1
0
 //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);
 }
예제 #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;
            }
        }
예제 #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);
            }
        }
예제 #4
0
        //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));
            }
        }