class AcceptToken implements QualityValue {

    public static AcceptToken valueOf(String value) {
        if (value == null) {
            throw new IllegalArgumentException();
        }
        try {
            int separator = scan(value, PARAMETERS_SEPARATOR);
            boolean hasParameters = charAtIs(value, separator, PARAMETERS_SEPARATOR);
            String token = hasParameters ? value.substring(0, separator).trim() : value.trim();
            token = token.trim();

            int i;
            if ((i = isToken(token)) != -1) {
                throw new IllegalArgumentException(String.format("Not valid character at index %d in %s", i, token));
            }

            if (hasParameters) {
                Map<String, String> param = new HeaderParameterParser().parse(value);
                if (param.containsKey(QVALUE)) {
                    return new AcceptToken(token, parseQualityValue(param.get(QVALUE)));
                }
            }

            return new AcceptToken(token);
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
    }

    public  AcceptToken(String token);
    public  AcceptToken(String token, float qValue);

}