42 lines
872 B
C#
42 lines
872 B
C#
namespace OSMServer;
|
|
|
|
public class Connection
|
|
{
|
|
public Coordinates end { get; }
|
|
|
|
private Dictionary<string, string> tags;
|
|
|
|
|
|
public Connection(Coordinates end)
|
|
{
|
|
this.end = end;
|
|
this.tags = new Dictionary<string, string>();
|
|
}
|
|
|
|
public Connection(Coordinates end, Dictionary<string, string> tags)
|
|
{
|
|
this.end = end;
|
|
this.tags = tags;
|
|
}
|
|
|
|
public bool AddTag(string key, string value)
|
|
{
|
|
return this.tags.TryAdd(key, value);
|
|
}
|
|
|
|
public string? TryGetTagValue(string key)
|
|
{
|
|
return this.tags.ContainsKey(key) ? this.tags[key] : null;
|
|
}
|
|
|
|
public bool ContainsTag(string key)
|
|
{
|
|
return this.tags.ContainsKey(key);
|
|
}
|
|
|
|
public void UpdateTag(string key, string value)
|
|
{
|
|
if(!this.AddTag(key, value))
|
|
this.tags[key] = value;
|
|
}
|
|
} |