0
我会写从以下元代码的代码,在我需要:基于测试 情况下SENSOR_MODE - 断开关,并继续while循环 - 继续下一个caseAndroid Java开关案例...是否正确?
我不知道这是否是做
while(running){
performTask1();
....
performTask2();
....
switch(mode) {
case SENSOR_MODE:
// no 0 in interpolationValidators
// are all interpolatedValues ready ?
// calculate orientation
// record interpolatedSensorData into LogFile
break; // break ... next while loop
// waiting for more data to interpolate
// modify interpolationValidators for missing sensors set to 0
// add validated data + zero to cache
// should continue next case CACHE MODE
case CACHE_MODE:
// some O in interpolationValidators
// add 10ms to waiting time for missing sensors
// if wait time >= max (30ms)
// copy last value from sensor queue into all waiting interpolations for sensor
// check cache buffer - are some interpolated data completed for all sensors
// if ready
// modify interpolationValidators for completed sensors - reset to 1
// calculate orientation
// record interpolatedSensorData into LogFile
// remove ready data from cache
break; //
}
} // end running thread
如果在switch语句之后没有什么东西(在while循环结束之前),那么断开开关将继续while循环的下一次迭代。但我有点困惑。除了有条件中断的情况外,你是否真的希望SENSOR_MODE进入CACHE_MODE状态? –
是的,没错,我真的很想要它.. – erwin