Skip to content

Commit

Permalink
Merge pull request #41 from GIScience/update_osm_conditional_parser_l…
Browse files Browse the repository at this point in the history
…ibraries

Update OSM conditional parser libraries
  • Loading branch information
takb authored May 31, 2021
2 parents 4705f55 + 4afda13 commit fcc40df
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static ConditionalValueParser createDateTimeParser() {
return new ConditionalValueParser() {
@Override
public ConditionState checkCondition(String conditionString) {
ArrayList<Rule> rules;
List<Rule> rules;
try {
OpeningHoursParser parser = new OpeningHoursParser(new ByteArrayInputStream(conditionString.getBytes()));
rules = parser.rules(false);
Expand Down Expand Up @@ -252,12 +252,12 @@ public Result checkCondition(String tagValue) throws ParseException {
if (tagValue == null || tagValue.isEmpty() || !tagValue.contains("@"))
return result;

ArrayList<Restriction> parsedRestrictions = new ArrayList<>();
List<Restriction> parsedRestrictions = new ArrayList<>();

try {
ConditionalRestrictionParser parser = new ConditionalRestrictionParser(new ByteArrayInputStream(tagValue.getBytes()));

ArrayList<Restriction> restrictions = parser.restrictions();
List<Restriction> restrictions = parser.restrictions();

// iterate over restrictions starting from the last one in order to match to the most specific one
for (int i = restrictions.size() - 1 ; i >= 0; i--) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.io.ByteArrayInputStream;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;

/**
* Calculate time-dependent conditional speed
Expand Down Expand Up @@ -59,7 +60,7 @@ public double getSpeed(EdgeIteratorState edge, boolean reverse, long time) {
private double getSpeed(String conditional, ZonedDateTime zonedDateTime) {
try {
ConditionalRestrictionParser crparser = new ConditionalRestrictionParser(new ByteArrayInputStream(conditional.getBytes()));
ArrayList<Restriction> restrictions = crparser.restrictions();
List<Restriction> restrictions = crparser.restrictions();

// iterate over restrictions starting from the last one in order to match to the most specific one
for (int i = restrictions.size() - 1 ; i >= 0; i--) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ boolean accept(String conditional, ZonedDateTime zonedDateTime) {
try {
ConditionalRestrictionParser crparser = new ConditionalRestrictionParser(new ByteArrayInputStream(conditional.getBytes()));

ArrayList<Restriction> restrictions = crparser.restrictions();
List<Restriction> restrictions = crparser.restrictions();

// iterate over restrictions starting from the last one in order to match to the most specific one
for (int i = restrictions.size() - 1 ; i >= 0; i--) {
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<dropwizard.version>1.3.12</dropwizard.version>
<jackson.version>2.9.9</jackson.version>
<guava.version>24.1.1-jre</guava.version>
<crparser.version>0.2.3</crparser.version>
<ohparser.version>0.16.1</ohparser.version>
<crparser.version>0.3.1</crparser.version>
<ohparser.version>0.23.2</ohparser.version>

<directions-api-client.version>0.10.1-3</directions-api-client.version>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down

0 comments on commit fcc40df

Please sign in to comment.