weightedWalkableToString static method
- WeightedWalkable<
Object?> walkable, [ - String start = '{',
- String end = '}'
Converts a WeightedWalkable to a string like toString.
Allows using other delimiters than {
and }
.
Implementation
static String weightedWalkableToString(
WeightedWalkable<Object?> walkable, [
String start = '{',
String end = '}',
]) {
final buffer = StringBuffer(start);
if (walkable.isEmpty) {
buffer.write(end);
return buffer.toString();
}
buffer.writeln();
for (final source in walkable.roots) {
buffer.write(' $source -> ');
buffer.writeAll(
walkable.successors(source).map((pair) {
return '${pair.$1} <${pair.$2}>';
}),
', ',
);
buffer.writeln();
}
buffer.write(end);
return buffer.toString();
}