Rework logical condition convenience expressions (#11555)

* [android] - rework expression logical operator api to match actual usage
This commit is contained in:
Tobrun
2018-04-04 12:41:34 +02:00
committed by Łukasz Paczos
parent 25d0f7157d
commit 5d8844152d
5 changed files with 49 additions and 49 deletions

View File

@@ -237,36 +237,36 @@ public class Expression {
/**
* Returns true if the input values are equal, false otherwise.
*
* @param compareOne the first boolean
* @param compareOne the first expression
* @param compareTwo the second boolean
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-==">Style specification</a>
*/
public static Expression eq(boolean compareOne, boolean compareTwo) {
public static Expression eq(Expression compareOne, boolean compareTwo) {
return eq(compareOne, literal(compareTwo));
}
/**
* Returns true if the input values are equal, false otherwise.
*
* @param compareOne the first expression
* @param compareTwo the second number
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-==">Style specification</a>
*/
public static Expression eq(@NonNull Expression compareOne, @NonNull String compareTwo) {
return eq(literal(compareOne), literal(compareTwo));
}
/**
* Returns true if the input values are equal, false otherwise.
*
* @param compareOne the first number
* @param compareOne the first expression
* @param compareTwo the second number
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-==">Style specification</a>
*/
public static Expression eq(@NonNull String compareOne, @NonNull String compareTwo) {
return eq(literal(compareOne), literal(compareTwo));
}
/**
* Returns true if the input values are equal, false otherwise.
*
* @param compareOne the first number
* @param compareTwo the second number
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-==">Style specification</a>
*/
public static Expression eq(@NonNull Number compareOne, @NonNull Number compareTwo) {
public static Expression eq(@NonNull Expression compareOne, @NonNull Number compareTwo) {
return eq(literal(compareOne), literal(compareTwo));
}
@@ -286,36 +286,36 @@ public class Expression {
/**
* Returns true if the input values are equal, false otherwise.
*
* @param compareOne the first boolean
* @param compareOne the first expression
* @param compareTwo the second boolean
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-!=">Style specification</a>
*/
public static Expression neq(boolean compareOne, boolean compareTwo) {
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.
*
* @param compareOne the first string
* @param compareOne the first expression
* @param compareTwo the second string
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-!=">Style specification</a>
*/
public static Expression neq(@NonNull String compareOne, @NonNull String compareTwo) {
public static Expression neq(@NonNull Expression compareOne, @NonNull String compareTwo) {
return new Expression("!=", literal(compareOne), literal(compareTwo));
}
/**
* Returns `true` if the input values are not equal, `false` otherwise.
*
* @param compareOne the first number
* @param compareOne the first expression
* @param compareTwo the second number
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-!=">Style specification</a>
*/
public static Expression neq(@NonNull Number compareOne, @NonNull Number compareTwo) {
public static Expression neq(@NonNull Expression compareOne, @NonNull Number compareTwo) {
return new Expression("!=", literal(compareOne), literal(compareTwo));
}
@@ -335,24 +335,24 @@ public class Expression {
/**
* Returns true if the first input is strictly greater than the second, false otherwise.
*
* @param compareOne the first number
* @param compareOne the first expression
* @param compareTwo the second number
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions->">Style specification</a>
*/
public static Expression gt(@NonNull Number compareOne, @NonNull Number compareTwo) {
public static Expression gt(@NonNull Expression compareOne, @NonNull Number compareTwo) {
return new Expression(">", literal(compareOne), literal(compareTwo));
}
/**
* Returns true if the first input is strictly greater than the second, false otherwise.
*
* @param compareOne the first string
* @param compareOne the first expression
* @param compareTwo the second string
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions->">Style specification</a>
*/
public static Expression gt(@NonNull String compareOne, @NonNull String compareTwo) {
public static Expression gt(@NonNull Expression compareOne, @NonNull String compareTwo) {
return new Expression(">", literal(compareOne), literal(compareTwo));
}
@@ -360,7 +360,7 @@ 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.
*
* @param compareOne the first number
* @param compareOne the first expression
* @param compareTwo the second number
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-<">Style specification</a>
@@ -372,24 +372,24 @@ public class Expression {
/**
* Returns true if the first input is strictly less than the second, false otherwise.
*
* @param compareOne the first number
* @param compareOne the first expression
* @param compareTwo the second number
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-<">Style specification</a>
*/
public static Expression lt(@NonNull Number compareOne, @NonNull Number compareTwo) {
public static Expression lt(@NonNull Expression compareOne, @NonNull Number compareTwo) {
return new Expression("<", literal(compareOne), literal(compareTwo));
}
/**
* Returns true if the first input is strictly less than the second, false otherwise.
*
* @param compareOne the first string
* @param compareOne the first expression
* @param compareTwo the second string
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-<">Style specification</a>
*/
public static Expression lt(@NonNull String compareOne, @NonNull String compareTwo) {
public static Expression lt(@NonNull Expression compareOne, @NonNull String compareTwo) {
return new Expression("<", literal(compareOne), literal(compareTwo));
}
@@ -409,24 +409,24 @@ public class Expression {
/**
* Returns true if the first input is greater than or equal to the second, false otherwise.
*
* @param compareOne the first number
* @param compareOne the first expression
* @param compareTwo the second number
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions->=">Style specification</a>
*/
public static Expression gte(@NonNull Number compareOne, @NonNull Number compareTwo) {
public static Expression gte(@NonNull Expression compareOne, @NonNull Number compareTwo) {
return new Expression(">=", literal(compareOne), literal(compareTwo));
}
/**
* Returns true if the first input is greater than or equal to the second, false otherwise.
*
* @param compareOne the first string
* @param compareOne the first expression
* @param compareTwo the second string
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions->=">Style specification</a>
*/
public static Expression gte(@NonNull String compareOne, @NonNull String compareTwo) {
public static Expression gte(@NonNull Expression compareOne, @NonNull String compareTwo) {
return new Expression(">=", literal(compareOne), literal(compareTwo));
}
@@ -446,24 +446,24 @@ public class Expression {
/**
* Returns true if the first input is less than or equal to the second, false otherwise.
*
* @param compareOne the first number
* @param compareOne the first expression
* @param compareTwo the second number
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-<=">Style specification</a>
*/
public static Expression lte(@NonNull Number compareOne, @NonNull Number compareTwo) {
public static Expression lte(@NonNull Expression compareOne, @NonNull Number compareTwo) {
return new Expression("<=", literal(compareOne), literal(compareTwo));
}
/**
* Returns true if the first input is less than or equal to the second, false otherwise.
*
* @param compareOne the first string
* @param compareOne the first expression
* @param compareTwo the second string
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-<=">Style specification</a>
*/
public static Expression lte(@NonNull String compareOne, @NonNull String compareTwo) {
public static Expression lte(@NonNull Expression compareOne, @NonNull String compareTwo) {
return new Expression("<=", literal(compareOne), literal(compareTwo));
}