Merge with 25704964a526fcfe09919af8f29c1e526b5409ec

This commit is contained in:
Bartlomiej Niechwiej
2010-10-04 16:34:38 -07:00
parent 256dac3a82
commit 34bb467b97
55 changed files with 942 additions and 486 deletions
@@ -94,6 +94,22 @@ public class TrackBuffer {
buffer[locationsLoaded++] = location;
lastLocationRead = Math.max(lastLocationRead, id);
}
/**
* Get a location from the end of the buffer.
* This may reuse Location objects already allocated to the buffer.
* @param locationId The of the location to be added.
* @return The location object associated with the give id.
*/
public Location add(long locationId) {
lastLocationRead = Math.max(lastLocationRead, locationId);
if (buffer[locationsLoaded] == null) {
buffer[locationsLoaded] = new Location("");
} else {
buffer[locationsLoaded].reset();
}
return buffer[locationsLoaded++];
}
/**
* @return The id of the last location loaded into the buffer