-
- Type Parameters:
T- type to extract from
- All Superinterfaces:
Comparator<T>,Expression<T>,HasAbs<ToFloat<T>>,HasAsDouble<T>,HasAsInt<T>,HasAsLong<T>,HasCompare<T>,HasCompose<T>,HasDivide<T>,HasHash<T>,HasMap<T,FloatUnaryOperator,ToFloat<T>>,HasMapToDouble<T,FloatToDoubleFunction>,HasMinus<T>,HasMultiply<T>,HasNegate<ToFloat<T>>,HasPlus<T>,HasPow<T>,HasSign<ToByte<T>>,HasSqrt<ToDouble<T>>,ToFloatFunction<T>
- All Known Subinterfaces:
ToFloatOrElse<T>,ToFloatOrElseGet<T>,ToFloatOrThrow<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ToFloat<T> extends Expression<T>, ToFloatFunction<T>, HasAsDouble<T>, HasAsInt<T>, HasAsLong<T>, HasAbs<ToFloat<T>>, HasSign<ToByte<T>>, HasSqrt<ToDouble<T>>, HasNegate<ToFloat<T>>, HasPow<T>, HasPlus<T>, HasMinus<T>, HasMultiply<T>, HasDivide<T>, HasMap<T,FloatUnaryOperator,ToFloat<T>>, HasMapToDouble<T,FloatToDoubleFunction>, HasHash<T>, HasCompare<T>, HasCompose<T>
Expression that given an entity returns afloatvalue. This expression can be implemented using a lambda, or it can be a result of another operation. It has additional methods for operating on it.- Since:
- 3.1.0
- Author:
- Emil Forslund
- See Also:
ToFloatFunction
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ToFloat<T>abs()Returns a new expression that returns the absolute value of the result of the current expression.floatapplyAsFloat(T object)default ToDouble<T>asDouble()Returns an expression that casts the result of the current expression into adouble.default ToInt<T>asInt()Returns an expression that casts the result of the current expression into anint.default ToLong<T>asLong()Returns an expression that casts the result of the current expression into along.default intcompare(T first, T second)default <V> ToFloatNullable<V>compose(Function<? super V,? extends T> before)Returns a composed expression that first applies thebeforefunction to its input, and then applies this function to the result.default ToDouble<T>divide(double divisor)Creates and returns an expression that returns the quotient of the result from the current expression and the divisor.default ToDouble<T>divide(int divisor)Creates and returns an expression that returns the quotient of the result from the current expression and the divisor.default ToDouble<T>divide(long divisor)Creates and returns an expression that returns the quotient of the result from the current expression and the divisor.default ToDouble<T>divide(ToDouble<T> divisor)Creates and returns an expression that returns the quotient of the result from the current expression and the divisor.default ToDouble<T>divide(ToInt<T> divisor)Creates and returns an expression that returns the quotient of the result from the current expression and the divisor.default ToDouble<T>divide(ToLong<T> divisor)Creates and returns an expression that returns the quotient of the result from the current expression and the divisor.default ExpressionTypeexpressionType()Returns the expression type of this expression.default longhash(T object)Hash the specified object into a 64-bit hash.default ToFloat<T>map(FloatUnaryOperator operator)Returns an expression for the value of this expression mapped using the specified mapping function.default ToDouble<T>mapToDouble(FloatToDoubleFunction operator)Maps the result of this expression into adoubleby passing it to the specifiedmapper, producing a new expression that implementsToDouble.default ToFloat<T>minus(byte other)Creates and returns an expression that returns the difference of the result from the current expression and the other term.default ToDouble<T>minus(double other)Creates and returns an expression that returns the difference of the result from the current expression and the other term.default ToFloat<T>minus(int other)Creates and returns an expression that returns the difference of the result from the current expression and the other term.default ToDouble<T>minus(long other)Creates and returns an expression that returns the difference of the result from the current expression and the other term.default ToFloat<T>minus(ToByte<T> other)Creates and returns an expression that returns the difference of the result from the current expression and the other term.default ToDouble<T>minus(ToDouble<T> other)Creates and returns an expression that returns the difference of the result from the current expression and the other term.default ToFloat<T>minus(ToInt<T> other)Creates and returns an expression that returns the difference of the result from the current expression and the other term.default ToDouble<T>minus(ToLong<T> other)Creates and returns an expression that returns the difference of the result from the current expression and the other term.default ToFloat<T>multiply(byte other)Creates and returns an expression that returns the product of the result from the current expression and the other factor.default ToDouble<T>multiply(double other)Creates and returns an expression that returns the product of the result from the current expression and the other factor.default ToFloat<T>multiply(int other)Creates and returns an expression that returns the product of the result from the current expression and the other factor.default ToDouble<T>multiply(long other)Creates and returns an expression that returns the product of the result from the current expression and the other factor.default ToFloat<T>multiply(ToByte<T> other)Creates and returns an expression that returns the product of the result from the current expression and the other factor.default ToDouble<T>multiply(ToDouble<T> other)Creates and returns an expression that returns the product of the result from the current expression and the other factor.default ToFloat<T>multiply(ToInt<T> other)Creates and returns an expression that returns the product of the result from the current expression and the other factor.default ToDouble<T>multiply(ToLong<T> other)Creates and returns an expression that returns the product of the result from the current expression and the other factor.default ToFloat<T>negate()Returns a new expression that returns the absolute value of the result of the current expression.static <T> ToFloat<T>of(ToFloatFunction<T> lambda)Returns a typedToFloat<T>using the providedlambda.default ToFloat<T>plus(byte other)Creates and returns an expression that returns the sum of the result from the current expression and the other term.default ToDouble<T>plus(double other)Creates and returns an expression that returns the sum of the result from the current expression and the other term.default ToFloat<T>plus(int other)Creates and returns an expression that returns the sum of the result from the current expression and the other term.default ToDouble<T>plus(long other)Creates and returns an expression that returns the sum of the result from the current expression and the other term.default ToFloat<T>plus(ToByte<T> other)Creates and returns an expression that returns the sum of the result from the current expression and the other term.default ToDouble<T>plus(ToDouble<T> other)Creates and returns an expression that returns the sum of the result from the current expression and the other term.default ToFloat<T>plus(ToInt<T> other)Creates and returns an expression that returns the sum of the result from the current expression and the other term.default ToDouble<T>plus(ToLong<T> other)Creates and returns an expression that returns the sum of the result from the current expression and the other term.default ToDouble<T>pow(double power)Creates and returns an expression that returns the exponential power of the result from the current expression.default ToDouble<T>pow(int power)Creates and returns an expression that returns the exponential power of the result from the current expression.default ToDouble<T>pow(ToDouble<T> power)Creates and returns an expression that returns the exponential power of the result from the current expression.default ToDouble<T>pow(ToInt<T> power)Creates and returns an expression that returns the exponential power of the result from the current expression.default ToByte<T>sign()Creates and returns an expression that returns1if the result of the this expression is positive,-1if the result of this expression is negative and0if the result of this expression is0.default ToDouble<T>sqrt()Creates and returns an expression that returns the square root of the result from the current expression.-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Method Detail
-
of
static <T> ToFloat<T> of(ToFloatFunction<T> lambda)
Returns a typedToFloat<T>using the providedlambda.- Type Parameters:
T- type to extract from- Parameters:
lambda- to convert- Returns:
- a typed
ToFloat<T>using the providedlambda - Throws:
NullPointerException- if the providedlambdaisnull
-
applyAsFloat
float applyAsFloat(T object)
- Specified by:
applyAsFloatin interfaceToFloatFunction<T>
-
expressionType
default ExpressionType expressionType()
Description copied from interface:ExpressionReturns the expression type of this expression. It should be safe to cast this instance into the corresponding interface.- Specified by:
expressionTypein interfaceExpression<T>- Returns:
- the expression type
-
asDouble
default ToDouble<T> asDouble()
Description copied from interface:HasAsDoubleReturns an expression that casts the result of the current expression into adouble.- Specified by:
asDoublein interfaceHasAsDouble<T>- Returns:
- the casted expression
-
asInt
default ToInt<T> asInt()
Description copied from interface:HasAsIntReturns an expression that casts the result of the current expression into anint.
-
asLong
default ToLong<T> asLong()
Description copied from interface:HasAsLongReturns an expression that casts the result of the current expression into along.
-
mapToDouble
default ToDouble<T> mapToDouble(FloatToDoubleFunction operator)
Description copied from interface:HasMapToDoubleMaps the result of this expression into adoubleby passing it to the specifiedmapper, producing a new expression that implementsToDouble.- Specified by:
mapToDoublein interfaceHasMapToDouble<T,FloatToDoubleFunction>- Parameters:
operator- the mapper to use on the result of this expression- Returns:
- the new mapped expression
-
map
default ToFloat<T> map(FloatUnaryOperator operator)
Description copied from interface:HasMapReturns an expression for the value of this expression mapped using the specified mapping function. The input type remains the same.
-
abs
default ToFloat<T> abs()
Description copied from interface:HasAbsReturns a new expression that returns the absolute value of the result of the current expression.
-
sign
default ToByte<T> sign()
Description copied from interface:HasSignCreates and returns an expression that returns1if the result of the this expression is positive,-1if the result of this expression is negative and0if the result of this expression is0.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
sqrt
default ToDouble<T> sqrt()
Description copied from interface:HasSqrtCreates and returns an expression that returns the square root of the result from the current expression.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
negate
default ToFloat<T> negate()
Description copied from interface:HasNegateReturns a new expression that returns the absolute value of the result of the current expression. For an example, a positive value will become negative and a negative value will become positive.
-
pow
default ToDouble<T> pow(int power)
Description copied from interface:HasPowCreates and returns an expression that returns the exponential power of the result from the current expression. For an example, if the result of the current expression was-3and the power was set to2, then the result of the returned expression would be9.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
pow
default ToDouble<T> pow(double power)
Description copied from interface:HasPowCreates and returns an expression that returns the exponential power of the result from the current expression. For an example, if the result of the current expression was-3and the power was set to2, then the result of the returned expression would be9.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
pow
default ToDouble<T> pow(ToInt<T> power)
Description copied from interface:HasPowCreates and returns an expression that returns the exponential power of the result from the current expression. For an example, if the result of the current expression was-3and the power was set to2, then the result of the returned expression would be9.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
pow
default ToDouble<T> pow(ToDouble<T> power)
Description copied from interface:HasPowCreates and returns an expression that returns the exponential power of the result from the current expression. For an example, if the result of the current expression was-3and the power was set to2, then the result of the returned expression would be9.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
plus
default ToFloat<T> plus(byte other)
Description copied from interface:HasPlusCreates and returns an expression that returns the sum of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be12.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
plus
default ToFloat<T> plus(ToByte<T> other)
Description copied from interface:HasPlusCreates and returns an expression that returns the sum of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be12.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
plus
default ToFloat<T> plus(int other)
Description copied from interface:HasPlusCreates and returns an expression that returns the sum of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be12.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
plus
default ToFloat<T> plus(ToInt<T> other)
Description copied from interface:HasPlusCreates and returns an expression that returns the sum of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be12.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
plus
default ToDouble<T> plus(long other)
Description copied from interface:HasPlusCreates and returns an expression that returns the sum of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be12.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
plus
default ToDouble<T> plus(ToLong<T> other)
Description copied from interface:HasPlusCreates and returns an expression that returns the sum of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be12.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
plus
default ToDouble<T> plus(double other)
Description copied from interface:HasPlusCreates and returns an expression that returns the sum of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be12.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
plus
default ToDouble<T> plus(ToDouble<T> other)
Description copied from interface:HasPlusCreates and returns an expression that returns the sum of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be12.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
minus
default ToFloat<T> minus(byte other)
Description copied from interface:HasMinusCreates and returns an expression that returns the difference of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be6.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
minus
default ToFloat<T> minus(ToByte<T> other)
Description copied from interface:HasMinusCreates and returns an expression that returns the difference of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be6.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
minus
default ToFloat<T> minus(int other)
Description copied from interface:HasMinusCreates and returns an expression that returns the difference of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be6.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
minus
default ToFloat<T> minus(ToInt<T> other)
Description copied from interface:HasMinusCreates and returns an expression that returns the difference of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be6.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
minus
default ToDouble<T> minus(long other)
Description copied from interface:HasMinusCreates and returns an expression that returns the difference of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be6.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
minus
default ToDouble<T> minus(ToLong<T> other)
Description copied from interface:HasMinusCreates and returns an expression that returns the difference of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be6.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
minus
default ToDouble<T> minus(double other)
Description copied from interface:HasMinusCreates and returns an expression that returns the difference of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be6.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
minus
default ToDouble<T> minus(ToDouble<T> other)
Description copied from interface:HasMinusCreates and returns an expression that returns the difference of the result from the current expression and the other term. For an example, if the result of the current expression was9and the other term was set to3, then the result of the returned expression would be6.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
multiply
default ToFloat<T> multiply(byte other)
Description copied from interface:HasMultiplyCreates and returns an expression that returns the product of the result from the current expression and the other factor. For an example, if the result of the current expression was9and the factor was set to3, then the result of the returned expression would be27.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.- Specified by:
multiplyin interfaceHasMultiply<T>- Parameters:
other- the other factor used for the multiplication- Returns:
- the new expression
-
multiply
default ToFloat<T> multiply(ToByte<T> other)
Description copied from interface:HasMultiplyCreates and returns an expression that returns the product of the result from the current expression and the other factor. For an example, if the result of the current expression was9and the factor was set to3, then the result of the returned expression would be27.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.- Specified by:
multiplyin interfaceHasMultiply<T>- Parameters:
other- the other factor used for the multiplication- Returns:
- the new expression
-
multiply
default ToFloat<T> multiply(int other)
Description copied from interface:HasMultiplyCreates and returns an expression that returns the product of the result from the current expression and the other factor. For an example, if the result of the current expression was9and the factor was set to3, then the result of the returned expression would be27.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.- Specified by:
multiplyin interfaceHasMultiply<T>- Parameters:
other- the other factor used for the multiplication- Returns:
- the new expression
-
multiply
default ToFloat<T> multiply(ToInt<T> other)
Description copied from interface:HasMultiplyCreates and returns an expression that returns the product of the result from the current expression and the other factor. For an example, if the result of the current expression was9and the factor was set to3, then the result of the returned expression would be27.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.- Specified by:
multiplyin interfaceHasMultiply<T>- Parameters:
other- the other factor used for the multiplication- Returns:
- the new expression
-
multiply
default ToDouble<T> multiply(long other)
Description copied from interface:HasMultiplyCreates and returns an expression that returns the product of the result from the current expression and the other factor. For an example, if the result of the current expression was9and the factor was set to3, then the result of the returned expression would be27.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.- Specified by:
multiplyin interfaceHasMultiply<T>- Parameters:
other- the other factor used for the multiplication- Returns:
- the new expression
-
multiply
default ToDouble<T> multiply(ToLong<T> other)
Description copied from interface:HasMultiplyCreates and returns an expression that returns the product of the result from the current expression and the other factor. For an example, if the result of the current expression was9and the factor was set to3, then the result of the returned expression would be27.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.- Specified by:
multiplyin interfaceHasMultiply<T>- Parameters:
other- the other factor used for the multiplication- Returns:
- the new expression
-
multiply
default ToDouble<T> multiply(double other)
Description copied from interface:HasMultiplyCreates and returns an expression that returns the product of the result from the current expression and the other factor. For an example, if the result of the current expression was9and the factor was set to3, then the result of the returned expression would be27.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.- Specified by:
multiplyin interfaceHasMultiply<T>- Parameters:
other- the other factor used for the multiplication- Returns:
- the new expression
-
multiply
default ToDouble<T> multiply(ToDouble<T> other)
Description copied from interface:HasMultiplyCreates and returns an expression that returns the product of the result from the current expression and the other factor. For an example, if the result of the current expression was9and the factor was set to3, then the result of the returned expression would be27.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.- Specified by:
multiplyin interfaceHasMultiply<T>- Parameters:
other- the other factor used for the multiplication- Returns:
- the new expression
-
divide
default ToDouble<T> divide(int divisor)
Description copied from interface:HasDivideCreates and returns an expression that returns the quotient of the result from the current expression and the divisor. For an example, if the result of the current expression was9and the divisor was set to3, then the result of the returned expression would be3.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
divide
default ToDouble<T> divide(ToInt<T> divisor)
Description copied from interface:HasDivideCreates and returns an expression that returns the quotient of the result from the current expression and the divisor. For an example, if the result of the current expression was9and the divisor was set to3, then the result of the returned expression would be3.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
divide
default ToDouble<T> divide(long divisor)
Description copied from interface:HasDivideCreates and returns an expression that returns the quotient of the result from the current expression and the divisor. For an example, if the result of the current expression was9and the divisor was set to3, then the result of the returned expression would be3.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
divide
default ToDouble<T> divide(ToLong<T> divisor)
Description copied from interface:HasDivideCreates and returns an expression that returns the quotient of the result from the current expression and the divisor. For an example, if the result of the current expression was9and the divisor was set to3, then the result of the returned expression would be3.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
divide
default ToDouble<T> divide(double divisor)
Description copied from interface:HasDivideCreates and returns an expression that returns the quotient of the result from the current expression and the divisor. For an example, if the result of the current expression was9and the divisor was set to3, then the result of the returned expression would be3.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
divide
default ToDouble<T> divide(ToDouble<T> divisor)
Description copied from interface:HasDivideCreates and returns an expression that returns the quotient of the result from the current expression and the divisor. For an example, if the result of the current expression was9and the divisor was set to3, then the result of the returned expression would be3.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
hash
default long hash(T object)
Description copied from interface:HasHashHash the specified object into a 64-bit hash. If two equal objects are hashed, they must always result in the same hash. However, objects that are not equal may also result in the same hash.
-
compare
default int compare(T first, T second)
- Specified by:
comparein interfaceComparator<T>- Specified by:
comparein interfaceHasCompare<T>
-
compose
default <V> ToFloatNullable<V> compose(Function<? super V,? extends T> before)
Description copied from interface:HasComposeReturns a composed expression that first applies thebeforefunction to its input, and then applies this function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.- Specified by:
composein interfaceHasCompose<T>- Type Parameters:
V- the type of input to thebeforefunction, and to the composed expression- Parameters:
before- the function to apply before this function is applied- Returns:
- a composed function that first applies the
beforefunction and then applies this function
-
-