[android] - move match stops conversion to Stop.toExpressionArray

This commit is contained in:
tobrun
2018-06-12 00:12:31 +02:00
committed by Tobrun
parent 0ecdbebb09
commit aa16b90e2b
2 changed files with 21 additions and 12 deletions

View File

@@ -1017,12 +1017,7 @@ public class Expression {
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-match">Style specification</a>
*/
public static Expression match(@NonNull Expression input, @NonNull Expression defaultOutput, @NonNull Stop... stops) {
Expression[] expressionStops = new Expression[stops.length * 2];
for (int i = 0; i < stops.length; i++) {
expressionStops[i * 2] = literal(stops[i].value);
expressionStops[i * 2 + 1] = literal(stops[i].output);
}
return match(join(join(new Expression[] {input}, expressionStops), new Expression[] {defaultOutput}));
return match(join(join(new Expression[] {input}, Stop.toExpressionArray(stops)), new Expression[] {defaultOutput}));
}
/**
@@ -3449,8 +3444,6 @@ public class Expression {
throw new IllegalArgumentException("PropertyValue are not allowed as an expression literal, use value instead.");
} else if (value instanceof Expression.ExpressionLiteral) {
return toValue((ExpressionLiteral) value);
} else if (value instanceof Expression) {
return ((Expression) value).toArray();
}
return value;
}