/** * @param timeRange The {@link TimeRange} to be checked * @return <code>true</code> if this layer's time range fully encapsulates the given range */ public boolean canFullyContain(TimeRange timeRange) { return getTotalRange().containsOrAlignsWith(timeRange); }
/** * Returns the range that the children of this cell will occupy, or null if * there are no children. */ public TimeRange getChildrenRange() { FrozenGranularityLayer child = layer.getChild(); if (child == null) { return null; } return child.getTotalRange().intersect(range); }
public boolean containsTimeAtGranularity(Time t, Granularity g) { return getFrozenLayer(g).getTotalRange().contains(t); }
/** * @param timeRange The {@link TimeRange} which defines the start and end time of the cell. * @return A {@link FrozenCell} within the given granularity. */ public FrozenCell getCell(TimeRange timeRange) { FrozenCell res = cells.get(timeRange); if (res != null) { return res; } Granularity gran = getGranularity(); Time rangeStart = timeRange.getStartTime(); if (rangeStart.alignsOnGranularity(gran) == false) { throw new IllegalArgumentException("Range [" + timeRange + "] does not belong to this granularity [" + gran + "]"); } if (!canFullyContain(timeRange)) { throw new IllegalArgumentException("Range [" + timeRange + "] is not currently in scope for granularity [" + gran + "] " + " which has a total range of [" + getTotalRange() + "]"); } res = new FrozenCell(this, timeRange); cells.put(timeRange, res); return res; }
TimeRange fillableRange = timeRange.intersect(getTotalRange()); if (fillableRange == null) { return Collections.emptyList();
/** * Returns a map from granularity to the oldest datapoint which should * exist for it. */ GranularityTimes getOldestAllowedTimeForGranularity() { Time now = timeSvc.nowNanoTime(); FrozenRollUpStructure frozenStruct = this.struct.freeze(now); GranularityTimes res = new GranularityTimes(); for (FrozenGranularityLayer layer : frozenStruct.getFrozenLayers()) { res.put(layer.getGranularity(), layer.getTotalRange().getStartTime()); } return res; }