Package org.onlab.util
Class Frequency
- java.lang.Object
- 
- org.onlab.util.Frequency
 
- 
- All Implemented Interfaces:
- Comparable<Frequency>,- RichComparable<Frequency>
 
 public final class Frequency extends Object implements RichComparable<Frequency> Class representing frequency. This class is intended to be used for a value whose unit is Hz and its family (KHz, MHz, etc.).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. 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Frequencyadd(Frequency value)Returns a Frequency whose value is (this + value).doubleasGHz()Return the value this instance represents as GHz.longasHz()Return the value this instance represents as Hz.doubleasKHz()Return the value this instance represents as KHz.doubleasMHz()Return the value this instance represents as MHz.doubleasTHz()Return the value this instance represents as THz.intcompareTo(Frequency other)booleanequals(Object obj)FrequencyfloorDivision(long value)Returns a Frequency whose value is Math.floorDiv(this, value).inthashCode()Frequencymultiply(long value)Returns a Frequency whose value is (this * value).static FrequencyofGHz(double value)Returns an instance representing the specified value in GHz.static FrequencyofGHz(long value)Returns an instance representing the specified value in GHz.static FrequencyofHz(long value)Returns an instance representing the specified value in Hz.static FrequencyofKHz(double value)Returns an instance representing the specified value in KHz.static FrequencyofKHz(long value)Returns an instance representing the specified value in KHz.static FrequencyofMHz(double value)Returns an instance representing the specified value in MHz.static FrequencyofMHz(long value)Returns an instance representing the specified value in MHz.static FrequencyofTHz(double value)Returns an instance representing the specified value in THz.static FrequencyofTHz(long value)Returns an instance representing the specified value in THz.Frequencysubtract(Frequency value)Returns a Frequency whose value is (this - value).StringtoString()- 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.onlab.util.RichComparableisGreaterThan, isLessThan
 
- 
 
- 
- 
- 
Method Detail- 
asHzpublic long asHz() Return the value this instance represents as Hz.- Returns:
- frequency in Hz
 
 - 
asKHzpublic double asKHz() Return the value this instance represents as KHz.- Returns:
- frequency in kHz
 
 - 
asMHzpublic double asMHz() Return the value this instance represents as MHz.- Returns:
- frequency in MHz
 
 - 
asGHzpublic double asGHz() Return the value this instance represents as GHz.- Returns:
- frequency in GHz
 
 - 
asTHzpublic double asTHz() Return the value this instance represents as THz.- Returns:
- frequency in THz
 
 - 
ofHzpublic static Frequency ofHz(long value) Returns an instance representing the specified value in Hz.- Parameters:
- value- frequency in Hz
- Returns:
- instance representing the given frequency
 
 - 
ofKHzpublic static Frequency ofKHz(long value) Returns an instance representing the specified value in KHz.- Parameters:
- value- frequency in KHz
- Returns:
- instance representing the given frequency
 
 - 
ofKHzpublic static Frequency ofKHz(double value) Returns an instance representing the specified value in KHz.- Parameters:
- value- frequency in KHz
- Returns:
- instance representing the given frequency
 
 - 
ofMHzpublic static Frequency ofMHz(long value) Returns an instance representing the specified value in MHz.- Parameters:
- value- frequency in MHz
- Returns:
- instance representing the given frequency
 
 - 
ofMHzpublic static Frequency ofMHz(double value) Returns an instance representing the specified value in MHz.- Parameters:
- value- frequency in MHz
- Returns:
- instance representing the given frequency
 
 - 
ofGHzpublic static Frequency ofGHz(long value) Returns an instance representing the specified value in GHz.- Parameters:
- value- frequency in GHz
- Returns:
- instance representing the given frequency
 
 - 
ofGHzpublic static Frequency ofGHz(double value) Returns an instance representing the specified value in GHz.- Parameters:
- value- frequency in GHz
- Returns:
- instance representing the given frequency
 
 - 
ofTHzpublic static Frequency ofTHz(long value) Returns an instance representing the specified value in THz.- Parameters:
- value- frequency in THz
- Returns:
- instance representing the given frequency
 
 - 
ofTHzpublic static Frequency ofTHz(double value) Returns an instance representing the specified value in THz.- Parameters:
- value- frequency in THz
- Returns:
- instance representing the given frequency
 
 - 
addpublic Frequency add(Frequency value) Returns a Frequency whose value is (this + value).- Parameters:
- value- value to be added to this Frequency
- Returns:
- this + value
 
 - 
subtractpublic Frequency subtract(Frequency value) Returns a Frequency whose value is (this - value).- Parameters:
- value- value to be subtracted from this Frequency
- Returns:
- this - value
 
 - 
multiplypublic Frequency multiply(long value) Returns a Frequency whose value is (this * value).- Parameters:
- value- value to be multiplied by this Frequency
- Returns:
- this * value
 
 - 
floorDivisionpublic Frequency floorDivision(long value) Returns a Frequency whose value is Math.floorDiv(this, value).- Parameters:
- value- value to be divided by this Frequency
- Returns:
- Math.floorDiv(this, value)
 
 - 
compareTopublic int compareTo(Frequency other) - Specified by:
- compareToin interface- Comparable<Frequency>
 
 
- 
 
-