public final class Frequency extends Object implements RichComparable<Frequency>
Note: this class is mainly intended to be used for lambda, which represents THz order. Long has enough space to represent over THz frequency as Hz, and the underlying value is long as Hz. This means this class can't represent sub-Hz accuracy.
Modifier and Type | Method and Description |
---|---|
Frequency |
add(Frequency value)
Returns a Frequency whose value is (this + value).
|
double |
asGHz()
Return the value this instance represents as GHz.
|
long |
asHz()
Return the value this instance represents as Hz.
|
double |
asKHz()
Return the value this instance represents as KHz.
|
double |
asMHz()
Return the value this instance represents as MHz.
|
double |
asTHz()
Return the value this instance represents as THz.
|
int |
compareTo(Frequency other) |
boolean |
equals(Object obj) |
Frequency |
floorDivision(long value)
Returns a Frequency whose value is Math.floorDiv(this, value).
|
int |
hashCode() |
Frequency |
multiply(long value)
Returns a Frequency whose value is (this * value).
|
static Frequency |
ofGHz(double value)
Returns an instance representing the specified value in GHz.
|
static Frequency |
ofGHz(long value)
Returns an instance representing the specified value in GHz.
|
static Frequency |
ofHz(long value)
Returns an instance representing the specified value in Hz.
|
static Frequency |
ofKHz(double value)
Returns an instance representing the specified value in KHz.
|
static Frequency |
ofKHz(long value)
Returns an instance representing the specified value in KHz.
|
static Frequency |
ofMHz(double value)
Returns an instance representing the specified value in MHz.
|
static Frequency |
ofMHz(long value)
Returns an instance representing the specified value in MHz.
|
static Frequency |
ofTHz(double value)
Returns an instance representing the specified value in THz.
|
static Frequency |
ofTHz(long value)
Returns an instance representing the specified value in THz.
|
Frequency |
subtract(Frequency value)
Returns a Frequency whose value is (this - value).
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isGreaterThan, isLessThan
public long asHz()
public double asKHz()
public double asMHz()
public double asGHz()
public double asTHz()
public static Frequency ofHz(long value)
value
- frequency in Hzpublic static Frequency ofKHz(long value)
value
- frequency in KHzpublic static Frequency ofKHz(double value)
value
- frequency in KHzpublic static Frequency ofMHz(long value)
value
- frequency in MHzpublic static Frequency ofMHz(double value)
value
- frequency in MHzpublic static Frequency ofGHz(long value)
value
- frequency in GHzpublic static Frequency ofGHz(double value)
value
- frequency in GHzpublic static Frequency ofTHz(long value)
value
- frequency in THzpublic static Frequency ofTHz(double value)
value
- frequency in THzpublic Frequency add(Frequency value)
value
- value to be added to this Frequencypublic Frequency subtract(Frequency value)
value
- value to be subtracted from this Frequencypublic Frequency multiply(long value)
value
- value to be multiplied by this Frequencypublic Frequency floorDivision(long value)
value
- value to be divided by this Frequencypublic int compareTo(Frequency other)
compareTo
in interface Comparable<Frequency>