Tidied up displayCatList with List<String> cas

This commit is contained in:
misaochan 2016-01-11 17:48:39 +13:00
parent 9cd0f8fb5a
commit 6537ff217c

View file

@ -46,29 +46,23 @@ public class CacheController {
//Convert decLatitude and decLongitude to a coordinate offset range //Convert decLatitude and decLongitude to a coordinate offset range
convertCoordRange(); convertCoordRange();
pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus); pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus);
List displayCatList = new ArrayList(); List<String> displayCatList = new ArrayList<String>();
Log.d(TAG, "Points found in quadtree: " + pointsFound); Log.d(TAG, "Points found in quadtree: " + pointsFound);
List<String> flatCatList = new ArrayList<String>();
if (pointsFound.length != 0) { if (pointsFound.length != 0) {
Log.d(TAG, "Entering for loop"); Log.d(TAG, "Entering for loop");
int index = 0;
for (Point point : pointsFound) { for (Point point : pointsFound) {
Log.d(TAG, "Nearby point: " + point.toString()); Log.d(TAG, "Nearby point: " + point.toString());
Object cat = point.getValue(); displayCatList = (List<String>)point.getValue();
Log.d(TAG, "Nearby cat: " + cat); Log.d(TAG, "Nearby cat: " + point.getValue());
displayCatList.add(index, cat);
index++;
} }
//FIXME: temporary, can't figure out why for loop always only accesses 1 point
flatCatList = ((ArrayList<String>)displayCatList.get(0));
Log.d(TAG, "Categories found in cache: " + flatCatList.toString()); Log.d(TAG, "Categories found in cache: " + displayCatList.toString());
} else { } else {
Log.d(TAG, "No categories found in cache"); Log.d(TAG, "No categories found in cache");
} }
return flatCatList; return displayCatList;
} }
public void convertCoordRange() { public void convertCoordRange() {