/** * Sets q-value for media-range in AcceptLanguageHeader. Q-values allow the * * user to indicate the relative degree of preference for that media-range, * * using the qvalue scale from 0 to 1. If no q-value is present, the * * media-range should be treated as having a q-value of 1. * * * * @param q The new float value of the q-value, a value of -1 resets * the qValue. * * @throws InvalidArgumentException if the q parameter value is not * * <code>-1</code> or between <code>0 and 1</code>. * */ public void setQValue(float q) throws InvalidArgumentException { if (q < 0.0 || q > 1.0) throw new InvalidArgumentException("qvalue out of range!"); if (q == -1) this.removeParameter("q"); else this.setParameter(new NameValue("q", Float.valueOf(q))); }