code: void setWeight(Token tok, double d) {
  		Double oldWeight = (Double)weightMap.get(tok);
  		totalWeight += oldWeight==null ? d : (d - oldWeight.doubleValue());
  		weightMap.put(tok,new Double(d));
  	}
docs: Change the weight of a token in the bag