ResourceSlot { public ResourceSlot add(ResourceSlot other) { return new ResourceSlot( getNumCpus() + other.getNumCpus(), Amount.of(getRam().as(BYTES) + other.getRam().as(BYTES), BYTES), Amount.of(getDisk().as(BYTES) + other.getDisk().as(BYTES), BYTES), getNumPorts() + other.getNumPorts()); } ResourceSlot(
      double numCpus,
      Amount<Long, Data> ram,
      Amount<Long, Data> disk,
      int numPorts); static ResourceSlot from(ITaskConfig task); static TaskInfo matchResourceTypes(TaskInfo task); List<Protos.Resource> toResourceList(TierInfo tierInfo); @VisibleForTesting static Protos.Resource makeMesosRangeResource(
      ResourceType resourceType,
      Set<Integer> values); double getNumCpus(); Amount<Long, Data> getDisk(); Amount<Long, Data> getRam(); int getNumPorts(); @Override boolean equals(Object o); @Override int hashCode(); static ResourceSlot sum(Iterable<ResourceSlot> slots); ResourceSlot add(ResourceSlot other); ResourceSlot subtract(ResourceSlot other); static final ResourceSlot NONE; static final Function<Range<Integer>, Protos.Value.Range> RANGE_TRANSFORM; static final Ordering<ResourceSlot> ORDER; }
@Test public void testAdd() { assertEquals(TWO, ONE.add(ONE)); assertEquals(THREE, ONE.add(TWO)); assertEquals(THREE, TWO.add(ONE)); }