@Test public void millisToSlotWithNegativeReturnsNegative() { Assert.assertEquals(0, Granularity.millisToSlot(-0)); Assert.assertEquals(0, Granularity.millisToSlot(-1)); Assert.assertEquals(0, Granularity.millisToSlot(-299999L)); Assert.assertEquals(-1, Granularity.millisToSlot(-300000L)); Assert.assertEquals(-1, Granularity.millisToSlot(-300001L)); Assert.assertEquals(-1, Granularity.millisToSlot(-599999L)); Assert.assertEquals(-2, Granularity.millisToSlot(-600000L)); Assert.assertEquals(-2, Granularity.millisToSlot(-600001L)); Assert.assertEquals(-4030, Granularity.millisToSlot(-1209299999L)); Assert.assertEquals(-4031, Granularity.millisToSlot(-1209300000L)); Assert.assertEquals(-4031, Granularity.millisToSlot(-1209300001L)); Assert.assertEquals(-4031, Granularity.millisToSlot(-1209599999L)); Assert.assertEquals(0, Granularity.millisToSlot(-1209600000L)); }
static int millisToSlot(long millis) { return (int)((millis % (BASE_SLOTS_PER_GRANULARITY * MILLISECONDS_IN_SLOT)) / MILLISECONDS_IN_SLOT); }
Granularity { static int millisToSlot(long millis) { return (int)((millis % (BASE_SLOTS_PER_GRANULARITY * MILLISECONDS_IN_SLOT)) / MILLISECONDS_IN_SLOT); } }
Granularity { static int millisToSlot(long millis) { return (int)((millis % (BASE_SLOTS_PER_GRANULARITY * MILLISECONDS_IN_SLOT)) / MILLISECONDS_IN_SLOT); } private  Granularity(String cf, int milliseconds, int numSlots, String shortName); }
Granularity { static int millisToSlot(long millis) { return (int)((millis % (BASE_SLOTS_PER_GRANULARITY * MILLISECONDS_IN_SLOT)) / MILLISECONDS_IN_SLOT); } private  Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int numSlots(); Granularity coarser(); Granularity finer(); boolean isCoarser(Granularity other); long snapMillis(long millis); int slot(long millis); int slotFromFinerSlot(int finerSlot); Range deriveRange(int slot, long referenceMillis); static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points); static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points, String algorithm, long assumedIntervalMillis); static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points, String algorithm, long assumedIntervalMillis, Clock ttlComparisonClock); @Override int hashCode(); @Override boolean equals(Object obj); static Granularity[] granularities(); static Granularity[] rollupGranularities(); static Granularity fromString(String s); static Granularity getRollupGranularity(String s); @Override String toString(); }
Granularity { static int millisToSlot(long millis) { return (int)((millis % (BASE_SLOTS_PER_GRANULARITY * MILLISECONDS_IN_SLOT)) / MILLISECONDS_IN_SLOT); } private  Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int numSlots(); Granularity coarser(); Granularity finer(); boolean isCoarser(Granularity other); long snapMillis(long millis); int slot(long millis); int slotFromFinerSlot(int finerSlot); Range deriveRange(int slot, long referenceMillis); static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points); static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points, String algorithm, long assumedIntervalMillis); static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points, String algorithm, long assumedIntervalMillis, Clock ttlComparisonClock); @Override int hashCode(); @Override boolean equals(Object obj); static Granularity[] granularities(); static Granularity[] rollupGranularities(); static Granularity fromString(String s); static Granularity getRollupGranularity(String s); @Override String toString(); static final int MILLISECONDS_IN_SLOT; static final Granularity FULL; static final Granularity MIN_5; static final Granularity MIN_20; static final Granularity MIN_60; static final Granularity MIN_240; static final Granularity MIN_1440; static final Granularity LAST; static final int MAX_NUM_SLOTS; }