1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- class ConfigObject {
- constructor () {
- this.decimalPlaces = 8;
- this.intConvertRoundMode = 2;
- this.default_lang = 'pt';
- this.enable_type_casting = true;
- this.idle_input_interval = 5000;
- this.suspend_threshold = 100;
- // this.max_instruction_count = 350250; - automated evaluation limit
- this.max_instruction_count = Number.MAX_SAFE_INTEGER;
- this.programming_type = "visual";
- this.ui_settings = [{"name":"integer_data_type","value":"on"},
- {"name":"real_data_type","value":"on"},{"name":"text_data_type","value":"on"},
- {"name":"boolean_data_type","value":"on"},{"name":"void_data_type","value":"on"},
- {"name":"commands_read","value":"on"},{"name":"commands_write","value":"on"},
- {"name":"commands_comment","value":"on"},{"name":"commands_attribution","value":"on"},
- {"name":"commands_functioncall","value":"on"},{"name":"commands_iftrue","value":"on"},
- {"name":"commands_repeatNtimes","value":"on"},{"name":"commands_while","value":"on"},
- {"name":"commands_dowhile","value":"on"},{"name":"commands_switch","value":"on"},
- {name:"functions_creation", value: "on"},{name:"filter_active", value:"off"}];
- }
- isSettingEnabled (setting_name) {
- for(const setting_obj in this.ui_settings) {
- if(setting_obj.name == setting_name) {
- return setting_obj.value == "on";
- }
- }
- return false;
- }
- getSetting (setting_name) {
- for (const setting_obj in this.ui_settings) {
- if (setting_obj.name == setting_name) {
- return setting_obj.value;
- }
- }
- return undefined;
- }
- setSetting (setting_name, value) {
- for(const setting_obj in this.ui_settings) {
- if(setting_obj.name == setting_name) {
- setting_obj.value = value;
- return;
- }
- }
- this.ui_settings.push({name: setting_name, value: value});
- }
- setConfig (opts) {
- for (const key in opts) {
- if(Object.prototype.hasOwnProperty.call(this, key)){
- this[key] = opts[key];
- }
- }
- }
- }
- const config = new ConfigObject();
- export const Config = config;
|