Grabacr07.KanColleWrapper.Models.FleetState.Calculate C# (CSharp) Method

Calculate() private method

艦隊の平均レベルや制空戦力などの各種数値を再計算します。
private Calculate ( ) : void
return void
        internal void Calculate()
        {
            var ships = this.source.SelectMany(x => x.Ships).WithoutEvacuated().ToArray();

            this.TotalLevel = ships.HasItems() ? ships.Sum(x => x.Level) : 0;
            this.AverageLevel = ships.HasItems() ? (double)this.TotalLevel / ships.Length : 0.0;
            this.AirSuperiorityPotential = ships.Sum(s => s.CalcAirSuperiorityPotential());
            this.Speed = ships.All(x => x.Info.Speed == ShipSpeed.Fast)
                ? FleetSpeed.Fast
                : ships.All(x => x.Info.Speed == ShipSpeed.Low)
                    ? FleetSpeed.Low
                    : FleetSpeed.Hybrid;

            var logic = ViewRangeCalcLogic.Get(KanColleClient.Current.Settings.ViewRangeCalcType);
            this.ViewRange = logic.Calc(ships.ToArray());
            this.ViewRangeCalcType = logic.Name;

            if (this.Calculated != null)
            {
                this.Calculated(this, new EventArgs());
            }
        }