| | | 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> |
| | 336 | 16 | | protected AttributeSetMap(Guid? id = null) |
| | 336 | 17 | | { |
| | 336 | 18 | | this.Id = id ?? Guid.Empty; |
| | 336 | 19 | | } |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Gets the id. |
| | | 23 | | /// </summary> |
| | 1593 | 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) |
| | 104 | 32 | | { |
| | 104 | 33 | | return Enumerable.Empty<(string key, string value)>(); |
| | 104 | 34 | | } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// A default empty map. |
| | | 38 | | /// </summary> |
| | | 39 | | public static AttributeSetMap Default() |
| | 328 | 40 | | { |
| | 328 | 41 | | return new AttributeSetMap(); |
| | 328 | 42 | | } |
| | | 43 | | } |