BridgesUNCC / bridges-java

JAVA Client library for Bridges
http://bridgesuncc.github.io
GNU General Public License v2.0
4 stars 12 forks source link

Multilists added to bridges. #102

Closed krs-world closed 7 years ago

krs-world commented 7 years ago

I have added MLElement (multi-list) element type to Bridges. The data structure type is MultiList and will be reflected in the 'visual' attribute. An example JSON of a multi list is as follows:

{"name": "edu.uncc.cs.bridges","version": "0.4.0","visual": "MultiList","title": "A Trivial Multilist Example","description": "","nodes": [{"name":"0","shape":"circle","size":40.0,"color":[255,0,0,1.0]},{"name":"1","shape":"circle","size":10.0,"color":[70,130,180,1.0]},{"name":"2","shape":"square","size":10.0,"color":[255,0,0,1.0]},{"name":"4","shape":"circle","size":10.0,"color":[70,130,180,1.0]},{"name":"5","shape":"circle","size":10.0,"color":[70,130,180,1.0]},{"name":"6","shape":"circle","size":10.0,"color":[70,130,180,1.0]},{"name":"3","shape":"square","size":10.0,"color":[255,0,0,1.0]},{"name":"7","shape":"circle","size":10.0,"color":[70,130,180,1.0]},{"name":"8","shape":"circle","size":10.0,"color":[70,130,180,1.0]}], "links": [{"color":[255,0,0,1.0],"thickness":3.0,"name":1.0,"source":0,"target":1},{"color":[0,0,255,1.0],"thickness":3.0,"name":1.0,"source":1,"target":2},{"color":[70,130,180,1.0],"thickness":1.0,"name":1.0,"source":2,"target":3},{"color":[70,130,180,1.0],"thickness":1.0,"name":1.0,"source":3,"target":4},{"color":[70,130,180,1.0],"thickness":1.0,"name":1.0,"source":4,"target":5},{"color":[0,255,255,1.0],"thickness":3.0,"name":1.0,"source":2,"target":6},{"color":[70,130,180,1.0],"thickness":1.0,"name":1.0,"source":6,"target":7},{"color":[70,130,180,1.0],"thickness":1.0,"name":1.0,"source":7,"target":8}]}

So the JSON should look similar to a singly linked list, except that you can have more than link from a node (when you have sublists); Each node can start a new sublist (getSubList()/setSubList()) and the element will continue to have the next field as in a singly linked list.

We need to modify the Bridges server to handle this particular type. It should process it exactly like a singly linked list (or graph is more accurate, except this version is acyclic). Amazingly, the current server seems to have no trouble processing and creating the visualization(which is bad!) It should have thrown an error if it found an unsupported type!) See the visualization at

http://bridges-cs.herokuapp.com/assignments/33/kalpathi60