| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.Linq; |
| | 4 | |
|
| | 5 | | namespace Itinero.Indexes; |
| | 6 | |
|
| | 7 | | /// <summary> |
| | 8 | | /// Represents a mapping from attributes sets to sets that only keep useful attributes. |
| | 9 | | /// </summary> |
| | 10 | | public class AttributeSetMap |
| | 11 | | { |
| | 12 | | /// <summary> |
| | 13 | | /// Creates a new map. |
| | 14 | | /// </summary> |
| | 15 | | /// <param name="id">The id.</param> |
| 310 | 16 | | protected AttributeSetMap(Guid? id = null) |
| 310 | 17 | | { |
| 310 | 18 | | this.Id = id ?? Guid.Empty; |
| 310 | 19 | | } |
| | 20 | |
|
| | 21 | | /// <summary> |
| | 22 | | /// Gets the id. |
| | 23 | | /// </summary> |
| 1458 | 24 | | public Guid Id { get; protected set; } |
| | 25 | |
|
| | 26 | | /// <summary> |
| | 27 | | /// Maps the attribute set to a subset of the attributes keeping only the useful attributes. |
| | 28 | | /// </summary> |
| | 29 | | /// <param name="attributes">The attributes.</param> |
| | 30 | | /// <returns>A subset of attributes.</returns> |
| | 31 | | public virtual IEnumerable<(string key, string value)> Map(IEnumerable<(string key, string value)> attributes) |
| 97 | 32 | | { |
| 97 | 33 | | return Enumerable.Empty<(string key, string value)>(); |
| 97 | 34 | | } |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// A default empty map. |
| | 38 | | /// </summary> |
| | 39 | | public static AttributeSetMap Default() |
| 302 | 40 | | { |
| 302 | 41 | | return new AttributeSetMap(); |
| 302 | 42 | | } |
| | 43 | | } |