@Test public void slotFromFiner() throws GranularityException { Assert.assertEquals(0, Granularity.MIN_5.slotFromFinerSlot(0)); Assert.assertEquals(1, Granularity.MIN_5.slotFromFinerSlot(1)); Assert.assertEquals(4031, Granularity.MIN_5.slotFromFinerSlot(4031)); Assert.assertEquals(4032, Granularity.MIN_5.slotFromFinerSlot(4032)); Assert.assertEquals(0, Granularity.MIN_20.slotFromFinerSlot(0)); Assert.assertEquals(0, Granularity.MIN_20.slotFromFinerSlot(1)); Assert.assertEquals(0, Granularity.MIN_20.slotFromFinerSlot(2)); Assert.assertEquals(0, Granularity.MIN_20.slotFromFinerSlot(3)); Assert.assertEquals(1, Granularity.MIN_20.slotFromFinerSlot(4)); Assert.assertEquals(1006, Granularity.MIN_20.slotFromFinerSlot(4027)); Assert.assertEquals(1007, Granularity.MIN_20.slotFromFinerSlot(4028)); Assert.assertEquals(1007, Granularity.MIN_20.slotFromFinerSlot(4029)); Assert.assertEquals(1007, Granularity.MIN_20.slotFromFinerSlot(4030)); Assert.assertEquals(1007, Granularity.MIN_20.slotFromFinerSlot(4031)); Assert.assertEquals(1008, Granularity.MIN_20.slotFromFinerSlot(4032)); Assert.assertEquals(0, Granularity.MIN_60.slotFromFinerSlot(0)); Assert.assertEquals(0, Granularity.MIN_60.slotFromFinerSlot(1)); Assert.assertEquals(0, Granularity.MIN_60.slotFromFinerSlot(2)); Assert.assertEquals(1, Granularity.MIN_60.slotFromFinerSlot(3)); Assert.assertEquals(1, Granularity.MIN_60.slotFromFinerSlot(4)); Assert.assertEquals(1, Granularity.MIN_60.slotFromFinerSlot(5)); Assert.assertEquals(2, Granularity.MIN_60.slotFromFinerSlot(6)); Assert.assertEquals(333, Granularity.MIN_60.slotFromFinerSlot(1001)); Assert.assertEquals(334, Granularity.MIN_60.slotFromFinerSlot(1002)); Assert.assertEquals(334, Granularity.MIN_60.slotFromFinerSlot(1003)); Assert.assertEquals(334, Granularity.MIN_60.slotFromFinerSlot(1004)); Assert.assertEquals(335, Granularity.MIN_60.slotFromFinerSlot(1005)); Assert.assertEquals(335, Granularity.MIN_60.slotFromFinerSlot(1006)); Assert.assertEquals(335, Granularity.MIN_60.slotFromFinerSlot(1007)); Assert.assertEquals(336, Granularity.MIN_60.slotFromFinerSlot(1008)); Assert.assertEquals(0, Granularity.MIN_240.slotFromFinerSlot(0)); Assert.assertEquals(0, Granularity.MIN_240.slotFromFinerSlot(1)); Assert.assertEquals(0, Granularity.MIN_240.slotFromFinerSlot(2)); Assert.assertEquals(0, Granularity.MIN_240.slotFromFinerSlot(3)); Assert.assertEquals(1, Granularity.MIN_240.slotFromFinerSlot(4)); Assert.assertEquals(1, Granularity.MIN_240.slotFromFinerSlot(5)); Assert.assertEquals(1, Granularity.MIN_240.slotFromFinerSlot(6)); Assert.assertEquals(1, Granularity.MIN_240.slotFromFinerSlot(7)); Assert.assertEquals(2, Granularity.MIN_240.slotFromFinerSlot(8)); Assert.assertEquals(81, Granularity.MIN_240.slotFromFinerSlot(327)); Assert.assertEquals(82, Granularity.MIN_240.slotFromFinerSlot(328)); Assert.assertEquals(82, Granularity.MIN_240.slotFromFinerSlot(329)); Assert.assertEquals(82, Granularity.MIN_240.slotFromFinerSlot(330)); Assert.assertEquals(82, Granularity.MIN_240.slotFromFinerSlot(331)); Assert.assertEquals(83, Granularity.MIN_240.slotFromFinerSlot(332)); Assert.assertEquals(83, Granularity.MIN_240.slotFromFinerSlot(333)); Assert.assertEquals(83, Granularity.MIN_240.slotFromFinerSlot(334)); Assert.assertEquals(83, Granularity.MIN_240.slotFromFinerSlot(335)); Assert.assertEquals(84, Granularity.MIN_240.slotFromFinerSlot(336)); Assert.assertEquals(0, Granularity.MIN_1440.slotFromFinerSlot(0)); Assert.assertEquals(0, Granularity.MIN_1440.slotFromFinerSlot(1)); Assert.assertEquals(0, Granularity.MIN_1440.slotFromFinerSlot(2)); Assert.assertEquals(0, Granularity.MIN_1440.slotFromFinerSlot(3)); Assert.assertEquals(0, Granularity.MIN_1440.slotFromFinerSlot(4)); Assert.assertEquals(0, Granularity.MIN_1440.slotFromFinerSlot(5)); Assert.assertEquals(1, Granularity.MIN_1440.slotFromFinerSlot(6)); Assert.assertEquals(12, Granularity.MIN_1440.slotFromFinerSlot(77)); Assert.assertEquals(13, Granularity.MIN_1440.slotFromFinerSlot(78)); Assert.assertEquals(13, Granularity.MIN_1440.slotFromFinerSlot(79)); Assert.assertEquals(13, Granularity.MIN_1440.slotFromFinerSlot(80)); Assert.assertEquals(13, Granularity.MIN_1440.slotFromFinerSlot(81)); Assert.assertEquals(13, Granularity.MIN_1440.slotFromFinerSlot(82)); Assert.assertEquals(13, Granularity.MIN_1440.slotFromFinerSlot(83)); Assert.assertEquals(14, Granularity.MIN_1440.slotFromFinerSlot(84)); }
public int slotFromFinerSlot(int finerSlot) throws GranularityException { return (finerSlot * numSlots()) / this.finer().numSlots(); }
Granularity { public int slotFromFinerSlot(int finerSlot) throws GranularityException { return (finerSlot * numSlots()) / this.finer().numSlots(); } }
Granularity { public int slotFromFinerSlot(int finerSlot) throws GranularityException { return (finerSlot * numSlots()) / this.finer().numSlots(); } private  Granularity(String cf, int milliseconds, int numSlots, String shortName); }
Granularity { public int slotFromFinerSlot(int finerSlot) throws GranularityException { return (finerSlot * numSlots()) / this.finer().numSlots(); } 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 { public int slotFromFinerSlot(int finerSlot) throws GranularityException { return (finerSlot * numSlots()) / this.finer().numSlots(); } 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; }