mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-21 20:46:28 +02:00
Version 3.0.364
This commit is contained in:
parent
91d42552c7
commit
0b9196a78d
91 changed files with 3452 additions and 555 deletions
|
@ -3,6 +3,9 @@ using TINK.Model.Stations.StationNS.Operator;
|
|||
|
||||
namespace TINK.Model.Stations.StationNS
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds station information, i.e. static information like station name, station position and dynamic information like bikes available.
|
||||
/// </summary>
|
||||
public interface IStation
|
||||
{
|
||||
/// <summary> Holds the unique id of the station.c</summary>
|
||||
|
@ -19,5 +22,12 @@ namespace TINK.Model.Stations.StationNS
|
|||
|
||||
/// <summary> Holds operator related data.</summary>
|
||||
IData OperatorData { get; }
|
||||
|
||||
/// <summary> Gets the count of bikes available at station. </summary>
|
||||
int? AvailableBikesCount { get; }
|
||||
|
||||
/// <summary> Gets bike <see cref="BikeGroupCol.Entry"/> objects. </summary>
|
||||
/// <remarks> Each entry has a name, holds the count of available bikes at station and the group value. /// </remarks>
|
||||
IBikeGroupCol BikeGroups { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,5 +20,12 @@ namespace TINK.Model.Stations.StationNS
|
|||
|
||||
/// <summary> Holds operator related data.</summary>
|
||||
public IData OperatorData => new Data();
|
||||
|
||||
/// <summary> Gets the count of bikes available at station. </summary>
|
||||
public int? AvailableBikesCount => null;
|
||||
|
||||
/// <summary> Gets bike <see cref="BikeGroupCol.Entry"/> objects. </summary>
|
||||
/// <remarks> Each entry has a name, holds the count of available bikes at station and the group value. /// </remarks>
|
||||
public IBikeGroupCol BikeGroups => null;
|
||||
}
|
||||
}
|
||||
|
|
49
TINKLib/Model/Stations/StationNS/Operator/BikeGroupCol.cs
Normal file
49
TINKLib/Model/Stations/StationNS/Operator/BikeGroupCol.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace TINK.Model.Stations.StationNS.Operator
|
||||
{
|
||||
public class BikeGroupCol : List<BikeGroupCol.Entry> , IBikeGroupCol
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds a group of bikes at a station.
|
||||
/// </summary>
|
||||
public class Entry
|
||||
{
|
||||
/// <summary>
|
||||
/// Bike group entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the group, either "Citybikes" or "Cargobikes".</param>
|
||||
/// <param name="availableCount"></param>
|
||||
/// <param name="group"></param>
|
||||
public Entry(string name, int? availableCount = null, string group = null)
|
||||
{
|
||||
Name = name;
|
||||
AvailableCount = availableCount ?? 0;
|
||||
Group = group ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name of the group, either "Citybikes" or "Cargobikes".
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary> Holds the count of bikes available of given type at station. </summary>
|
||||
public int AvailableCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the group of the bikes. Konrad separates cargo and city bikes by group.
|
||||
/// </summary>
|
||||
public string Group { get; }
|
||||
}
|
||||
|
||||
public BikeGroupCol() : base() { }
|
||||
|
||||
public BikeGroupCol(IEnumerable<Entry> source) : base(source) { }
|
||||
|
||||
/// <summary> Holds the count of bikes available of any type at station. </summary>
|
||||
public int AvailableCount => this.Select(x => x.AvailableCount).Sum();
|
||||
|
||||
}
|
||||
}
|
10
TINKLib/Model/Stations/StationNS/Operator/IBikeGroupCol.cs
Normal file
10
TINKLib/Model/Stations/StationNS/Operator/IBikeGroupCol.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace TINK.Model.Stations.StationNS.Operator
|
||||
{
|
||||
public interface IBikeGroupCol : IEnumerable<BikeGroupCol.Entry>
|
||||
{
|
||||
/// <summary> Holds the count of bikes available of given type at station. </summary>
|
||||
int AvailableCount { get; }
|
||||
}
|
||||
}
|
|
@ -14,16 +14,18 @@ namespace TINK.Model.Stations.StationNS
|
|||
/// <param name="stationName">Name of the station.</param>
|
||||
public Station(
|
||||
string id,
|
||||
IEnumerable<string> group,
|
||||
IPosition position,
|
||||
IEnumerable<string> group = null,
|
||||
IPosition position = null,
|
||||
string stationName = "",
|
||||
Data operatorData = null)
|
||||
IData operatorData = null,
|
||||
IBikeGroupCol bikeGropCol = null)
|
||||
{
|
||||
Id = id;
|
||||
Group = group ?? throw new ArgumentException("Can not construct station object. Group of stations must not be null.");
|
||||
Position = position;
|
||||
StationName = stationName ?? string.Empty;
|
||||
OperatorData = operatorData ?? new Data();
|
||||
BikeGroups = bikeGropCol ?? new BikeGroupCol();
|
||||
}
|
||||
|
||||
/// <summary> Holds the unique id of the station.c</summary>
|
||||
|
@ -40,5 +42,12 @@ namespace TINK.Model.Stations.StationNS
|
|||
|
||||
/// <summary> Holds operator related info.</summary>
|
||||
public IData OperatorData { get; }
|
||||
|
||||
/// <summary> Gets the count of bikes available at station. </summary>
|
||||
public int? AvailableBikesCount => BikeGroups.AvailableCount;
|
||||
|
||||
/// <summary> Gets bike <see cref="BikeGroupCol.Entry"/> objects. </summary>
|
||||
/// <remarks> Each entry has a name, holds the count of available bikes at station and the group value. /// </remarks>
|
||||
public IBikeGroupCol BikeGroups { get; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue