private void CalculateCapacityDelta(TimeSpan time) { WeightPoint wp = new WeightPoint { time = time.TotalSeconds, capacity = _cargoManager.CurrentCapacity / _cargoManager.TotalCapacity }; if (addedWeightPoints < MaxWeightPoints) { _weightPoints[addedWeightPoints] = wp; addedWeightPoints++; CapacityDelta = 0; } else { for (int n = 1; n < MaxWeightPoints; n++) { _weightPoints[n - 1] = _weightPoints[n]; } _weightPoints[MaxWeightPoints - 1] = wp; float capacityIncrease = (float)(_weightPoints[MaxWeightPoints - 1].capacity - _weightPoints[0].capacity); float timeIncrease = (float)(_weightPoints[MaxWeightPoints - 1].time - _weightPoints[0].time); CapacityDelta = capacityIncrease / timeIncrease; } }
/// <summary>Служит хэш-функцией по умолчанию.</summary> /// <returns>Хэш-код для текущего объекта.</returns> public override int GetHashCode() { unchecked { var hashCode = ActNumber; hashCode = (hashCode * 397) ^ (ActDateTime != null ? ActDateTime.GetHashCode() : 0); hashCode = (hashCode * 397) ^ PpvkNumber; hashCode = (hashCode * 397) ^ (WeightPoint != null ? WeightPoint.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Weighter != null ? Weighter.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Vehicle != null ? Vehicle.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Driver != null ? Driver.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Cargo != null ? Cargo.GetHashCode() : 0); return(hashCode); } }
public async Task AddWeightPointAsync(Guid userId, DateTime weightDate, int weight) { WeightPoint weightPoint = WeightPoint.Create(userId, weight, weightDate); await _weightPointRepository.AddAsync(weightPoint); }
public void CreateDataStart(int floorNum) { this.floorNum = floorNum; nowWeightPoint = new WeightPoint(); mode = MakeMode.MakeDataMode; areaDataList = new List<AreaData>(); enemyDataList = new List<EnemyPositionData>(); MakeUpPoint(); }
public void CreateStart() { nowWeightPoint = new WeightPoint(); mode = MakeMode.MakeSceneMode; MakeUpPoint(); }
public async Task AddAsync(WeightPoint weightPoint) { await _context.WeightPoints.AddAsync(weightPoint); await _context.SaveChangesAsync(); }