You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to include Alloy as a new "backend interpreter" for my telegram bot (https://github.com/swamp-agr/proof-assistant-bot/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.
Meantime I realised that Alloy by default is a GUI app and it was not convenient to use it on server remotely.
So I decided to play with Alloy API and examples and see where it leads me.
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.
I took your example ExampleUsingTheCompiler in the beginning.
I managed to detach Alloy VizState (see BackgroundState) from the main AWT UI thread and its event loop.
In order to generate graph I had to modify StaticGraphMaker (see SilentGraphMaker). However, some Java Swing/AWT UI primitives forced CLI script to make an attempt to render GUI window. Of course, without parent JPanel 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.
It turned out that DotStyle and DotShape have javax.swing.Icon as private class propertiy and they force UI window rendering because of Icon usage.
Also all the stuff below that used in Graph, GraphNode and GraphEdge classes to draw diagram on JPanel triggered UI window rendering:
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
Since all those classes were final and their internals were private 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.
I do realise that if you want to have the feature in the upstream you cannot just use the code from my gist. You will need some Graph interfaces and separate implementations for GUI/DOT/PDF/....
I have only 15 minutes per day and with my previous experience it will take more than three months to prepare the patch for you. And I think, two more months to pass the review for pull request. I am afraid, I cannot be any more help to you.
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
The text was updated successfully, but these errors were encountered:
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.
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
The text was updated successfully, but these errors were encountered: