use of org.onebusaway.gtfs_transformer.updates.ShiftNegativeStopTimesUpdateStrategy in project onebusaway-gtfs-modules by OneBusAway.
the class TransformFactory method addModificationsFromReader.
public void addModificationsFromReader(BufferedReader reader) throws IOException, TransformSpecificationException {
String line = null;
while ((line = reader.readLine()) != null) {
try {
line = line.trim();
if (line.length() == 0 || line.startsWith("#") || line.equals("{{{") || line.equals("}}}"))
continue;
JSONObject json = new JSONObject(line);
if (!json.has(ARG_OP)) {
throw new TransformSpecificationMissingArgumentException(line, ARG_OP);
}
String opType = json.getString(ARG_OP);
if (opType.equals("add")) {
handleAddOperation(line, json);
} else if (opType.equals(ARG_UPDATE) || opType.equals("change") || opType.equals("modify")) {
handleUpdateOperation(line, json);
} else if (opType.equals("remove") || opType.equals("delete")) {
handleRemoveOperation(line, json);
} else if (opType.equals("retain")) {
handleRetainOperation(line, json);
} else if (opType.equals("subsection")) {
handleSubsectionOperation(line, json);
} else if (opType.equals("trim_trip")) {
handleTrimOperation(line, json);
} else if (opType.equals("stop_times_factory")) {
handleStopTimesOperation(line, json);
} else if (opType.equals("calendar_extension")) {
handleTransformOperation(line, json, new CalendarExtensionStrategy());
} else if (opType.equals("calendar_simplification")) {
handleTransformOperation(line, json, new CalendarSimplicationStrategy());
} else if (opType.equals("deduplicate_service_ids")) {
handleTransformOperation(line, json, new DeduplicateServiceIdsStrategy());
} else if (opType.equals("shift_negative_stop_times")) {
handleTransformOperation(line, json, new ShiftNegativeStopTimesUpdateStrategy());
} else if (opType.equals("shape_direction")) {
handleTransformOperation(line, json, new ShapeDirectionTransformStrategy());
} else if (opType.equals("transform")) {
handleTransformOperation(line, json);
} else {
throw new TransformSpecificationException("unknown transform op \"" + opType + "\"", line);
}
} catch (JSONException ex) {
throw new TransformSpecificationException("error parsing json", ex, line);
}
}
}
Aggregations