Java Code Examples for gnu.trove.list.array.TIntArrayList#contains()

The following examples show how to use gnu.trove.list.array.TIntArrayList#contains() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SFMDemo.java    From COMP3204 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
FeatureTable filterNonTracked(FeatureTable ft) {
	final int nFrames = ft.features.size();
	final TIntArrayList tracksToRemove = new TIntArrayList();

	for (int i = 0; i < ft.nFeatures; i++) {
		int sum = 0;

		for (int f = 1; f < nFrames; f++) {
			sum += ft.features.get(f).get(i).val;
		}

		if (sum != 0) {
			tracksToRemove.add(i);
		}
	}

	final FeatureTable filtered = new FeatureTable(ft.nFeatures - tracksToRemove.size());
	for (int f = 0; f < nFrames; f++) {
		final FeatureList fl = new FeatureList(filtered.nFeatures);

		for (int i = 0, j = 0; i < ft.nFeatures; i++) {
			if (!tracksToRemove.contains(i))
				fl.features[j++] = ft.features.get(f).get(i);
		}
		filtered.storeFeatureList(fl, f);
	}

	return filtered;
}