// the trip ID is contained at beginning of line, between "&" and "A"
try {
int tripId = Integer.parseInt(line.substring(1, line.indexOf('A')));
trip = Trip.fromId(tripId);
} catch (NumberFormatException nfe) {
throw new DataStructureException(
"Could not get the trip ID; line: " + line);
} catch (StringIndexOutOfBoundsException sie) {
throw new DataStructureException(
"Could not get the trip ID; line: " + line);
}
// initializing the trip duration
line = line.substring(line.indexOf(" ")).trim();