@Test public void testResourceDimensionDivideAndRoundUp() throws Exception { ResourceDimension large = ResourceDimensionSample.SmallWithGpuAndOpportunisticX2.build(); ResourceDimension largePlus = ResourceDimensionSample.SmallWithGpuAndOpportunisticX2.builder().withCpus(large.getCpu() + 1).build(); ResourceDimension small = ResourceDimensionSample.SmallWithGpuAndOpportunistic.build(); assertThat(ResourceDimensions.divideAndRoundUp(large, small)).isEqualTo(2); assertThat(ResourceDimensions.divideAndRoundUp(largePlus, small)).isEqualTo(3); }
public static long divideAndRoundUp(ResourceDimension left, ResourceDimension right) { Pair<Long, ResourceDimension> result = divide(left, right); return result.getRight().equals(ResourceDimension.empty()) ? result.getLeft() : result.getLeft() + 1; }
ResourceDimensions { public static long divideAndRoundUp(ResourceDimension left, ResourceDimension right) { Pair<Long, ResourceDimension> result = divide(left, right); return result.getRight().equals(ResourceDimension.empty()) ? result.getLeft() : result.getLeft() + 1; } }
ResourceDimensions { public static long divideAndRoundUp(ResourceDimension left, ResourceDimension right) { Pair<Long, ResourceDimension> result = divide(left, right); return result.getRight().equals(ResourceDimension.empty()) ? result.getLeft() : result.getLeft() + 1; }  }
ResourceDimensions { public static long divideAndRoundUp(ResourceDimension left, ResourceDimension right) { Pair<Long, ResourceDimension> result = divide(left, right); return result.getRight().equals(ResourceDimension.empty()) ? result.getLeft() : result.getLeft() + 1; }  static ResourceDimension add(ResourceDimension... parts); static ResourceDimension add(Collection<ResourceDimension> parts); static ResourceDimension subtractPositive(ResourceDimension left, ResourceDimension right); static ResourceDimension multiply(ResourceDimension base, double multiplier); static Pair<Long, ResourceDimension> divide(ResourceDimension left, ResourceDimension right); static long divideAndRoundUp(ResourceDimension left, ResourceDimension right); static ResourceDimension alignUp(ResourceDimension source, ResourceDimension reference); static boolean isBigger(ResourceDimension dimension, ResourceDimension subDimension); static StringBuilder format(ResourceDimension input, StringBuilder output); static String format(ResourceDimension input); static ResourceDimension fromServerInfo(ServerInfo serverInfo); static ResourceDimension fromAwsInstanceType(AwsInstanceType instanceType); static ResAllocs toResAllocs(String name, ResourceDimension resourceDimension); static ResourceDimension fromResAllocs(ResAllocs resAllocs); }
ResourceDimensions { public static long divideAndRoundUp(ResourceDimension left, ResourceDimension right) { Pair<Long, ResourceDimension> result = divide(left, right); return result.getRight().equals(ResourceDimension.empty()) ? result.getLeft() : result.getLeft() + 1; }  static ResourceDimension add(ResourceDimension... parts); static ResourceDimension add(Collection<ResourceDimension> parts); static ResourceDimension subtractPositive(ResourceDimension left, ResourceDimension right); static ResourceDimension multiply(ResourceDimension base, double multiplier); static Pair<Long, ResourceDimension> divide(ResourceDimension left, ResourceDimension right); static long divideAndRoundUp(ResourceDimension left, ResourceDimension right); static ResourceDimension alignUp(ResourceDimension source, ResourceDimension reference); static boolean isBigger(ResourceDimension dimension, ResourceDimension subDimension); static StringBuilder format(ResourceDimension input, StringBuilder output); static String format(ResourceDimension input); static ResourceDimension fromServerInfo(ServerInfo serverInfo); static ResourceDimension fromAwsInstanceType(AwsInstanceType instanceType); static ResAllocs toResAllocs(String name, ResourceDimension resourceDimension); static ResourceDimension fromResAllocs(ResAllocs resAllocs);  }