Extract railroad generator to reusable class #14
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's my proposal for a Java API for railroad diagram generation. So why should RR have one? Personally, I plan to use it to create a Maven plugin for RR, but I imagine that having a Java API could make RR useful for a wide variety of other applications.
Notes
master
.RailroadGenerator
class uses the same default settings as the CLI.RailroadGenerator
class is free of CLI-specific assumptions and defaults:java.awt.Color
values instead of a hex strings.Railroad
.System.out
even inRailroadGenerator
, not only set by the CLI. The reason is that I'm not yet sure how the API for specifying outputs should look like.Caveats
RailroadGenerator
class are not implemented in that class, but in the XQuery files. This leads to some ambiguities regardingnull
. However, I think those are not really relevant.usage()
does not list thepadding
andstrokewidth
CLI options. I didn't change that as doing so is arguably not within the scope of this PR. Also, the omission may have been intentional.Looking forward to reading your opinion on this! I hope you find this work acceptable - if not, please just tell me what to change.