The data generation module has the following situation:
For different Sensor simulation experiments, the data types and quantities used are different.
For example, if Experiment 1 is to conduct a maximum coverage test, the data format required by the experiment may be as follows:
1 class sensor2 {3 Public int X; 4 Public int y; 5 Public double direction; // direction 6 Public double sweep; // sector size 7}
If the signal strength test is conducted in Experiment 2, he may need another target to be used as the covering, as shown below:
1 class TARGET2 {3 Public int X; 4 Public int y; 5 Public double direction; // direction 6 Public double speed; // moving speed 7}
As shown above, experiment 1 requires 100 sensor objects, and experiment 2 requires 500 sensor objects and 10 target objects,
So what method can be used to implement a common data generation interface?
In fact, when you think about it, you will find that the data is used by algorithms? What is the relationship with my framework? Who defines it.
The figure shows two interfaces,
Idataimp is an interface for data generation. In the framework, you need to implement this interface to obtain data. The init function is used as the initialization data function. init is used to complete data generation, whether the data is randomly generated or imported externally.
Iiterator is the iterator. The reason for doing so is that I think every data will always be done through experiments, so it is enough to traverse the data for experiments. Right?
1 { 2 IIterator iterator; 3 IDataImp list= new ConcreteDataImp(); 4 iterator = list.getIterator(); 5 while (iterator.MoveNext()) 6 { 7 Hashtable table = iterator.CurrentItem(); 8 method.InitData(table); 9 //do something10 iterator.Next();11 }12 }