diff options
author | Cameron Mace <cameron@mapbox.com> | 2016-12-16 16:19:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-16 16:19:15 -0500 |
commit | 20b958301eb208fe9ed0ae8edfb14b6f3741d8f2 (patch) | |
tree | 94ae0ce250cda159be13f9a21cc70c92d4908974 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Function.java | |
parent | f95b4838ea816b9da0c151a953a1f98f97c79a39 (diff) | |
download | qtlocation-mapboxgl-20b958301eb208fe9ed0ae8edfb14b6f3741d8f2.tar.gz |
Adds checkstyle to CI (#7442)
* adds checkstyle to CI
* fixed gradlew path
* resolved testapp checkstyle violations
* added back mapboxMap variable for test
* checkstyle annotations
* checkstyle SDK round 1
* maps package checkstyle
* rest of SDK checkstyle
* checkstyle gesture library
* checkstyle test
* finished rest of test checkstyle
* resolved all checkstyle errors
* fixed class name
* removed old test file
* fixed camera postion test
* fixed native crash
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Function.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Function.java | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Function.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Function.java index e147b5204f..900fe10476 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Function.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Function.java @@ -19,119 +19,119 @@ import java.util.Map; */ public class Function<T> { - /** - * A stop represents a certain point in the range of this function - * - * @param <I> input - * @param <O> output - */ - public static class Stop<I, O> { - public final I in; - public final O out; - - Stop(I in, O out) { - this.in = in; - this.out = out; - } - - /** - * @return an array representation of the Stop - */ - Object[] toValueObject() { - return new Object[]{in, out}; - } - - @Override - public String toString() { - return String.format("[%s, %s]", in, out); - } - } - - /** - * Zoom functions allow the appearance of a map feature to change with map’s zoom. - * Zoom functions can be used to create the illusion of depth and control data density. - * Each stop is an array with two elements, the first is a zoom and the second is a function output value. - * - * @param stops the stops that define the function - * @param <T> the property type - * @return the {@link Function} - */ - @SafeVarargs - public static <T> Function<T> zoom(@NonNull @Size(min = 1) Stop<Float, T>... stops) { - return new Function<T>(stops); + /** + * A stop represents a certain point in the range of this function + * + * @param <I> input + * @param <O> output + */ + public static class Stop<I, O> { + public final I in; + public final O out; + + Stop(I in, O out) { + this.in = in; + this.out = out; } - /** - * Zoom functions allow the appearance of a map feature to change with map’s zoom. - * Zoom functions can be used to create the illusion of depth and control data density. - * Each stop is an array with two elements, the first is a zoom and the second is a function output value. - * - * @param stops the stops that define the function - * @param base the exponential base of the interpolation curve - Default 1 - * @param <T> the property type - * @return the {@link Function} + * @return an array representation of the Stop */ - @SafeVarargs - public static <T> Function<T> zoom( - @FloatRange(from = 0, to = 1, fromInclusive = false, toInclusive = false) float base, - @NonNull @Size(min = 1) Stop<Float, T>... stops) { - return new Function<T>(stops) - .withBase(base); + Object[] toValueObject() { + return new Object[] {in, out}; } - /** - * Creates a stop to use in a {@link Function} - * - * @param in the input for the stop - * @param output the output for the stop - * @param <T> the output property type - * @return the {@link Stop} - */ - public static <T> Stop<Float, T> stop(float in, Property<T> output) { - return new Stop<>(in, output.value); + @Override + public String toString() { + return String.format("[%s, %s]", in, out); } - - private final Stop<Float, T>[] stops; - private Float base; - - Function(@NonNull @Size(min = 1) Stop<Float, T>[] stops) { - this.stops = stops; + } + + /** + * Zoom functions allow the appearance of a map feature to change with map’s zoom. + * Zoom functions can be used to create the illusion of depth and control data density. + * Each stop is an array with two elements, the first is a zoom and the second is a function output value. + * + * @param stops the stops that define the function + * @param <T> the property type + * @return the {@link Function} + */ + @SafeVarargs + public static <T> Function<T> zoom(@NonNull @Size(min = 1) Stop<Float, T>... stops) { + return new Function<T>(stops); + } + + + /** + * Zoom functions allow the appearance of a map feature to change with map’s zoom. + * Zoom functions can be used to create the illusion of depth and control data density. + * Each stop is an array with two elements, the first is a zoom and the second is a function output value. + * + * @param stops the stops that define the function + * @param base the exponential base of the interpolation curve - Default 1 + * @param <T> the property type + * @return the {@link Function} + */ + @SafeVarargs + public static <T> Function<T> zoom( + @FloatRange(from = 0, to = 1, fromInclusive = false, toInclusive = false) float base, + @NonNull @Size(min = 1) Stop<Float, T>... stops) { + return new Function<T>(stops) + .withBase(base); + } + + /** + * Creates a stop to use in a {@link Function} + * + * @param in the input for the stop + * @param output the output for the stop + * @param <T> the output property type + * @return the {@link Stop} + */ + public static <T> Stop<Float, T> stop(float in, Property<T> output) { + return new Stop<>(in, output.value); + } + + private final Stop<Float, T>[] stops; + private Float base; + + Function(@NonNull @Size(min = 1) Stop<Float, T>[] stops) { + this.stops = stops; + } + + Function<T> withBase(float base) { + this.base = base; + return this; + } + + /** + * @return the base + */ + @Nullable + public Float getBase() { + return base; + } + + /** + * @return the stops in this function + */ + public Stop<Float, T>[] getStops() { + return stops; + } + + Map<String, Object> toValueObject() { + Object[] stopsValue = new Object[stops.length]; + + for (int i = 0; i < stopsValue.length; i++) { + Stop stop = stops[i]; + stopsValue[i] = stop.toValueObject(); } - Function<T> withBase(float base) { - this.base = base; - return this; - } - - /** - * @return the base - */ - @Nullable - public Float getBase() { - return base; - } - - /** - * @return the stops in this function - */ - public Stop<Float, T>[] getStops() { - return stops; - } - - Map<String, Object> toValueObject() { - Object[] stopsValue = new Object[stops.length]; - - for (int i = 0; i < stopsValue.length; i++) { - Stop stop = stops[i]; - stopsValue[i] = stop.toValueObject(); - } - - Map<String, Object> value = new HashMap<>(); - if (base != null) { - value.put("base", base); - } - value.put("stops", stopsValue); - return value; + Map<String, Object> value = new HashMap<>(); + if (base != null) { + value.put("base", base); } + value.put("stops", stopsValue); + return value; + } } |