RLESparseResourceAllocation { public Resource getMinimumCapacityInInterval(ReservationInterval interval) { Resource minCapacity = Resource.newInstance(Integer.MAX_VALUE, Integer.MAX_VALUE); long start = interval.getStartTime(); long end = interval.getEndTime(); NavigableMap<Long, Resource> capacityRange = getRangeOverlapping(start, end).getCumulative(); if (!capacityRange.isEmpty()) { for (Map.Entry<Long, Resource> entry : capacityRange.entrySet()) { if (entry.getValue() != null) { minCapacity = Resources.componentwiseMin(minCapacity, entry.getValue()); } } } return minCapacity; } RLESparseResourceAllocation(ResourceCalculator resourceCalculator);  RLESparseResourceAllocation(NavigableMap<Long, Resource> out,
      ResourceCalculator resourceCalculator); boolean addInterval(ReservationInterval reservationInterval,
      Resource totCap); boolean removeInterval(ReservationInterval reservationInterval,
      Resource totCap); Resource getCapacityAtTime(long tick); long getEarliestStartTime(); long getLatestNonNullTime(); boolean isEmpty(); @Override String toString(); Map<ReservationInterval, Resource> toIntervalMap(); NavigableMap<Long, Resource> getCumulative(); ResourceCalculator getResourceCalculator(); static RLESparseResourceAllocation merge(ResourceCalculator resCalc,
      Resource clusterResource, RLESparseResourceAllocation a,
      RLESparseResourceAllocation b, RLEOperator operator, long start, long end); RLESparseResourceAllocation getRangeOverlapping(long start, long end); void shift(long delta); Resource getMaximumPeriodicCapacity(long tick, long period); Resource getMinimumCapacityInInterval(ReservationInterval interval);  }
@Test public void testGetMinimumCapacityInInterval() { long[] timeSteps = { 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L }; int[] alloc = { 2, 5, 7, 10, 3, 4, 0, 8 }; RLESparseResourceAllocation rleSparseVector = ReservationSystemTestUtil .generateRLESparseResourceAllocation(alloc, timeSteps); LOG.info(rleSparseVector.toString()); Assert.assertEquals(rleSparseVector.getMinimumCapacityInInterval( new ReservationInterval(1L, 3L)), Resource.newInstance(5, 5)); Assert.assertEquals(rleSparseVector.getMinimumCapacityInInterval( new ReservationInterval(2L, 5L)), Resource.newInstance(3, 3)); Assert.assertEquals(rleSparseVector.getMinimumCapacityInInterval( new ReservationInterval(1L, 7L)), Resource.newInstance(0, 0)); }