-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIPowable.java
More file actions
64 lines (59 loc) · 1.4 KB
/
IPowable.java
File metadata and controls
64 lines (59 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.dz_fs_dev.physics;
/**
* The user of this interface should implement functionality such that the
* specified type can be exponentiated.
*
* @author DZ-FSDev
* @since 17.0.1
* @version 0.0.3
* @param <T> The type which should contain the ability to be exponentiated.
*/
public interface IPowable<T> {
/**
* Returns the square of this amount.
*
* @return The square of this amount.
* @since 0.0.1
*/
public default T squared() {
return this.pow(2);
}
/**
* Returns the cube of this amount.
*
* @return The cube of this amount.
* @since 0.0.2
*/
public default T cubed() {
return this.pow(3);
}
/**
* Returns the inverse of this amount.
*
* @return The inverse of this amount.
* @since 0.0.3
*/
public default T inverse() {
return this.pow(-1);
};
/**
* Returns new units that represent the specified exponentiation of this
* quantity.
*
* @param exponent The exponentiation to be applied.
* @return New quantity that represent the specified exponentiation of this
* quantity.
* @since 0.0.1
*/
public T pow(int exponent);
/**
* Returns new units that represent the specified exponentiation of this
* quantity.
*
* @param exponent The exponentiation to be applied.
* @return New quantity that represent the specified exponentiation of this
* quantity.
* @since 0.0.3
*/
public T pow(double exponent);
}