diff options
author | Adhitya Kamakshidasan | 2016-07-12 18:44:25 +0530 |
---|---|---|
committer | GitHub | 2016-07-12 18:44:25 +0530 |
commit | 42947d4f4d20c8e9e5188eba7952a370521231b5 (patch) | |
tree | 6a759f5ee624cf67f541c5911122ce0213177936 /dependencies.js | |
parent | 2231aaca492df503a942b40a0a6375638362c119 (diff) | |
parent | 1924bdc29c3b265ccb4c89d4245d2248ae13b545 (diff) | |
download | xcos-on-web-42947d4f4d20c8e9e5188eba7952a370521231b5.tar.gz xcos-on-web-42947d4f4d20c8e9e5188eba7952a370521231b5.tar.bz2 xcos-on-web-42947d4f4d20c8e9e5188eba7952a370521231b5.zip |
Merge pull request #174 from sarangsingh29/master
four blocks
Diffstat (limited to 'dependencies.js')
-rw-r--r-- | dependencies.js | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/dependencies.js b/dependencies.js index 89363d1..9e5857c 100644 --- a/dependencies.js +++ b/dependencies.js @@ -15,7 +15,7 @@ $.ajax({ url: "/data_structures_correct/" }, success: function (data) { - + // @Parameter: data will have the required filenames in the mentioned folder // For each url, add the script to the body div element with getScript function for (i in data) { @@ -25,6 +25,47 @@ $.ajax({ }); */ +// Added to handle ordering for a few blocks. + +window.inBitMap='0'; +window.outBitMap='0'; + +String.prototype.replaceAt=function(index, character) { + return this.substr(0, index) + character + this.substr(index+character.length); +} + +/* + Maverick, Adhitya + ImplicitInBlock, ImplicitOutBlock, ExplicitInBlock, ExplicitOutBlock + These blocks need their orderings to be handled. + We are using a bitmap to do the same. +*/ + +function handleOrdering(inOrOut){ + var bitmap; + if(inOrOut=='in'){ + bitmap=window.inBitMap; + } + else{ + bitmap=window.outBitMap; + } + var index = bitmap.indexOf('0'); + if(index == -1){ + bitmap += '0'; + index = bitmap.indexOf('0'); + } + bitmap = bitmap.replaceAt(index,'1'); + if(inOrOut=='in'){ + window.inBitMap=bitmap; + } + else{ + window.outBitMap=bitmap; + } + var position = 1+index; + + return position; +} + function AfficheBlock() { if (arguments.length > 0) { var options = arguments[0]; @@ -682,7 +723,7 @@ function ImplicitOutBlock() { this.dependsOnT = "1"; this.id = options.id; this.interfaceFunctionName = arguments.callee.caller.name; - this.ordering = options.ordering; + this.ordering = handleOrdering('out'); this.parent = options.parent; if (options.model.sim instanceof Array) { this.simulationFunctionName = getData(options.model.sim[0])[0]; @@ -767,7 +808,7 @@ function ImplicitInBlock() { this.dependsOnT = "1"; this.id = options.id; this.interfaceFunctionName = arguments.callee.caller.name; - this.ordering = options.ordering; + this.ordering = handleOrdering('in'); this.parent = options.parent; if (options.model.sim instanceof Array) { this.simulationFunctionName = getData(options.model.sim[0])[0]; @@ -847,7 +888,7 @@ function ExplicitInBlock() { this.connectable = options.connectable; // Not Known this.id = options.id; this.interfaceFunctionName = arguments.callee.caller.name; - this.ordering = options.ordering; + this.ordering = handleOrdering('in'); this.parent = options.parent; if (options.model.sim instanceof Array) { this.simulationFunctionName = getData(options.model.sim[0])[0]; @@ -919,6 +960,7 @@ function ExplicitInBlock() { } } + function ExplicitOutBlock() { if (arguments.length > 0) { var options = arguments[0]; @@ -927,7 +969,7 @@ function ExplicitOutBlock() { this.connectable = options.connectable; // Not Known this.id = options.id; this.interfaceFunctionName = arguments.callee.caller.name; - this.ordering = options.ordering; + this.ordering = handleOrdering('out'); this.parent = options.parent; if (options.model.sim instanceof Array) { this.simulationFunctionName = getData(options.model.sim[0])[0]; @@ -1306,7 +1348,7 @@ function inverse() { function _str2code() { var conversion = "0123456789abcdefghijklmnopqrstuvwxyz_#!$ ();:+-*/\\=.,'[]%|&<>~^"; - var conversion2 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ00?0 00000000$000\"{}000`0@0r"; + var conversion2 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ00?0 00000000$000\"{}000`0@0r"; var str = arguments[0]; var code = []; for (var i = 0; i < str.length; i++) { |