From ce75c3b3e7ae905586e9575d4be8364a480bacf8 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Tue, 10 Apr 2018 13:45:46 +0200 Subject: [PATCH] [android] - add javadoc code examples for Android (#11540) --- .../style/expressions/Expression.java | 1436 ++++++++++++++++- 1 file changed, 1413 insertions(+), 23 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java index 37838376c..bd1da2fef 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java @@ -19,7 +19,6 @@ import java.util.List; * The value for any layout property, paint property, or filter may be specified as an expression. * An expression defines a formula for computing the value of the property using the operators described below. * The set of expression operators provided by Mapbox GL includes: - *

*

- *

*

* Expressions are represented as JSON arrays. * The first element of an expression array is a string naming the expression operator, @@ -51,6 +49,39 @@ import java.util.List; * Such composite expressions allows a layer's appearance to be determined by * a combination of the zoom level and individual feature properties. *

+ *

+ * Example expression: + *

+ *
+ * {@code
+ * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+ * fillLayer.setProperties(
+ *   fillColor(
+ *     interpolate( linear(), zoom(),
+ *       stop(12, step(get("stroke-width"),
+ *         color(Color.BLACK),
+ *         stop(1f, color(Color.RED)),
+ *         stop(2f, color(Color.WHITE)),
+ *         stop(3f, color(Color.BLUE))
+ *       )),
+ *       stop(15, step(get("stroke-width"),
+ *         color(Color.BLACK),
+ *         stop(1f, color(Color.YELLOW)),
+ *         stop(2f, color(Color.LTGRAY)),
+ *         stop(3f, color(Color.CYAN))
+ *       )),
+ *       stop(18, step(get("stroke-width"),
+ *         color(Color.BLACK),
+ *         stop(1f, color(Color.WHITE)),
+ *         stop(2f, color(Color.GRAY)),
+ *         stop(3f, color(Color.GREEN))
+ *       ))
+ *     )
+ *   )
+ * )
+ * }
+ * 
+ * */ public class Expression { @@ -78,6 +109,17 @@ public class Expression { /** * Create a literal number expression. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(literal(10.0f))
+   * );
+   * }
+   * 
* * @param number the number * @return the expression @@ -88,6 +130,17 @@ public class Expression { /** * Create a literal string expression. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(literal("Text"))
+   * );
+   * }
+   * 
* * @param string the string * @return the expression @@ -98,6 +151,17 @@ public class Expression { /** * Create a literal boolean expression. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillAntialias(literal(true))
+   * );
+   * }
+   * 
* * @param bool the boolean * @return the expression @@ -131,6 +195,17 @@ public class Expression { /** * Expression literal utility method to convert a color int to an color expression + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(color(Color.GREEN))
+   * );
+   * }
+   * 
* * @param color the int color * @return the color expression @@ -145,6 +220,23 @@ public class Expression { *

* If any component is out of range, the expression is an error. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *         rgb(
+   *             literal(255.0f),
+   *             literal(255.0f),
+   *             literal(255.0f)
+   *         )
+   *     )
+   * );
+   * }
+   * 
* * @param red red color expression * @param green green color expression @@ -162,6 +254,19 @@ public class Expression { *

* If any component is out of range, the expression is an error. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *         rgb(255.0f, 255.0f, 255.0f)
+   *     )
+   * );
+   * }
+   * 
* * @param red red color value * @param green green color value @@ -179,6 +284,24 @@ public class Expression { *

* If any component is out of range, the expression is an error. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *         rgba(
+   *             literal(255.0f),
+   *             literal(255.0f),
+   *             literal(255.0f),
+   *             literal(1.0f)
+   *         )
+   *     )
+   * );
+   * }
+   * 
* * @param red red color value * @param green green color value @@ -198,6 +321,19 @@ public class Expression { *

* If any component is out of range, the expression is an error. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *         rgb(255.0f, 255.0f, 255.0f, 1.0f)
+   *     )
+   * );
+   * }
+   * 
* * @param red red color value * @param green green color value @@ -224,6 +360,17 @@ public class Expression { /** * Returns true if the input values are equal, false otherwise. * The inputs must be numbers, strings, or booleans, and both of the same type. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     eq(get("keyToValue"), get("keyToOtherValue"))
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second expression @@ -236,6 +383,17 @@ public class Expression { /** * Returns true if the input values are equal, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     eq(get("keyToValue"), true)
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second boolean @@ -248,6 +406,17 @@ public class Expression { /** * Returns true if the input values are equal, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     eq(get("keyToValue"), "value")
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second number @@ -260,6 +429,17 @@ public class Expression { /** * Returns true if the input values are equal, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     eq(get("keyToValue"), 2.0f)
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second number @@ -273,6 +453,17 @@ public class Expression { /** * Returns true if the input values are not equal, false otherwise. * The inputs must be numbers, strings, or booleans, and both of the same type. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     neq(get("keyToValue"), get("keyToOtherValue"))
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second expression @@ -285,6 +476,17 @@ public class Expression { /** * Returns true if the input values are equal, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     neq(get("keyToValue"), true)
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second boolean @@ -294,9 +496,20 @@ public class Expression { public static Expression neq(Expression compareOne, boolean compareTwo) { return new Expression("!=", literal(compareOne), literal(compareTwo)); } -//fixme + /** * Returns `true` if the input values are not equal, `false` otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     neq(get("keyToValue"), "value"))
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second string @@ -309,6 +522,17 @@ public class Expression { /** * Returns `true` if the input values are not equal, `false` otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     neq(get("keyToValue"), 2.0f))
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second number @@ -322,11 +546,22 @@ public class Expression { /** * Returns true if the first input is strictly greater than the second, false otherwise. * The inputs must be numbers or strings, and both of the same type. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     gt(get("keyToValue"), get("keyToOtherValue"))
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second expression * @return expression - * @see Style specification + * @see Style specification */ public static Expression gt(@NonNull Expression compareOne, @NonNull Expression compareTwo) { return new Expression(">", compareOne, compareTwo); @@ -334,11 +569,22 @@ public class Expression { /** * Returns true if the first input is strictly greater than the second, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     gt(get("keyToValue"), 2.0f)
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second number * @return expression - * @see Style specification + * @see Style specification */ public static Expression gt(@NonNull Expression compareOne, @NonNull Number compareTwo) { return new Expression(">", literal(compareOne), literal(compareTwo)); @@ -346,11 +592,22 @@ public class Expression { /** * Returns true if the first input is strictly greater than the second, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     gt(get("keyToValue"), "value")
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second string * @return expression - * @see Style specification + * @see Style specification */ public static Expression gt(@NonNull Expression compareOne, @NonNull String compareTwo) { return new Expression(">", literal(compareOne), literal(compareTwo)); @@ -359,11 +616,22 @@ public class Expression { /** * Returns true if the first input is strictly less than the second, false otherwise. * The inputs must be numbers or strings, and both of the same type. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     lt(get("keyToValue"), get("keyToOtherValue"))
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second number * @return expression - * @see Style specification + * @see Style specification */ public static Expression lt(@NonNull Expression compareOne, @NonNull Expression compareTwo) { return new Expression("<", compareOne, compareTwo); @@ -371,11 +639,22 @@ public class Expression { /** * Returns true if the first input is strictly less than the second, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     lt(get("keyToValue"), 2.0f)
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second number * @return expression - * @see Style specification + * @see Style specification */ public static Expression lt(@NonNull Expression compareOne, @NonNull Number compareTwo) { return new Expression("<", literal(compareOne), literal(compareTwo)); @@ -383,11 +662,22 @@ public class Expression { /** * Returns true if the first input is strictly less than the second, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     lt(get("keyToValue"), "value"))
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second string * @return expression - * @see Style specification + * @see Style specification */ public static Expression lt(@NonNull Expression compareOne, @NonNull String compareTwo) { return new Expression("<", literal(compareOne), literal(compareTwo)); @@ -396,11 +686,22 @@ public class Expression { /** * Returns true if the first input is greater than or equal to the second, false otherwise. * The inputs must be numbers or strings, and both of the same type. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     gte(get("keyToValue"), get("keyToOtherValue"))
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second expression * @return expression - * @see Style specification + * @see Style specification */ public static Expression gte(@NonNull Expression compareOne, @NonNull Expression compareTwo) { return new Expression(">=", compareOne, compareTwo); @@ -408,11 +709,22 @@ public class Expression { /** * Returns true if the first input is greater than or equal to the second, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     gte(get("keyToValue"), 2.0f)
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second number * @return expression - * @see Style specification + * @see Style specification */ public static Expression gte(@NonNull Expression compareOne, @NonNull Number compareTwo) { return new Expression(">=", literal(compareOne), literal(compareTwo)); @@ -420,11 +732,22 @@ public class Expression { /** * Returns true if the first input is greater than or equal to the second, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     neq(get("keyToValue"), "value")
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second string * @return expression - * @see Style specification + * @see Style specification */ public static Expression gte(@NonNull Expression compareOne, @NonNull String compareTwo) { return new Expression(">=", literal(compareOne), literal(compareTwo)); @@ -433,11 +756,22 @@ public class Expression { /** * Returns true if the first input is less than or equal to the second, false otherwise. * The inputs must be numbers or strings, and both of the same type. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     lte(get("keyToValue"), get("keyToOtherValue"))
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second expression * @return expression - * @see Style specification + * @see Style specification */ public static Expression lte(@NonNull Expression compareOne, @NonNull Expression compareTwo) { return new Expression("<=", compareOne, compareTwo); @@ -445,11 +779,22 @@ public class Expression { /** * Returns true if the first input is less than or equal to the second, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     lte(get("keyToValue"), 2.0f)
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second number * @return expression - * @see Style specification + * @see Style specification */ public static Expression lte(@NonNull Expression compareOne, @NonNull Number compareTwo) { return new Expression("<=", literal(compareOne), literal(compareTwo)); @@ -457,11 +802,22 @@ public class Expression { /** * Returns true if the first input is less than or equal to the second, false otherwise. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     lte(get("keyToValue"), "value")
+   * );
+   * }
+   * 
* * @param compareOne the first expression * @param compareTwo the second string * @return expression - * @see Style specification + * @see Style specification */ public static Expression lte(@NonNull Expression compareOne, @NonNull String compareTwo) { return new Expression("<=", literal(compareOne), literal(compareTwo)); @@ -474,6 +830,17 @@ public class Expression { * once an input expression evaluates to `false`, * the result is `false` and no further input expressions are evaluated. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     all(get("keyToValue"), get("keyToOtherValue"))
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -490,6 +857,17 @@ public class Expression { * once an input expression evaluates to `true`, * the result is `true` and no further input expressions are evaluated. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     any(get("keyToValue"), get("keyToOtherValue"))
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -501,6 +879,17 @@ public class Expression { /** * Logical negation. Returns `true` if the input is `false`, and `false` if the input is `true`. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     not(get("keyToValue"))
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -512,6 +901,17 @@ public class Expression { /** * Logical negation. Returns `true` if the input is `false`, and `false` if the input is `true`. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     not(false)
+   * );
+   * }
+   * 
* * @param input boolean input * @return expression @@ -527,6 +927,23 @@ public class Expression { * For each case a condition and an output should be provided. * The last parameter should provide the default output. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     iconSize(
+   *         switchCase(
+   *             get(KEY_TO_BOOLEAN), literal(3.0f),
+   *             get(KEY_TO_OTHER_BOOLEAN), literal(5.0f)
+   *             literal(1.0f) // default value
+   *         )
+   *     )
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -540,6 +957,23 @@ public class Expression { * Selects the output whose label value matches the input value, or the fallback value if no match is found. * The `input` can be any string or number expression. * Each label can either be a single literal value or an array of values. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textColor(
+   *         match(get("keyToValue"),
+   *             literal(1), rgba(255, 0, 0, 1.0f),
+   *             literal(2), rgba(0, 0, 255.0f, 1.0f),
+   *             rgba(0.0f, 255.0f, 0.0f, 1.0f)
+   *         );
+   *     )
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -553,6 +987,23 @@ public class Expression { * Selects the output whose label value matches the input value, or the fallback value if no match is found. * The `input` can be any string or number expression. * Each label can either be a single literal value or an array of values. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textColor(
+   *         match(get("keyToValue"),
+   *             literal(1), rgba(255, 0, 0, 1.0f),
+   *             literal(2), rgba(0, 0, 255.0f, 1.0f),
+   *             rgba(0.0f, 255.0f, 0.0f, 1.0f)
+   *         );
+   *     )
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -569,6 +1020,22 @@ public class Expression { /** * Evaluates each expression in turn until the first non-null value is obtained, and returns that value. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textColor(
+   *         coalesce(
+   *             get("keyToNullValue"),
+   *             get("keyToNonNullValue")
+   *         );
+   *     )
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -583,7 +1050,17 @@ public class Expression { *

* Note that in some cases, it may be more efficient to use {@link #get(Expression)}} instead. *

- * + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(get("key-to-value", properties())))
+   * );
+   * }
+   * 
* @return expression * @see Style specification */ @@ -593,7 +1070,17 @@ public class Expression { /** * Gets the feature's geometry type: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon. - * + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(concat(get("key-to-value"), literal(" "), geometryType())
+   * );
+   * }
+   * 
* @return expression * @see Style specification */ @@ -603,6 +1090,17 @@ public class Expression { /** * Gets the feature's id, if it has one. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(id())
+   * );
+   * }
+   * 
* * @return expression * @see Style specification @@ -615,6 +1113,24 @@ public class Expression { * Gets the kernel density estimation of a pixel in a heatmap layer, * which is a relative measure of how many data points are crowded around a particular pixel. * Can only be used in the `heatmap-color` property. + *

+ * Example usage: + *

+ *
+   * {@code
+   * HeatmapLayer layer = new HeatmapLayer("layer-id", "source-id");
+   * layer.setProperties(
+   *     heatmapColor(interpolate(linear(), heatmapDensity(),
+   *         literal(0), rgba(33, 102, 172, 0),
+   *         literal(0.2), rgb(103, 169, 207),
+   *         literal(0.4), rgb(209, 229, 240),
+   *         literal(0.6), rgb(253, 219, 199),
+   *         literal(0.8), rgb(239, 138, 98),
+   *         literal(1), rgb(178, 24, 43)
+   *     )
+   * )
+   * }
+   * 
* * @return expression * @see Style specification @@ -651,6 +1167,17 @@ public class Expression { * Retrieves a property value from the current feature's properties, * or from another object if a second argument is provided. * Returns null if the requested property is missing. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(get("key-to-feature"))
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -664,6 +1191,17 @@ public class Expression { * Retrieves a property value from the current feature's properties, * or from another object if a second argument is provided. * Returns null if the requested property is missing. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(get("key-to-feature"))
+   * );
+   * }
+   * 
* * @param input string input * @return expression @@ -676,6 +1214,17 @@ public class Expression { /** * Retrieves a property value from another object. * Returns null if the requested property is missing. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(get("key-to-property", get("key-to-object")))
+   * );
+   * }
+   * 
* * @param key a property value key * @param object an expression object @@ -689,6 +1238,17 @@ public class Expression { /** * Retrieves a property value from another object. * Returns null if the requested property is missing. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(get("key-to-property", get("key-to-object")))
+   * );
+   * }
+   * 
* * @param key a property value key * @param object an expression object @@ -701,6 +1261,17 @@ public class Expression { /** * Tests for the presence of an property value in the current feature's properties. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     has(get("keyToValue"))
+   * );
+   * }
+   * 
* * @param key the expression property value key * @return expression @@ -712,6 +1283,17 @@ public class Expression { /** * Tests for the presence of an property value in the current feature's properties. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     has("keyToValue")
+   * );
+   * }
+   * 
* * @param key the property value key * @return expression @@ -723,6 +1305,17 @@ public class Expression { /** * Tests for the presence of an property value from another object. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     has(get("keyToValue"), get("keyToObject"))
+   * );
+   * }
+   * 
* * @param key the expression property value key * @param object an expression object @@ -735,6 +1328,17 @@ public class Expression { /** * Tests for the presence of an property value from another object. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setFilter(
+   *     has("keyToValue", get("keyToObject))
+   * );
+   * }
+   * 
* * @param key the property value key * @param object an expression object @@ -769,6 +1373,17 @@ public class Expression { /** * Returns mathematical constant ln(2). + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(product(literal(10.0f), ln2())))
+   * );
+   * }
+   * 
* * @return expression * @see Style specification @@ -779,6 +1394,17 @@ public class Expression { /** * Returns the mathematical constant pi. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(product(literal(10.0f), pi())))
+   * );
+   * }
+   * 
* * @return expression * @see Style specification @@ -789,6 +1415,17 @@ public class Expression { /** * Returns the mathematical constant e. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(product(literal(10.0f), e())))
+   * );
+   * }
+   * 
* * @return expression * @see Style specification @@ -799,6 +1436,17 @@ public class Expression { /** * Returns the sum of the inputs. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(sum(literal(10.0f), ln2(), pi())))
+   * );
+   * }
+   * 
* * @param numbers the numbers to calculate the sum for * @return expression @@ -810,6 +1458,17 @@ public class Expression { /** * Returns the sum of the inputs. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(sum(10.0f, 5.0f, 3.0f)))
+   * );
+   * }
+   * 
* * @param numbers the numbers to calculate the sum for * @return expression @@ -825,6 +1484,17 @@ public class Expression { /** * Returns the product of the inputs. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(product(literal(10.0f), ln2())))
+   * );
+   * }
+   * 
* * @param numbers the numbers to calculate the product for * @return expression @@ -836,6 +1506,17 @@ public class Expression { /** * Returns the product of the inputs. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(product(10.0f, 2.0f)))
+   * );
+   * }
+   * 
* * @param numbers the numbers to calculate the product for * @return expression @@ -851,6 +1532,17 @@ public class Expression { /** * Returns the result of subtracting a number from 0. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(subtract(pi()))
+   * );
+   * }
+   * 
* * @param number the number subtract from 0 * @return expression @@ -862,6 +1554,17 @@ public class Expression { /** * Returns the result of subtracting a number from 0. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(subtract(10.0f))
+   * );
+   * }
+   * 
* * @param number the number subtract from 0 * @return expression @@ -873,6 +1576,17 @@ public class Expression { /** * Returns the result of subtracting the second input from the first. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(subtract(literal(10.0f), pi())))
+   * );
+   * }
+   * 
* * @param first the first number * @param second the second number @@ -885,6 +1599,17 @@ public class Expression { /** * Returns the result of subtracting the second input from the first. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(subtract(10.0f, 20.0f)))
+   * );
+   * }
+   * 
* * @param first the first number * @param second the second number @@ -897,6 +1622,17 @@ public class Expression { /** * Returns the result of floating point division of the first input by the second. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(division(literal(10.0f), pi())))
+   * );
+   * }
+   * 
* * @param first the first number * @param second the second number @@ -909,6 +1645,17 @@ public class Expression { /** * Returns the result of floating point division of the first input by the second. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(division(10.0f, 20.0f)))
+   * );
+   * }
+   * 
* * @param first the first number * @param second the second number @@ -921,11 +1668,22 @@ public class Expression { /** * Returns the remainder after integer division of the first input by the second. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(mod(literal(10.0f), pi()))
+   * );
+   * }
+   * 
* * @param first the first number * @param second the second number * @return expression - * @see Style specification + * @see Style specification */ public static Expression mod(@NonNull Expression first, @NonNull Expression second) { return new Expression("%", first, second); @@ -933,11 +1691,22 @@ public class Expression { /** * Returns the remainder after integer division of the first input by the second. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(mod(10.0f, 10.0f))
+   * );
+   * }
+   * 
* * @param first the first number * @param second the second number * @return expression - * @see Style specification + * @see Style specification */ public static Expression mod(@NonNull Number first, @NonNull Number second) { return mod(literal(first), literal(second)); @@ -945,11 +1714,22 @@ public class Expression { /** * Returns the result of raising the first input to the power specified by the second. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(pow(pi(), literal(2.0f))
+   * );
+   * }
+   * 
* * @param first the first number * @param second the second number * @return expression - * @see Style specification + * @see Style specification */ public static Expression pow(@NonNull Expression first, @NonNull Expression second) { return new Expression("^", first, second); @@ -957,11 +1737,22 @@ public class Expression { /** * Returns the result of raising the first input to the power specified by the second. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(pow(5.0f, 2.0f))
+   * );
+   * }
+   * 
* * @param first the first number * @param second the second number * @return expression - * @see Style specification + * @see Style specification */ public static Expression pow(@NonNull Number first, @NonNull Number second) { return pow(literal(first), literal(second)); @@ -969,6 +1760,17 @@ public class Expression { /** * Returns the square root of the input + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(sqrt(pi()))
+   * );
+   * }
+   * 
* * @param number the number to take the square root from * @return expression @@ -980,6 +1782,17 @@ public class Expression { /** * Returns the square root of the input + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(sqrt(25.0f))
+   * );
+   * }
+   * 
* * @param number the number to take the square root from * @return expression @@ -991,6 +1804,17 @@ public class Expression { /** * Returns the base-ten logarithm of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(log10(pi()))
+   * );
+   * }
+   * 
* * @param number the number to take base-ten logarithm from * @return expression @@ -1002,6 +1826,17 @@ public class Expression { /** * Returns the base-ten logarithm of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(log10(10))
+   * );
+   * }
+   * 
* * @param number the number to take base-ten logarithm from * @return expression @@ -1013,6 +1848,17 @@ public class Expression { /** * Returns the natural logarithm of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(ln(pi()))
+   * );
+   * }
+   * 
* * @param number the number to take natural logarithm from * @return expression @@ -1024,6 +1870,17 @@ public class Expression { /** * Returns the natural logarithm of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(ln(10))
+   * );
+   * }
+   * 
* * @param number the number to take natural logarithm from * @return expression @@ -1035,6 +1892,17 @@ public class Expression { /** * Returns the base-two logarithm of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(log2(pi()))
+   * );
+   * }
+   * 
* * @param number the number to take base-two logarithm from * @return expression @@ -1046,6 +1914,17 @@ public class Expression { /** * Returns the base-two logarithm of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(log2(2))
+   * );
+   * }
+   * 
* * @param number the number to take base-two logarithm from * @return expression @@ -1057,6 +1936,17 @@ public class Expression { /** * Returns the sine of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(sin(pi()))
+   * );
+   * }
+   * 
* * @param number the number to calculate the sine for * @return expression @@ -1068,6 +1958,17 @@ public class Expression { /** * Returns the sine of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(sin(90.0f))
+   * );
+   * }
+   * 
* * @param number the number to calculate the sine for * @return expression @@ -1079,6 +1980,17 @@ public class Expression { /** * Returns the cosine of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(cos(pi()))
+   * );
+   * }
+   * 
* * @param number the number to calculate the cosine for * @return expression @@ -1090,6 +2002,17 @@ public class Expression { /** * Returns the cosine of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(cos(0)))
+   * );
+   * }
+   * 
* * @param number the number to calculate the cosine for * @return expression @@ -1101,6 +2024,17 @@ public class Expression { /** * Returns the tangent of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(tan(pi()))
+   * );
+   * }
+   * 
* * @param number the number to calculate the tangent for * @return expression @@ -1112,6 +2046,17 @@ public class Expression { /** * Returns the tangent of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(tan(45.0f))
+   * );
+   * }
+   * 
* * @param number the number to calculate the tangent for * @return expression @@ -1123,6 +2068,17 @@ public class Expression { /** * Returns the arcsine of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(asin(pi()))
+   * );
+   * }
+   * 
* * @param number the number to calculate the arcsine for * @return expression @@ -1134,6 +2090,17 @@ public class Expression { /** * Returns the arcsine of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(asin(90))
+   * );
+   * }
+   * 
* * @param number the number to calculate the arcsine for * @return expression @@ -1145,6 +2112,17 @@ public class Expression { /** * Returns the arccosine of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(acos(pi()))
+   * );
+   * }
+   * 
* * @param number the number to calculate the arccosine for * @return expression @@ -1156,6 +2134,17 @@ public class Expression { /** * Returns the arccosine of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(acos(0))
+   * );
+   * }
+   * 
* * @param number the number to calculate the arccosine for * @return expression @@ -1167,6 +2156,17 @@ public class Expression { /** * Returns the arctangent of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(asin(pi()))
+   * );
+   * }
+   * 
* * @param number the number to calculate the arctangent for * @return expression @@ -1178,6 +2178,17 @@ public class Expression { /** * Returns the arctangent of the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(atan(90))
+   * );
+   * }
+   * 
* * @param number the number to calculate the arctangent for * @return expression @@ -1189,6 +2200,17 @@ public class Expression { /** * Returns the minimum value of the inputs. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(min(pi(), literal(3.14f), literal(3.15f))
+   * );
+   * }
+   * 
* * @param numbers varargs of numbers to get the minimum from * @return expression @@ -1200,6 +2222,17 @@ public class Expression { /** * Returns the minimum value of the inputs. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(min(3.141, 3.14f, 3.15f))
+   * );
+   * }
+   * 
* * @param numbers varargs of numbers to get the minimum from * @return expression @@ -1215,6 +2248,17 @@ public class Expression { /** * Returns the maximum value of the inputs. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(max(pi(), 3.14f, 3.15f))
+   * );
+   * }
+   * 
* * @param numbers varargs of numbers to get the maximum from * @return expression @@ -1226,6 +2270,17 @@ public class Expression { /** * Returns the maximum value of the inputs. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(max(3.141, 3.14f, 3.15f))
+   * );
+   * }
+   * 
* * @param numbers varargs of numbers to get the maximum from * @return expression @@ -1245,6 +2300,17 @@ public class Expression { * Follows the Unicode Default Case Conversion algorithm * and the locale-insensitive case mappings in the Unicode Character Database. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(upcase(get("key-to-string-value"))
+   * );
+   * }
+   * 
* * @param string the string to upcase * @return expression @@ -1260,6 +2326,17 @@ public class Expression { * Follows the Unicode Default Case Conversion algorithm * and the locale-insensitive case mappings in the Unicode Character Database. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(upcase("text"))
+   * );
+   * }
+   * 
* * @param string string to upcase * @return expression @@ -1275,6 +2352,17 @@ public class Expression { * Follows the Unicode Default Case Conversion algorithm * and the locale-insensitive case mappings in the Unicode Character Database. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(downcase(get("key-to-string-value"))
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -1290,6 +2378,17 @@ public class Expression { * Follows the Unicode Default Case Conversion algorithm * and the locale-insensitive case mappings in the Unicode Character Database. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(upcase("key-to-string-value")
+   * );
+   * }
+   * 
* * @param input string to downcase * @return expression @@ -1301,6 +2400,17 @@ public class Expression { /** * Returns a string consisting of the concatenation of the inputs. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(concat(get("key-to-string-value"), literal("other string"))
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -1312,6 +2422,17 @@ public class Expression { /** * Returns a string consisting of the concatenation of the inputs. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(concat("foo", "bar"))
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -1353,6 +2474,7 @@ public class Expression { * Asserts that the input value is a string. * If multiple values are provided, each one is evaluated in order until a string value is obtained. * If none of the inputs are strings, the expression is an error. + * The asserted input value is returned as result. * * @param input expression input * @return expression @@ -1366,6 +2488,7 @@ public class Expression { * Asserts that the input value is a number. * If multiple values are provided, each one is evaluated in order until a number value is obtained. * If none of the inputs are numbers, the expression is an error. + * The asserted input value is returned as result. * * @param input expression input * @return expression @@ -1379,6 +2502,7 @@ public class Expression { * Asserts that the input value is a boolean. * If multiple values are provided, each one is evaluated in order until a boolean value is obtained. * If none of the inputs are booleans, the expression is an error. + * The asserted input value is returned as result. * * @param input expression input * @return expression @@ -1390,6 +2514,7 @@ public class Expression { /** * Asserts that the input value is an object. If it is not, the expression is an error + * The asserted input value is returned as result. * * @param input expression input * @return expression @@ -1408,6 +2533,17 @@ public class Expression { * where `r`, `g`, and `b` are numerals ranging from 0 to 255, and `a` ranges from 0 to 1. * Otherwise, the input is converted to a string in the format specified by the JSON.stringify in the ECMAScript * Language Specification. + *

+ * Example usage: + *

+ *
+   * {@code
+   * SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
+   * symbolLayer.setProperties(
+   *     textField(toString(get("key-to-number-value")))
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -1424,6 +2560,17 @@ public class Expression { * If the input is a string, it is converted to a number as specified by the ECMAScript Language Specification. * If multiple values are provided, each one is evaluated in order until the first successful conversion is obtained. * If none of the inputs can be converted, the expression is an error. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(toNumber(get("key-to-string-value")))
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -1434,8 +2581,19 @@ public class Expression { } /** - * "Converts the input value to a boolean. The result is `false` when then input is an empty string, 0, false, + * Converts the input value to a boolean. The result is `false` when then input is an empty string, 0, false, * null, or NaN; otherwise it is true. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(toBool(get("key-to-value"));
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -1449,6 +2607,17 @@ public class Expression { * Converts the input value to a color. If multiple values are provided, * each one is evaluated in order until the first successful conversion is obtained. * If none of the inputs can be converted, the expression is an error. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new FillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(toColor(get("keyStringValue")))
+   * );
+   * }
+   * 
* * @param input expression input * @return expression @@ -1498,6 +2667,24 @@ public class Expression { * Note that in style layout and paint properties, * zoom may only appear as the input to a top-level step or interpolate expression. *

+ *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new fillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *       interpolate(
+   *         exponential(0.5f), zoom(),
+   *         literal(1.0f), color(Color.RED),
+   *         literal(5.0f, color(Color.BLUE),
+   *         literal(10.0f, color(Color.GREEN)
+   *       )
+   *     )
+   * );
+   * }
+   * 
* * @return expression * @see Style specification @@ -1508,6 +2695,21 @@ public class Expression { /** * Produces a stop value to be used as part of the step expression. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(
+   *         step(zoom(), literal(0.0f),
+   *         stop(1.0f, 2.5f),
+   *         stop(10.0f, 5.0f)
+   *     )
+   * );
+   * }
+   * 
* * @param stop the stop input * @param value the stop output @@ -1523,6 +2725,21 @@ public class Expression { * Stop inputs must be numeric literals in strictly ascending order. * Returns the output value of the stop just less than the input, * or the first input if the input is less than the first stop. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(
+   *         step(zoom(), literal(0.0f),
+   *         literal(1.0f), literal(2.5f),
+   *         literal(10.0f), literal(5.0f)
+   *     )
+   * );
+   * }
+   * 
* * @param input the input value * @param defaultOutput the default output expression @@ -1540,6 +2757,21 @@ public class Expression { * Stop inputs must be numeric literals in strictly ascending order. * Returns the output value of the stop just less than the input, * or the first input if the input is less than the first stop. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(
+   *         step(zoom(), literal(0.0f),
+   *         literal(1.0f), literal(2.5f),
+   *         literal(10.0f), literal(5.0f)
+   *     )
+   * );
+   * }
+   * 
* * @param input the input expression * @param defaultOutput the default output expression @@ -1557,6 +2789,21 @@ public class Expression { * Stop inputs must be numeric literals in strictly ascending order. * Returns the output value of the stop just less than the input, * or the first input if the input is less than the first stop. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(
+   *         step(zoom(), literal(0.0f),
+   *         stop(1, 2.5f),
+   *         stop(10, 5.0f)
+   *     )
+   * );
+   * }
+   * 
* * @param input the input value * @param defaultOutput the default output expression @@ -1574,6 +2821,21 @@ public class Expression { * Stop inputs must be numeric literals in strictly ascending order. * Returns the output value of the stop just less than the input, * or the first input if the input is less than the first stop. + *

+ * Example usage: + *

+ *
+   * {@code
+   * CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
+   * circleLayer.setProperties(
+   *     circleRadius(
+   *         step(zoom(), literal(0.0f),
+   *         stop(1, 2.5f),
+   *         stop(10, 5.0f)
+   *     )
+   * );
+   * }
+   * 
* * @param input the input value * @param defaultOutput the default output expression @@ -1590,6 +2852,24 @@ public class Expression { * The `input` may be any numeric expression (e.g., `[\"get\", \"population\"]`). * Stop inputs must be numeric literals in strictly ascending order. * The output type must be `number`, `array<number>`, or `color`. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new fillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *       interpolate(
+   *         exponential(0.5f), zoom(),
+   *         literal(1.0f), color(Color.RED),
+   *         literal(5.0f, color(Color.BLUE),
+   *         literal(10.0f, color(Color.GREEN)
+   *       )
+   *     )
+   * );
+   * }
+   * 
* * @param interpolation type of interpolation * @param number the input expression @@ -1607,6 +2887,24 @@ public class Expression { * The `input` may be any numeric expression (e.g., `[\"get\", \"population\"]`). * Stop inputs must be numeric literals in strictly ascending order. * The output type must be `number`, `array<number>`, or `color`. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new fillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *       interpolate(
+   *         exponential(0.5f), zoom(),
+   *         literal(1.0f), color(Color.RED),
+   *         literal(5.0f, color(Color.BLUE),
+   *         literal(10.0f, color(Color.GREEN)
+   *       )
+   *     )
+   * );
+   * }
+   * 
* * @param interpolation type of interpolation * @param number the input expression @@ -1621,6 +2919,24 @@ public class Expression { /** * interpolates linearly between the pair of stops just less than and just greater than the input. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new fillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *       interpolate(
+   *         linear(), zoom(),
+   *         literal(1.0f), color(Color.RED),
+   *         literal(5.0f, color(Color.BLUE),
+   *         literal(10.0f, color(Color.GREEN)
+   *       )
+   *     )
+   * );
+   * }
+   * 
* * @return expression * @see Style specification @@ -1634,6 +2950,24 @@ public class Expression { * `base` controls the rate at which the output increases: * higher values make the output increase more towards the high end of the range. * With values close to 1 the output increases linearly. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new fillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *       interpolate(
+   *         exponential(0.5f), zoom(),
+   *         literal(1.0f), color(Color.RED),
+   *         literal(5.0f, color(Color.BLUE),
+   *         literal(10.0f, color(Color.GREEN)
+   *       )
+   *     )
+   * );
+   * }
+   * 
* * @param base value controlling the route at which the output increases * @return expression @@ -1648,7 +2982,24 @@ public class Expression { * The parameter controls the rate at which the output increases: * higher values make the output increase more towards the high end of the range. * With values close to 1 the output increases linearly. - * + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new fillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *       interpolate(
+   *         exponential(get("keyToValue"), zoom(),
+   *         literal(1.0f), color(Color.RED),
+   *         literal(5.0f, color(Color.BLUE),
+   *         literal(10.0f, color(Color.GREEN)
+   *       )
+   *     )
+   * );
+   * }
+   * 
* @param expression base number expression * @return expression * @see Style specification @@ -1659,6 +3010,24 @@ public class Expression { /** * Interpolates using the cubic bezier curve defined by the given control points. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new fillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *       interpolate(
+   *         cubicBezier(0.42f, 0.0f, 1.0f, 1.0f), zoom(),
+   *         literal(1.0f), color(Color.RED),
+   *         literal(5.0f, color(Color.BLUE),
+   *         literal(10.0f, color(Color.GREEN)
+   *       )
+   *     )
+   * );
+   * }
+   * 
* * @param x1 x value of the first point of a cubic bezier, ranges from 0 to 1 * @param y1 y value of the first point of a cubic bezier, ranges from 0 to 1 @@ -1674,6 +3043,24 @@ public class Expression { /** * Interpolates using the cubic bezier curve defined by the given control points. + *

+ * Example usage: + *

+ *
+   * {@code
+   * FillLayer fillLayer = new fillLayer("layer-id", "source-id");
+   * fillLayer.setProperties(
+   *     fillColor(
+   *       interpolate(
+   *         cubicBezier(0.42f, 0.0f, 1.0f, 1.0f), zoom(),
+   *         literal(1.0f), color(Color.RED),
+   *         literal(5.0f, color(Color.BLUE),
+   *         literal(10.0f, color(Color.GREEN)
+   *       )
+   *     )
+   * );
+   * }
+   * 
* * @param x1 x value of the first point of a cubic bezier, ranges from 0 to 1 * @param y1 y value of the first point of a cubic bezier, ranges from 0 to 1 @@ -1999,6 +3386,9 @@ public class Expression { } } + /** + * Expression to wrap Object[] as a literal + */ private static class ExpressionArray extends Expression { private Object[] array;