package net.kevxu.senselib;

import java.util.List;

import android.hardware.Sensor;
import android.util.Log;

public class StepDetectorDataPool {

	private static final String TAG = "StepDetectorDataPool";

	private final static int DEFAULT_POOL_SIZE = 500;

	private int mPoolSize;
	private DataPool<float[]> mLinearAccelPool;
	private DataPool<float[]> mGravityPool;

	protected StepDetectorDataPool() {
		this(DEFAULT_POOL_SIZE);
	}

	protected StepDetectorDataPool(int poolSize) {
		mPoolSize = poolSize;
		mLinearAccelPool = new DataPool<float[]>(mPoolSize);
		mGravityPool = new DataPool<float[]>(mPoolSize);
	}

	protected DataPool getDataPool(int type) {
		switch (type) {
		case Sensor.TYPE_LINEAR_ACCELERATION:
			return mLinearAccelPool;
		case Sensor.TYPE_GRAVITY:
			return mGravityPool;
		default:
			IllegalArgumentException e = new IllegalArgumentException("No such type "
					+ type + ".");
			Log.e(TAG, e.getMessage(), e);
			throw e;
		}
	}

	protected StepDetectorDataPool addData(int type, float[] values) {
		DataPool dataPool = getDataPool(type);
		dataPool.append(values);

		return this;
	}

	protected StepDetectorDataPool addDataList(int type, List<float[]> valuesList) {
		DataPool dataPool = getDataPool(type);
		for (float[] values : valuesList) {
			dataPool.append(values);
		}

		return this;
	}

	protected int getSize(int type) {
		DataPool dataPool = getDataPool(type);
		return dataPool.size();
	}

	protected float[] get(int type, int i) {
		DataPool dataPool = getDataPool(type);
		return dataPool.get(i);
	}

	protected List<float[]> getPrevious(int type, int n) {
		DataPool dataPool = getDataPool(type);
		return dataPool.getPrevious(n);
	}

}
@@ -632,16 +632,25 @@
 DataPool
+%3Cfloat%5B%5D%3E
  getData
@@ -666,16 +666,16 @@
 type) %7B%0A
-
 %09%09switch
@@ -1036,32 +1036,41 @@
 es) %7B%0A%09%09DataPool
+%3Cfloat%5B%5D%3E
  dataPool = getD
@@ -1215,32 +1215,41 @@
 st) %7B%0A%09%09DataPool
+%3Cfloat%5B%5D%3E
  dataPool = getD
@@ -1390,32 +1390,41 @@
 pe) %7B%0A%09%09DataPool
+%3Cfloat%5B%5D%3E
  dataPool = getD
@@ -1512,32 +1512,41 @@
  i) %7B%0A%09%09DataPool
+%3Cfloat%5B%5D%3E
  dataPool = getD
@@ -1642,24 +1642,24 @@
 e, int n) %7B%0A
-
 %09%09DataPool d
@@ -1656,16 +1656,25 @@
 DataPool
+%3Cfloat%5B%5D%3E
  dataPoo

Fix StepDetectorDataPool correspondingly.