@Test public void fromString20m() { String s = "metrics_20m"; Granularity gran = Granularity.fromString(s); Assert.assertNotNull(gran); Assert.assertSame(Granularity.MIN_20, gran); }
public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; }
Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } }
Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private  Granularity(String cf, int milliseconds, int numSlots, String shortName); }
Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } 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 static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } 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; }