code: public ShareableResource setCapacity(Node n, int val) {
      if (val < 0) {
        throw new IllegalArgumentException(String.format("The '%s' capacity of node '%s' must be >= 0", rcId, n));
      }
      nodesCapacity.put(n, val);
      return this;
    }
docs: Set the resource consumption of a node.
  
  @param n   the node
  @param val the value to set
  @return the current resource