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;
  }
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 ; }
Set the resource consumption of a node.

@param n   the node
@param val the value to set
@return the current resource