/** * This method applies changes to the graph, specified by the json features. * * @return number of successfully applied edge changes */ public long applyChanges(EncodingManager em, Collection<JsonFeature> features) { if (em == null) throw new NullPointerException("EncodingManager cannot be null to change existing graph"); long updates = 0; for (JsonFeature jsonFeature : features) { if (!jsonFeature.hasProperties()) throw new IllegalArgumentException("One feature has no properties, please specify properties e.g. speed or access"); List<String> encodersAsStr = (List) jsonFeature.getProperty("vehicles"); if (encodersAsStr == null) { for (FlagEncoder encoder : em.fetchEdgeEncoders()) { updates += applyChange(jsonFeature, encoder); } } else { for (String encoderStr : encodersAsStr) { updates += applyChange(jsonFeature, em.getEncoder(encoderStr)); } } } return updates; }
/** * This method applies changes to the graph, specified by the json features. * * @return number of successfully applied edge changes */ public long applyChanges(EncodingManager em, Collection<JsonFeature> features) { if (em == null) throw new NullPointerException("EncodingManager cannot be null to change existing graph"); long updates = 0; for (JsonFeature jsonFeature : features) { if (!jsonFeature.hasProperties()) throw new IllegalArgumentException("One feature has no properties, please specify properties e.g. speed or access"); List<String> encodersAsStr = (List) jsonFeature.getProperty("vehicles"); if (encodersAsStr == null) { for (FlagEncoder encoder : em.fetchEdgeEncoders()) { updates += applyChange(jsonFeature, encoder); } } else { for (String encoderStr : encodersAsStr) { updates += applyChange(jsonFeature, em.getEncoder(encoderStr)); } } } return updates; }
/** * This method applies changes to the graph, specified by the json features. * * @return number of successfully applied edge changes */ public long applyChanges(EncodingManager em, Collection<JsonFeature> features) { long updates = 0; for (JsonFeature jsonFeature : features) { if (!jsonFeature.hasProperties()) throw new IllegalArgumentException("One feature has no properties, please specify properties e.g. speed or access"); List<String> encodersAsStr = (List) jsonFeature.getProperty("vehicles"); if (encodersAsStr == null) { for (FlagEncoder encoder : em.fetchEdgeEncoders()) { updates += applyChange(jsonFeature, encoder); } } else { for (String encoderStr : encodersAsStr) { updates += applyChange(jsonFeature, em.getEncoder(encoderStr)); } } } return updates; }