Package com.mongodb.client.model.mql
Interface MqlNumber
- All Superinterfaces:
MqlValue
- All Known Subinterfaces:
MqlInteger
A number value in the context of the MongoDB Query
Language (MQL). Integers are a subset of
numbers, and so, for example, the integer 0 and the number 0 are
equal.
- Since:
- 4.9.0
-
Method Summary
Modifier and TypeMethodDescriptionabs()
The absolute value ofthis
value.The sum of addingthis
and theother
value.default MqlNumber
The sum of addingthis
and theother
value.The quotient of dividingthis
value by theother
value.default MqlNumber
The quotient of dividingthis
value by theother
value.The product of multiplyingthis
and theother
value.default MqlNumber
The product of multiplyingthis
and theother
value.<R extends MqlValue>
RpassNumberTo
(Function<? super MqlNumber, ? extends R> f) The result of passingthis
value to the provided function.round()
The integer result of roundingthis
to the nearest even value.round
(MqlInteger place) The result of roundingthis
toplace
decimal places using the "half to even" approach.The difference of subtracting theother
value fromthis
.default MqlNumber
The difference of subtracting theother
value fromthis
.<R extends MqlValue>
RswitchNumberOn
(Function<Branches<MqlNumber>, ? extends BranchesTerminal<MqlNumber, ? extends R>> mapping) The result of applying the provided switch mapping tothis
value.Methods inherited from interface com.mongodb.client.model.mql.MqlValue
asString, eq, equals, gt, gte, isArrayOr, isBooleanOr, isDateOr, isDocumentOr, isIntegerOr, isMapOr, isNumberOr, isStringOr, lt, lte, ne, passTo, switchOn
-
Method Details
-
multiply
The product of multiplyingthis
and theother
value.- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
multiply
The product of multiplyingthis
and theother
value.- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
divide
The quotient of dividingthis
value by theother
value. This is not integer division: dividing1
by2
will always yield0.5
.- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
divide
The quotient of dividingthis
value by theother
value. This is not integer division: dividing1
by2
will always yield0.5
.- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
add
The sum of addingthis
and theother
value.- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
add
The sum of addingthis
and theother
value.- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
subtract
The difference of subtracting theother
value fromthis
.- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
subtract
The difference of subtracting theother
value fromthis
.- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
max
- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
min
- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
round
MqlInteger round()The integer result of roundingthis
to the nearest even value.- Returns:
- the resulting value.
- Since server release
- 4.2
-
round
The result of roundingthis
toplace
decimal places using the "half to even" approach.- Parameters:
place
- the decimal place to round to, from -20 to 100, exclusive. Positive values specify the place to the right of the decimal point, while negative values, to the left.- Returns:
- the resulting value.
-
abs
MqlNumber abs()The absolute value ofthis
value.- Returns:
- the resulting value.
-
passNumberTo
The result of passingthis
value to the provided function. Equivalent tof.apply(this)
, and allows lambdas and static, user-defined functions to use the chaining syntax.- Type Parameters:
R
- the type of the resulting value.- Parameters:
f
- the function to apply.- Returns:
- the resulting value.
- See Also:
-
switchNumberOn
<R extends MqlValue> R switchNumberOn(Function<Branches<MqlNumber>, ? extends BranchesTerminal<MqlNumber, ? extends R>> mapping) The result of applying the provided switch mapping tothis
value.- Type Parameters:
R
- the type of the resulting value.- Parameters:
mapping
- the switch mapping.- Returns:
- the resulting value.
- See Also:
-