public CyclocityStationData Generate(CyclocityStationData station)
            {
                int _availableBikesChange;

                if (_Random.Next(_TimeFactor) == 0)
                {
                    var _rnd = _Random.Next(3);
                    if (_rnd == 1 || (_rnd == 0 && _Trend == 1))
                    {
                        _availableBikesChange = -_Random.Next(0, Math.Min(station.AvailableBikes, 5));
                        _Trend = 1;
                    }
                    else
                    {
                        _availableBikesChange = _Random.Next(0, Math.Min(station.BikeStands - station.AvailableBikes, 5));
                        _Trend = -1;
                    }
                }
                else
                {
                    _availableBikesChange = 0;
                }

                return(station
                       .WithAvailableBikes(station.AvailableBikes + _availableBikesChange)
                       .WithAvailableBikeStands(station.AvailableBikeStands + (_availableBikesChange * -1)));
            }
Beispiel #2
0
 private CyclocityStationData _ToStation(DateTimeOffset dataUpdated, dynamic stationData)
 {
     return(CyclocityStationData.Create(
                number: (int)stationData.number,
                name: (string)stationData.name,
                address: (string)stationData.address,
                positionLatitude: (double)stationData.position.lat,
                positoinLongitude: (double)stationData.position.lng,
                banking: (bool)stationData.banking,
                bonus: (bool)stationData.bonus,
                status: (string)stationData.status,
                contractName: (string)stationData.contract_name,
                bikeStands: (int)stationData.bike_stands,
                availableBikeStands: (int)stationData.available_bike_stands,
                availableBikes: (int)stationData.available_bikes,
                dataUpdated: dataUpdated));
 }
 public CyclocityStationData WithAvailableBikes(int @availableBikes)
 {
     var _instance = new CyclocityStationData(Number, Name, Address, PositionLatitude, PositoinLongitude, Banking, Bonus, Status, ContractName, BikeStands, AvailableBikeStands, @availableBikes, DataUpdated);
     return _instance;
 }
 public static CyclocityStationData Create(int @number, string @name, string @address, double @positionLatitude, double @positoinLongitude, bool @banking, bool @bonus, string @status, string @contractName, int @bikeStands, int @availableBikeStands, int @availableBikes, DateTimeOffset @dataUpdated)
 {
     var _instance = new CyclocityStationData(@number, @name, @address, @positionLatitude, @positoinLongitude, @banking, @bonus, @status, @contractName, @bikeStands, @availableBikeStands, @availableBikes, @dataUpdated);
     return _instance;
 }
            public CyclocityStationData Generate(CyclocityStationData station)
            {
                int _availableBikesChange;
                if (_Random.Next(_TimeFactor) == 0)
                {
                    var _rnd = _Random.Next(3);
                    if (_rnd == 1 || (_rnd == 0 && _Trend == 1))
                    {
                        _availableBikesChange = -_Random.Next(0, Math.Min(station.AvailableBikes, 5));
                        _Trend = 1;
                    }
                    else
                    {
                        _availableBikesChange = _Random.Next(0, Math.Min(station.BikeStands - station.AvailableBikes, 5));
                        _Trend = -1;
                    }
                }
                else
                {
                    _availableBikesChange = 0;
                }

                return station
                    .WithAvailableBikes(station.AvailableBikes + _availableBikesChange)
                    .WithAvailableBikeStands(station.AvailableBikeStands + (_availableBikesChange * -1));
            }
Beispiel #6
0
        public CyclocityStationData WithBikeStands(int @bikeStands)
        {
            var _instance = new CyclocityStationData(Number, Name, Address, PositionLatitude, PositoinLongitude, Banking, Bonus, Status, ContractName, @bikeStands, AvailableBikeStands, AvailableBikes, DataUpdated);

            return(_instance);
        }
Beispiel #7
0
        public static CyclocityStationData Create(int @number, string @name, string @address, double @positionLatitude, double @positoinLongitude, bool @banking, bool @bonus, string @status, string @contractName, int @bikeStands, int @availableBikeStands, int @availableBikes, DateTimeOffset @dataUpdated)
        {
            var _instance = new CyclocityStationData(@number, @name, @address, @positionLatitude, @positoinLongitude, @banking, @bonus, @status, @contractName, @bikeStands, @availableBikeStands, @availableBikes, @dataUpdated);

            return(_instance);
        }