Sensor simulation platform-experiment environment configuration (4)

Source: Internet
Author: User

The initial idea of experiment environment configuration is as follows:

There must be a class dedicated to managing various experiment environment parameters, such as site length and width. For convenience, you can read files in the constructor of this class, use external XML as the configuration file to load various parameters. In this way, you can do the following during use:

 
Config =NewConfig ();//This is my environment configuration management class.VaRWidth = config. width;

But for the framework, this method seems to be easy to use, but it is actually difficult to do. Why? You are not sure about the parameters. Different experiments have different types of parameters. The parameters in Experiment 1 are long and wide. Experiment 2 is about length, width, and height. How can I set config. Property...

When I think about it again, I think the problem is complicated. The experiment environment configuration is still used for specific algorithms. Therefore, the framework only needs to provide a class to manage various parameters.

There is only one problem here. A class is required to save and obtain the variables.

  //   when initializing the experiment environment, save variable  config. setproperty ( "  width  " ,  500  );  ///   Get variables during use   var  value = ( double ) config. getproperty ( "  width  "   );   //   get the variable   var  value = ( int ) config. getproperty ( "  width  " ); 

The problem is that when a variable is saved, the variable type is degraded to an object, so you need to remember the type of the variable.

Setting environment configuration during experiment initialization does not require writing static functions, initializing constructors, and reading files. Instead, it is not intuitive.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.