Open swamp-agr opened 1 year ago
Since yesterday Alloy 6 is generating images (for model instances) and GIFs (for temporal models) via both Telegram Bot interface and CLI Wrapper described in a previous message.
You can probably add it to your show cases.
Hello,
Hope you are doing well.
Summary
Please find attached the link to CLI script for generating DOT files for model instances without triggering any GUI at all: https://gist.github.com/swamp-agr/560f0d9bf8dc034f99d6055a5a197285 (logic located below L2040).
Comments are welcome.
Motivation
sorry, it is not there yet. Upd. it is there! now it is generating images and GIFs out of model instances) and, therefore, to provide basic IRC-like interface to it.Implementation
Disclaimer: I am not Java programmer and, to be honest, I am not familiar with OOP. I wrote some Java code in the past but it was too long ago. Now I am using Haskell for my job and also in my spare time.
ExampleUsingTheCompiler
in the beginning.VizState
(seeBackgroundState
) from the main AWT UI thread and its event loop.StaticGraphMaker
(seeSilentGraphMaker
). However, some Java Swing/AWT UI primitives forced CLI script to make an attempt to render GUI window. Of course, without parentJPanel
it didn't work out and when script terminated the window was closed. Anyway, it was annoying and it impacted the overall time of script.DotStyle
andDotShape
havejavax.swing.Icon
as private class propertiy and they force UI window rendering because ofIcon
usage.Graph
,GraphNode
andGraphEdge
classes to draw diagram onJPanel
triggered UI window rendering:Result
By making local copies of mentioned classes and removing all that Swing/AWT stuff (except
java.awt.Color
) I was able to draw DOT file and produce the plot.Before:
After:
Conclusions
final
and their internals wereprivate
I cannot easily extend/implement those classes to disable GUI and its primitives. The only way for me was to rewrite the code to get DOT as soon as possible. So now I am able to continue working on adding Alloy (via its very primitive CLI Wrapper) to the bot.Nevertheless, thank you for your great work! It was quite fun to play with the Alloy app and with Alloy API too. 😄
Feel free to close the issue if you decide not to have such a feature in upstream.
Best Regards, Andrey