Code example for LinkedList

Methods: get, poll, size

0
	/** 
	 * count steps 
	 */ 
	private int countSteps() { 
		int steps=0;
		int n = mSensorValues.size();
		double deltaTime = mSensorValues.get(n-1).timestamp - mSensorValues.get(0).timestamp;
		deltaTime /= 1000000000; // nanosec -> sec
		 
		//Log.i("deltaTime", String.valueOf(deltaTime)); 
		//Log.i("n", String.valueOf(n)); 
		 
		if (deltaTime > mTimeInterval) {
			//Log.i("> mTimeInterval", String.valueOf(deltaTime)); 
			/*for (int i=0; i<n; ++i) { 
				if (mSensorValues.get(i).sign) { 
					steps+=1; 
				} 
			}*/ 
			steps = mNumberOfChangedSigns/2; // 2 Null-Durchgänge je Schritt
			steps *= (int)Math.ceil(60/mTimeInterval);
			 
			// don't send every change 
			long currentTimeStamp = System.currentTimeMillis();
			if ( ((currentTimeStamp - mLastChangedSend) / 1000 ) > mStepSendInterval) {
				mLastChangedSend = currentTimeStamp;
				mStepChangeListener.onStepChanged(steps);
				//Log.i("StepChangeListener", "onChanged"); 
			} 
			 
			if (mSensorValues.get(0).sign) {
				mNumberOfChangedSigns-=1;
			} 
			 
			mSensorValues.poll();
		} 
		return steps;
	} 
};