8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: QCharset.java,v 1.3 2008/06/25 05:41:28 qcheng Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * This class represent charset to be used. The sorting of this object is based
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * on the Q factor associated with it. The charaset object with more Q factor
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * will be greater.This object allows to represent charaset values received from
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * HTTP header. Example Accept-Charset: ISO-8859-1;Q=0.9 UTF-8 imples UTF-8
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * takes more precedence over ISO-8859-1. Possible Q values are any floating
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * points between 0 and 1. if Q factor is missing it is assumed to be 1.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Construct a <code>QCharset</code> object.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param name Name of the charset.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param q Q factor to express preference. 0.0 < q < 1.0.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Constructs new <code>QCharset</code> set object with charset
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * name and q value.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param name -
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Name of the charset Constructs new QCharset set object with
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * charset name and q =1.0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns <code>1</code> if <code>o1</code>'s q value is higher.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns <code>-1</code> if <code>o1</code>'s q value is lower.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns <code>0</code> if <code>o1</code>'s q value is the same.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param o1 <code>QCharset</code> type object.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return <code>-1,0,1</code> based on q value.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Do not use collator as it is not necessary codeset names are ASCII
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (qFactor == q1.qFactor && name.equals(q1.name));