File tree Expand file tree Collapse file tree
core/src/main/java/com/graphhopper/routing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .graphhopper .routing .ev ;
2+
3+ public interface SparseEncodedValue <E > extends EncodedValue {
4+ public E get (int edgeID );
5+ public void set (int edgeID , Object value );
6+ }
Original file line number Diff line number Diff line change @@ -435,7 +435,7 @@ private void addEncoder(AbstractFlagEncoder encoder) {
435435 edgeEncoders .add (encoder );
436436 }
437437
438- private void addEncodedValue (EncodedValue ev , boolean withNamespace ) {
438+ public void addEncodedValue (EncodedValue ev , boolean withNamespace ) {
439439 String normalizedKey = ev .getName ().replaceAll (SPECIAL_SEPARATOR , "_" );
440440 if (hasEncodedValue (normalizedKey ))
441441 throw new IllegalStateException ("EncodedValue " + ev .getName () + " collides with " + normalizedKey );
Original file line number Diff line number Diff line change @@ -201,6 +201,11 @@ static boolean isValidVariableName(String name) {
201201 private static String getVariableDeclaration (EncodedValueLookup lookup , String arg ) {
202202 if (lookup .hasEncodedValue (arg )) {
203203 EncodedValue enc = lookup .getEncodedValue (arg , EncodedValue .class );
204+ // ORS MOD: SparseEncodedValues are not really encoded values, but are built to behave like them
205+ if (enc .getClass ().getSimpleName ().contains ("Sparse" )) {
206+ return "Object " + arg + " = ((SparseEncodedValue) this." + arg + "_enc).get(edge.getEdge());\n " ;
207+ }
208+ // ORS MOD END
204209 return getReturnType (enc ) + " " + arg + " = reverse ? " +
205210 "edge.getReverse((" + getInterface (enc ) + ") this." + arg + "_enc) : " +
206211 "edge.get((" + getInterface (enc ) + ") this." + arg + "_enc);\n " ;
You can’t perform that action at this time.
0 commit comments