Small improvements

This commit is contained in:
Pieter Vander Vennet 2021-05-12 13:28:36 +02:00
parent 6cefdf5602
commit 49979c2072
2 changed files with 19 additions and 5 deletions

View file

@ -93,7 +93,7 @@ namespace AspectedRouting
private static void Repl(Context c, Dictionary<string, ProfileMetaData> profiles)
{
var profile = profiles["bicycle"];
var profile = profiles["emergency_vehicle"];
var behaviour = profile.Behaviours.Keys.First();
do
{
@ -130,12 +130,13 @@ namespace AspectedRouting
if (beh.Contains("."))
{
var profileName = beh.Split(".")[0];
if (!profiles.TryGetValue(profileName, out profile))
if (!profiles.TryGetValue(profileName, out var newProfile))
{
Console.Error.WriteLine("Profile " + profileName + " not found, ignoring");
continue;
}
profile = newProfile;
beh = beh.Substring(beh.IndexOf(".") + 1);
}

View file

@ -18,15 +18,28 @@ namespace AspectedRouting.Tests
PriorityExplanation = priorityExplanation;
}
private static string str(string s)
{
if (s == null) {
return "<null>";
}
if (s == "") {
return "<empty string>";
}
return s;
}
public override string ToString()
{
return string.Join("\n ",
"access "+Access,
"oneway "+Oneway,
" access "+str(Access),
"oneway "+str(Oneway),
"speed "+Speed,
"priority "+Priority,
"because \n "+PriorityExplanation
"because \n "+str(PriorityExplanation)
);
}
}