@@ -719,6 +719,51 @@ public Sinh sinh(AngularDimension unit) {
719
719
return usesFieldRef () ? Sinh .sinhOf (fieldReference , unit ) : Sinh .sinhOf (expression , unit );
720
720
}
721
721
722
+ /**
723
+ * Creates new {@link AggregationExpression} that calculates the tangent of a numeric value given in
724
+ * {@link AngularDimension#RADIANS radians}.
725
+ *
726
+ * @return new instance of {@link Sin}.
727
+ * @since 3.3
728
+ */
729
+ public Tan tan () {
730
+ return tan (AngularDimension .RADIANS );
731
+ }
732
+
733
+ /**
734
+ * Creates new {@link AggregationExpression} that calculates the tangent of a numeric value in the given
735
+ * {@link AngularDimension unit}.
736
+ *
737
+ * @param unit the unit of measure.
738
+ * @return new instance of {@link Sin}.
739
+ * @since 3.3
740
+ */
741
+ public Tan tan (AngularDimension unit ) {
742
+ return usesFieldRef () ? Tan .tanOf (fieldReference , unit ) : Tan .tanOf (expression , unit );
743
+ }
744
+
745
+ /**
746
+ * Creates new {@link AggregationExpression} that calculates the hyperbolic tangent of a numeric value given in
747
+ * {@link AngularDimension#RADIANS radians}.
748
+ *
749
+ * @return new instance of {@link Sin}.
750
+ * @since 3.3
751
+ */
752
+ public Tanh tanh () {
753
+ return tanh (AngularDimension .RADIANS );
754
+ }
755
+
756
+ /**
757
+ * Creates new {@link AggregationExpression} that calculates the hyperbolic tangent of a numeric value.
758
+ *
759
+ * @param unit the unit of measure.
760
+ * @return new instance of {@link Sin}.
761
+ * @since 3.3
762
+ */
763
+ public Tanh tanh (AngularDimension unit ) {
764
+ return usesFieldRef () ? Tanh .tanhOf (fieldReference , unit ) : Tanh .tanhOf (expression , unit );
765
+ }
766
+
722
767
private boolean usesFieldRef () {
723
768
return fieldReference != null ;
724
769
}
@@ -2153,4 +2198,210 @@ protected String getMongoMethod() {
2153
2198
return "$sinh" ;
2154
2199
}
2155
2200
}
2201
+
2202
+ /**
2203
+ * An {@link AggregationExpression expression} that calculates the tangent of a value that is measured in radians.
2204
+ *
2205
+ * @author Christoph Strobl
2206
+ * @since 3.3
2207
+ */
2208
+ public static class Tan extends AbstractAggregationExpression {
2209
+
2210
+ private Tan (Object value ) {
2211
+ super (value );
2212
+ }
2213
+
2214
+ /**
2215
+ * Creates a new {@link AggregationExpression} that calculates the tangent of a value that is measured in
2216
+ * {@link AngularDimension#RADIANS radians}.
2217
+ * <p />
2218
+ * Use {@code tanOf("angle", DEGREES)} as shortcut for
2219
+ *
2220
+ * <pre>
2221
+ * { $tan : { $degreesToRadians : "$angle" } }
2222
+ * </pre>
2223
+ *
2224
+ * .
2225
+ *
2226
+ * @param fieldReference the name of the {@link Field field} that resolves to a numeric value.
2227
+ * @return new instance of {@link Tan}.
2228
+ */
2229
+ public static Tan tanOf (String fieldReference ) {
2230
+ return tanOf (fieldReference , AngularDimension .RADIANS );
2231
+ }
2232
+
2233
+ /**
2234
+ * Creates a new {@link AggregationExpression} that calculates the tangent of a value that is measured in the given
2235
+ * {@link AngularDimension unit}.
2236
+ *
2237
+ * @param fieldReference the name of the {@link Field field} that resolves to a numeric value.
2238
+ * @param unit the unit of measure used by the value of the given field.
2239
+ * @return new instance of {@link Tan}.
2240
+ */
2241
+ public static Tan tanOf (String fieldReference , AngularDimension unit ) {
2242
+ return tan (Fields .field (fieldReference ), unit );
2243
+ }
2244
+
2245
+ /**
2246
+ * Creates a new {@link AggregationExpression} that calculates the tangent of a value that is measured in
2247
+ * {@link AngularDimension#RADIANS}.
2248
+ *
2249
+ * @param expression the {@link AggregationExpression expression} that resolves to a numeric value.
2250
+ * @return new instance of {@link Tan}.
2251
+ */
2252
+ public static Tan tanOf (AggregationExpression expression ) {
2253
+ return tanOf (expression , AngularDimension .RADIANS );
2254
+ }
2255
+
2256
+ /**
2257
+ * Creates a new {@link AggregationExpression} that calculates the tangent of a value that is measured in the given
2258
+ * {@link AngularDimension unit}.
2259
+ *
2260
+ * @param expression the {@link AggregationExpression expression} that resolves to a numeric value.
2261
+ * @param unit the unit of measure used by the value of the given field.
2262
+ * @return new instance of {@link Tan}.
2263
+ */
2264
+ public static Tan tanOf (AggregationExpression expression , AngularDimension unit ) {
2265
+ return tan (expression , unit );
2266
+ }
2267
+
2268
+ /**
2269
+ * Creates a new {@link AggregationExpression} that calculates the tangent of a value that is measured in
2270
+ * {@link AngularDimension#RADIANS}.
2271
+ *
2272
+ * @param value anything ({@link Field field}, {@link AggregationExpression expression}, ...) that resolves to a
2273
+ * numeric value
2274
+ * @return new instance of {@link Tan}.
2275
+ */
2276
+ public static Tan tan (Object value ) {
2277
+ return tan (value , AngularDimension .RADIANS );
2278
+ }
2279
+
2280
+ /**
2281
+ * Creates a new {@link AggregationExpression} that calculates the tangent of a value that is measured in the given
2282
+ * {@link AngularDimension unit}.
2283
+ *
2284
+ * @param value anything ({@link Field field}, {@link AggregationExpression expression}, ...) that resolves to a
2285
+ * numeric value.
2286
+ * @param unit the unit of measure used by the value of the given field.
2287
+ * @return new instance of {@link Tan}.
2288
+ */
2289
+ public static Tan tan (Object value , AngularDimension unit ) {
2290
+
2291
+ if (ObjectUtils .nullSafeEquals (AngularDimension .DEGREES , unit )) {
2292
+ return new Tan (ConvertOperators .DegreesToRadians .degreesToRadians (value ));
2293
+ }
2294
+ return new Tan (value );
2295
+ }
2296
+
2297
+ @ Override
2298
+ protected String getMongoMethod () {
2299
+ return "$tan" ;
2300
+ }
2301
+ }
2302
+
2303
+ /**
2304
+ * An {@link AggregationExpression expression} that calculates the hyperbolic tangent of a value that is measured in
2305
+ * {@link AngularDimension#RADIANS}.
2306
+ *
2307
+ * @author Christoph Strobl
2308
+ * @since 3.3
2309
+ */
2310
+ public static class Tanh extends AbstractAggregationExpression {
2311
+
2312
+ private Tanh (Object value ) {
2313
+ super (value );
2314
+ }
2315
+
2316
+ /**
2317
+ * Creates a new {@link AggregationExpression} that calculates the hyperbolic tangent of a value that is measured in
2318
+ * {@link AngularDimension#RADIANS}.
2319
+ *
2320
+ * @param fieldReference the name of the {@link Field field} that resolves to a numeric value.
2321
+ * @return new instance of {@link Tanh}.
2322
+ */
2323
+ public static Tanh tanhOf (String fieldReference ) {
2324
+ return tanhOf (fieldReference , AngularDimension .RADIANS );
2325
+ }
2326
+
2327
+ /**
2328
+ * Creates a new {@link AggregationExpression} that calculates the hyperbolic tangent of a value that is measured in
2329
+ * the given {@link AngularDimension unit}.
2330
+ * <p />
2331
+ * Use {@code tanhOf("angle", DEGREES)} as shortcut for
2332
+ *
2333
+ * <pre>
2334
+ * { $tanh : { $degreesToRadians : "$angle" } }
2335
+ * </pre>
2336
+ *
2337
+ * .
2338
+ *
2339
+ * @param fieldReference the name of the {@link Field field} that resolves to a numeric value.
2340
+ * @param unit the unit of measure used by the value of the given field.
2341
+ * @return new instance of {@link Tanh}.
2342
+ */
2343
+ public static Tanh tanhOf (String fieldReference , AngularDimension unit ) {
2344
+ return tanh (Fields .field (fieldReference ), unit );
2345
+ }
2346
+
2347
+ /**
2348
+ * Creates a new {@link AggregationExpression} that calculates the hyperbolic tangent of a value that is measured in
2349
+ * {@link AngularDimension#RADIANS}.
2350
+ * <p />
2351
+ * Use {@code sinhOf("angle", DEGREES)} as shortcut for eg.
2352
+ * {@code sinhOf(ConvertOperators.valueOf("angle").degreesToRadians())}.
2353
+ *
2354
+ * @param expression the {@link AggregationExpression expression} that resolves to a numeric value.
2355
+ * @return new instance of {@link Tanh}.
2356
+ */
2357
+ public static Tanh tanhOf (AggregationExpression expression ) {
2358
+ return tanhOf (expression , AngularDimension .RADIANS );
2359
+ }
2360
+
2361
+ /**
2362
+ * Creates a new {@link AggregationExpression} that calculates the hyperbolic tangent of a value that is measured in
2363
+ * the given {@link AngularDimension unit}.
2364
+ *
2365
+ * @param expression the {@link AggregationExpression expression} that resolves to a numeric value.
2366
+ * @param unit the unit of measure used by the value of the given field.
2367
+ * @return new instance of {@link Tanh}.
2368
+ */
2369
+ public static Tanh tanhOf (AggregationExpression expression , AngularDimension unit ) {
2370
+ return tanh (expression , unit );
2371
+ }
2372
+
2373
+ /**
2374
+ * Creates a new {@link AggregationExpression} that calculates the hyperbolic tangent of a value that is measured in
2375
+ * {@link AngularDimension#RADIANS}.
2376
+ *
2377
+ * @param value anything ({@link Field field}, {@link AggregationExpression expression}, ...) that resolves to a
2378
+ * numeric value.
2379
+ * @return new instance of {@link Tanh}.
2380
+ */
2381
+ public static Tanh tanh (Object value ) {
2382
+ return tanh (value , AngularDimension .RADIANS );
2383
+ }
2384
+
2385
+ /**
2386
+ * Creates a new {@link AggregationExpression} that calculates the hyperbolic tangent of a value that is measured in
2387
+ * the given {@link AngularDimension unit}.
2388
+ *
2389
+ * @param value anything ({@link Field field}, {@link AggregationExpression expression}, ...) that resolves to a
2390
+ * numeric value
2391
+ * @param unit the unit of measure used by the value of the given field.
2392
+ * @return new instance of {@link Tanh}.
2393
+ */
2394
+ public static Tanh tanh (Object value , AngularDimension unit ) {
2395
+
2396
+ if (ObjectUtils .nullSafeEquals (AngularDimension .DEGREES , unit )) {
2397
+ return new Tanh (ConvertOperators .DegreesToRadians .degreesToRadians (value ));
2398
+ }
2399
+ return new Tanh (value );
2400
+ }
2401
+
2402
+ @ Override
2403
+ protected String getMongoMethod () {
2404
+ return "$tanh" ;
2405
+ }
2406
+ }
2156
2407
}
0 commit comments