Package tech.tablesaw.columns.times
Class PackedLocalTime
- java.lang.Object
-
- tech.tablesaw.columns.times.PackedLocalTime
-
public class PackedLocalTime extends Object
A localTime with millisecond precision packed into a single int value.The bytes are packed into the int as: First byte: hourOfDay next byte: minuteOfHour last two bytes (short): millisecond of minute
Storing the millisecond of minute in an short requires that we treat the short as if it were unsigned. Unfortunately, Neither Java nor Guava provide unsigned short support so we use char, which is a 16-bit unsigned int to store values of up to 60,000 milliseconds (60 secs * 1000)
-
-
Constructor Summary
Constructors Constructor Description PackedLocalTime()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
AM(int packedTime)
Returns true if the time is in the AM or "before noon".static LocalTime
asLocalTime(int time)
static byte
getHour(int time)
static int
getMillisecondOfDay(int packedLocalTime)
static char
getMillisecondOfMinute(int time)
static int
getMilliseconds(int time)
static byte
getMinute(int time)
static int
getMinuteOfDay(int packedLocalTime)
static int
getNano(int time)
static byte
getSecond(int packedLocalTime)
static int
getSecondOfDay(int packedLocalTime)
static int
hoursUntil(int packedTimeEnd, int packedTimeStart)
static boolean
isAfter(int packedTime, int otherPackedTime)
static boolean
isBefore(int packedTime, int otherPackedTime)
static boolean
isEqualTo(int packedTime, int otherPackedTime)
static boolean
isMidnight(int packedTime)
static boolean
isNoon(int packedTime)
static boolean
isOnOrAfter(int packedTime, int otherPackedTime)
static boolean
isOnOrBefore(int packedTime, int otherPackedTime)
static int
minusHours(int hoursToSubtract, int packedTime)
static int
minusMilliseconds(int millisToSubtract, int packedTime)
static int
minusMinutes(int minutesToSubtract, int packedTime)
static int
minusSeconds(int secondsToSubtract, int packedTime)
static int
minutesUntil(int packedTimeEnd, int packedTimeStart)
static int
of(int hour, int minute)
static int
of(int hour, int minute, int second)
static int
of(int hour, int minute, int second, int millis)
static int
pack(LocalTime time)
static int
plusHours(int hoursToAdd, int packedTime)
static int
plusMilliseconds(int msToAdd, int packedTime)
static int
plusMinutes(int minutesToAdd, int packedTime)
static int
plusSeconds(int secondsToAdd, int packedTime)
static boolean
PM(int packedTime)
Returns true if the time is in the PM or "after noon".static int
secondsUntil(int packedTimeEnd, int packedTimeStart)
static long
toNanoOfDay(int time)
static String
toShortTimeString(int time)
static int
truncatedTo(TemporalUnit unit, int packedTime)
static int
withHour(int hour, int packedTime)
static int
withMillisecond(int milliseconds, int packedTime)
static int
withMinute(int minute, int packedTime)
static int
withSecond(int second, int packedTime)
-
-
-
Method Detail
-
getHour
public static byte getHour(int time)
-
of
public static int of(int hour, int minute)
-
of
public static int of(int hour, int minute, int second)
-
of
public static int of(int hour, int minute, int second, int millis)
-
truncatedTo
public static int truncatedTo(TemporalUnit unit, int packedTime)
-
plusHours
public static int plusHours(int hoursToAdd, int packedTime)
-
plusMinutes
public static int plusMinutes(int minutesToAdd, int packedTime)
-
plusSeconds
public static int plusSeconds(int secondsToAdd, int packedTime)
-
plusMilliseconds
public static int plusMilliseconds(int msToAdd, int packedTime)
-
minusHours
public static int minusHours(int hoursToSubtract, int packedTime)
-
minusMinutes
public static int minusMinutes(int minutesToSubtract, int packedTime)
-
minusSeconds
public static int minusSeconds(int secondsToSubtract, int packedTime)
-
minusMilliseconds
public static int minusMilliseconds(int millisToSubtract, int packedTime)
-
withHour
public static int withHour(int hour, int packedTime)
-
withMinute
public static int withMinute(int minute, int packedTime)
-
withSecond
public static int withSecond(int second, int packedTime)
-
withMillisecond
public static int withMillisecond(int milliseconds, int packedTime)
-
getMillisecondOfMinute
public static char getMillisecondOfMinute(int time)
-
getNano
public static int getNano(int time)
-
getMilliseconds
public static int getMilliseconds(int time)
-
toNanoOfDay
public static long toNanoOfDay(int time)
-
asLocalTime
public static LocalTime asLocalTime(int time)
-
getMinute
public static byte getMinute(int time)
-
pack
public static int pack(LocalTime time)
-
getSecond
public static byte getSecond(int packedLocalTime)
-
getMinuteOfDay
public static int getMinuteOfDay(int packedLocalTime)
-
getSecondOfDay
public static int getSecondOfDay(int packedLocalTime)
-
getMillisecondOfDay
public static int getMillisecondOfDay(int packedLocalTime)
-
toShortTimeString
public static String toShortTimeString(int time)
-
isMidnight
public static boolean isMidnight(int packedTime)
-
isNoon
public static boolean isNoon(int packedTime)
-
isAfter
public static boolean isAfter(int packedTime, int otherPackedTime)
-
isOnOrAfter
public static boolean isOnOrAfter(int packedTime, int otherPackedTime)
-
isBefore
public static boolean isBefore(int packedTime, int otherPackedTime)
-
isOnOrBefore
public static boolean isOnOrBefore(int packedTime, int otherPackedTime)
-
isEqualTo
public static boolean isEqualTo(int packedTime, int otherPackedTime)
-
AM
public static boolean AM(int packedTime)
Returns true if the time is in the AM or "before noon". Note: we follow the convention that 12:00 NOON is PM and 12 MIDNIGHT is AM
-
PM
public static boolean PM(int packedTime)
Returns true if the time is in the PM or "after noon". Note: we follow the convention that 12:00 NOON is PM and 12 MIDNIGHT is AM
-
hoursUntil
public static int hoursUntil(int packedTimeEnd, int packedTimeStart)
-
minutesUntil
public static int minutesUntil(int packedTimeEnd, int packedTimeStart)
-
secondsUntil
public static int secondsUntil(int packedTimeEnd, int packedTimeStart)
-
-