Implemented all functions for BuildingInformation.cs
This commit is contained in:
parent
d2c41943f6
commit
e5d6fee9dc
1 changed files with 15 additions and 6 deletions
|
|
@ -22,8 +22,7 @@ public sealed class BuildingInformation
|
||||||
/// Returns all floors in the building
|
/// Returns all floors in the building
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A list of available floors</returns>
|
/// <returns>A list of available floors</returns>
|
||||||
// TODO
|
public List<Floor> GetFloorSelection() => _companiesPerFloor.GetKeys();
|
||||||
public List<Floor> GetFloorSelection() => new();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns all companies residing on a specific floor.
|
/// Returns all companies residing on a specific floor.
|
||||||
|
|
@ -31,8 +30,11 @@ public sealed class BuildingInformation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="floor">The floor to check</param>
|
/// <param name="floor">The floor to check</param>
|
||||||
/// <returns>A list of names of companies residing on the provided floor</returns>
|
/// <returns>A list of names of companies residing on the provided floor</returns>
|
||||||
// TODO
|
public List<string>? GetCompaniesOnFloor(Floor floor)
|
||||||
public List<string>? GetCompaniesOnFloor(Floor floor) => null;
|
{
|
||||||
|
_companiesPerFloor.TryGetValue(floor, out MyDictionary<string, Company>? companies);
|
||||||
|
return companies?.GetKeys();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the company identified by floor and company name.
|
/// Returns the company identified by floor and company name.
|
||||||
|
|
@ -41,6 +43,13 @@ public sealed class BuildingInformation
|
||||||
/// <param name="floor">Floor to look at</param>
|
/// <param name="floor">Floor to look at</param>
|
||||||
/// <param name="companyName">Name of the requested company</param>
|
/// <param name="companyName">Name of the requested company</param>
|
||||||
/// <returns>Company information if found; null otherwise</returns>
|
/// <returns>Company information if found; null otherwise</returns>
|
||||||
// TODO
|
public Company? GetCompany(Floor floor, string companyName)
|
||||||
public Company? GetCompany(Floor floor, string companyName) => null;
|
{
|
||||||
|
//Needed to declare here, else you get an initialization error
|
||||||
|
Company? company = null;
|
||||||
|
|
||||||
|
_companiesPerFloor.TryGetValue(floor, out MyDictionary<string, Company>? companies);
|
||||||
|
companies?.TryGetValue(companyName, out company);
|
||||||
|
return company;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue