using System.Collections.Generic; using System.Linq; namespace TINK.Model.Stations.StationNS.Operator { public class BikeGroupCol : List , IBikeGroupCol { /// /// Holds a group of bikes at a station. /// public class Entry { /// /// Bike group entry. /// /// Name of the group, either "Citybikes" or "Cargobikes". /// /// public Entry(string name, int? availableCount = null, string group = null) { Name = name; AvailableCount = availableCount ?? 0; Group = group ?? string.Empty; } /// /// Name of the group, either "Citybikes" or "Cargobikes". /// public string Name { get; } /// Holds the count of bikes available of given type at station. public int AvailableCount { get; } /// /// Holds the group of the bikes. Konrad separates cargo and city bikes by group. /// public string Group { get; } } public BikeGroupCol() : base() { } public BikeGroupCol(IEnumerable source) : base(source) { } /// Holds the count of bikes available of any type at station. public int AvailableCount => this.Select(x => x.AvailableCount).Sum(); } }