Commit 3cedc95c7190204af4e7ff0a10cac73d4b9e43d2
1 parent
429f876c
Exists in
master
and in
95 other branches
Fix functions definition
Showing
4 changed files
with
10 additions
and
11 deletions
Show diff stats
generic_data/Functions/constants.xml
1 | <?xml version="1.0"?> | 1 | <?xml version="1.0"?> |
2 | -<constants> | 2 | +<constants xml:id="constants"> |
3 | <constant info="astronomical unit" name="AU" units="m" kind="space">1.49598e+11</constant> | 3 | <constant info="astronomical unit" name="AU" units="m" kind="space">1.49598e+11</constant> |
4 | <constant info="Boltzmann constant" name="k" units="J/K" kind="physics">1.38054e-23</constant> | 4 | <constant info="Boltzmann constant" name="k" units="J/K" kind="physics">1.38054e-23</constant> |
5 | <constant info="kelvin to electron-volt" name="K2eV" units="eV/K" kind="units">8.622e-5</constant> | 5 | <constant info="kelvin to electron-volt" name="K2eV" units="eV/K" kind="units">8.622e-5</constant> |
generic_data/Functions/functions.xml
1 | <?xml version="1.0"?> | 1 | <?xml version="1.0"?> |
2 | -<functions> | 2 | +<functions xml:id="functions"> |
3 | <function name="mean_(,)" args="1" kind="time"> | 3 | <function name="mean_(,)" args="1" kind="time"> |
4 | <prompt>input averaging time in secs</prompt> | 4 | <prompt>input averaging time in secs</prompt> |
5 | <info_brief>average</info_brief> | 5 | <info_brief>average</info_brief> |
@@ -88,11 +88,11 @@ | @@ -88,11 +88,11 @@ | ||
88 | <prompt/> | 88 | <prompt/> |
89 | <info_brief>GSE to SM transformation</info_brief> | 89 | <info_brief>GSE to SM transformation</info_brief> |
90 | </function>--> | 90 | </function>--> |
91 | - <function name="cross(,)" params="2" kind="vectors"> | 91 | + <function name="cross(,)" args="2" kind="vectors"> |
92 | <info_brief>Cross product</info_brief> | 92 | <info_brief>Cross product</info_brief> |
93 | <new_kernel>cross</new_kernel> | 93 | <new_kernel>cross</new_kernel> |
94 | </function> | 94 | </function> |
95 | - <function name="dot(,)" params="2" kind="vectors"> | 95 | + <function name="dot(,)" args="2" kind="vectors"> |
96 | <info_brief>Dot product</info_brief> | 96 | <info_brief>Dot product</info_brief> |
97 | <new_kernel>dot</new_kernel> | 97 | <new_kernel>dot</new_kernel> |
98 | </function> | 98 | </function> |
js/app/models/Function.js
@@ -15,9 +15,8 @@ Ext.define('amdaModel.Function', { | @@ -15,9 +15,8 @@ Ext.define('amdaModel.Function', { | ||
15 | fields : [ | 15 | fields : [ |
16 | {name: 'name', mapping: '@name', type:'string'}, | 16 | {name: 'name', mapping: '@name', type:'string'}, |
17 | {name: 'kind', mapping: '@kind', type: 'string', defaultValue: 'amda'}, | 17 | {name: 'kind', mapping: '@kind', type: 'string', defaultValue: 'amda'}, |
18 | - {name: 'args', mapping: '@args', type: 'int', defaultValue: 0}, | 18 | + {name: 'args', mapping: '@args', type: 'int', defaultValue: 1}, |
19 | {name: 'argv', mapping: '@argv', type: 'string'}, | 19 | {name: 'argv', mapping: '@argv', type: 'string'}, |
20 | - {name: 'params', mapping: '@params', type:'int', defaultValue: 1}, | ||
21 | {name: 'prompt', type: 'string', defaultValue: ''}, | 20 | {name: 'prompt', type: 'string', defaultValue: ''}, |
22 | {name: 'info_brief', type: 'string', defaultValue: ''} | 21 | {name: 'info_brief', type: 'string', defaultValue: ''} |
23 | ], | 22 | ], |
@@ -37,4 +36,4 @@ Ext.define('amdaModel.Function', { | @@ -37,4 +36,4 @@ Ext.define('amdaModel.Function', { | ||
37 | record: 'function' | 36 | record: 'function' |
38 | } | 37 | } |
39 | } | 38 | } |
40 | -}); | ||
41 | \ No newline at end of file | 39 | \ No newline at end of file |
40 | +}); |
js/app/views/CalculatorUI.js
@@ -189,7 +189,7 @@ Ext.define('amdaUI.CalculatorUI', { | @@ -189,7 +189,7 @@ Ext.define('amdaUI.CalculatorUI', { | ||
189 | 189 | ||
190 | processFormula : function(sel,currentBtn, params, afterParamsText){ | 190 | processFormula : function(sel,currentBtn, params, afterParamsText){ |
191 | // calculation of the required number of parameters | 191 | // calculation of the required number of parameters |
192 | - var nbParams = currentBtn.initialConfig.params; | 192 | + var nbParams = currentBtn.initialConfig.args; |
193 | var fnText = currentBtn.text.split('('); | 193 | var fnText = currentBtn.text.split('('); |
194 | var newConstruction = sel.beforeText + fnText[0]+"("; | 194 | var newConstruction = sel.beforeText + fnText[0]+"("; |
195 | // if there at least one parameter selected | 195 | // if there at least one parameter selected |
@@ -210,7 +210,7 @@ Ext.define('amdaUI.CalculatorUI', { | @@ -210,7 +210,7 @@ Ext.define('amdaUI.CalculatorUI', { | ||
210 | 210 | ||
211 | // If we haven't the right number of selected parameters | 211 | // If we haven't the right number of selected parameters |
212 | if (params.length < nbParams){ | 212 | if (params.length < nbParams){ |
213 | - var stringParamRequired = currentBtn.initialConfig.params+" parameter(s)"; | 213 | + var stringParamRequired = currentBtn.initialConfig.args+" parameter(s)"; |
214 | Ext.Msg.alert('Caution', 'you\'ll have to add '+ stringParamRequired +' to apply this function', | 214 | Ext.Msg.alert('Caution', 'you\'ll have to add '+ stringParamRequired +' to apply this function', |
215 | function(){ | 215 | function(){ |
216 | // set Caret Position at placement of required parameter in function | 216 | // set Caret Position at placement of required parameter in function |
@@ -446,7 +446,6 @@ Ext.define('amdaUI.CalculatorUI', { | @@ -446,7 +446,6 @@ Ext.define('amdaUI.CalculatorUI', { | ||
446 | { | 446 | { |
447 | text: f.get('name'), | 447 | text: f.get('name'), |
448 | args: f.get('args'), | 448 | args: f.get('args'), |
449 | - params: f.get('params'), | ||
450 | prompt: f.get('prompt'), | 449 | prompt: f.get('prompt'), |
451 | tooltip: f.get('info_brief'), | 450 | tooltip: f.get('info_brief'), |
452 | scope: this, | 451 | scope: this, |
@@ -466,8 +465,9 @@ Ext.define('amdaUI.CalculatorUI', { | @@ -466,8 +465,9 @@ Ext.define('amdaUI.CalculatorUI', { | ||
466 | Ext.Msg.alert("Invalid Selection", "Action aborted"); | 465 | Ext.Msg.alert("Invalid Selection", "Action aborted"); |
467 | } | 466 | } |
468 | else { | 467 | else { |
468 | +console.log(params.length); | ||
469 | // calculation of the required number of parameters | 469 | // calculation of the required number of parameters |
470 | - var nbParams = b.initialConfig.params; | 470 | + var nbParams = b.initialConfig.args; |
471 | 471 | ||
472 | if (params.length>nbParams) | 472 | if (params.length>nbParams) |
473 | { | 473 | { |