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