public class TimePoint extends Object implements Comparable<TimePoint>
| Constructor and Description |
|---|
TimePoint(long time,
TimeUnit unit,
TimePoint next)
Constructs a new
TimePoint |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(TimePoint o) |
static TimePoint |
findClosestAndWipe(TreeSet<? extends TimePoint> points,
TimePoint now)
|
String |
format()
Returns a formatted string with a minimum unit of
TimeUnit.NANOSECONDS |
String |
format(TimeUnit min)
Formats the current
TimePoint to be human-readable, specifying
either one or two units of measure depending on what is available |
long |
getAmount(TimeUnit unit)
Returns the relevant measure for the specified unit of time
|
TimePoint |
getNext()
Returns the next
TimePoint for this measure of time. |
TimePoint |
getNextNonZero()
Returns the next non-zero
TimePoint that can be found, or
null if there are no proceeding points of measure that are
non-null and non-zero |
TimePoint |
getPoint(TimeUnit unit)
|
long |
getTime()
Returns the magnitude (or measure) of the current unit for this point
|
static TimePoint |
getTimePoint(long diff)
Absolutely disgusting method of retrieving the largest non-zero times
difference in a nanosecond period.
|
TimeUnit |
getUnit()
Returns the relevant
TimeUnit for the measure in this point |
String |
properName()
Returns the proper name for the current unit relevant to this point
|
public long getAmount(TimeUnit unit)
public long getTime()
TimeUnitpublic TimeUnit getUnit()
TimeUnit for the measure in this pointTimeUnit to this current measurepublic TimePoint getNext()
TimePoint for this measure of time. For
instance, if the current TimePoint is a measure of minutes,
then the proceeding point will be a measure of secondsTimePoint in this chainpublic TimePoint getNextNonZero()
TimePoint that can be found, or
null if there are no proceeding points of measure that are
non-null and non-zeroTimePoint that is not zero, or nullpublic String properName()
TimeUnit in usepublic String format(TimeUnit min)
TimePoint to be human-readable, specifying
either one or two units of measure depending on what is availablemin - The minimum TimeUnit to outputpublic String format()
TimeUnit.NANOSECONDSformat(TimeUnit)public int compareTo(TimePoint o)
compareTo in interface Comparable<TimePoint>o - public static TimePoint findClosestAndWipe(TreeSet<? extends TimePoint> points, TimePoint now)
TimePoint in a
collection that is still of a greater value than the passed
TimePoint. This method also truncates the passed collection and
will modify its contents! However, if no values are found this method
will return null.points - The TimePoint objects to look through. Should be a
sorted collectionnow - The point of reference (ha!)public static TimePoint getTimePoint(long diff)
diff - The difference in nanoseconds between two pointsTimePoint representing the largest represented timeCopyright © 2015. All rights reserved.