예제 #1
0
  /* ------------------------------------------------------------ */
  public static Float getQuality(String value) {
    if (value == null) return __zero;

    int qe = value.indexOf(";");
    if (qe++ < 0 || qe == value.length()) return __one;

    if (value.charAt(qe++) == 'q') {
      qe++;
      @SuppressWarnings("rawtypes")
      Map.Entry entry = __qualities.getEntry(value, qe, value.length() - qe);
      if (entry != null) return (Float) entry.getValue();
    }

    HashMap<String, String> params = new HashMap<String, String>(3);
    valueParameters(value, params);
    String qs = (String) params.get("q");
    Float q = (Float) __qualities.get(qs);
    if (q == null) {
      try {
        q = new Float(qs);
      } catch (Exception e) {
        q = __one;
      }
    }
    return q;
  }
예제 #2
0
 static {
   __qualities.put(null, __one);
   __qualities.put("1.0", __one);
   __qualities.put("1", __one);
   __qualities.put("0.9", new Float("0.9"));
   __qualities.put("0.8", new Float("0.8"));
   __qualities.put("0.7", new Float("0.7"));
   __qualities.put("0.66", new Float("0.66"));
   __qualities.put("0.6", new Float("0.6"));
   __qualities.put("0.5", new Float("0.5"));
   __qualities.put("0.4", new Float("0.4"));
   __qualities.put("0.33", new Float("0.33"));
   __qualities.put("0.3", new Float("0.3"));
   __qualities.put("0.2", new Float("0.2"));
   __qualities.put("0.1", new Float("0.1"));
   __qualities.put("0", __zero);
   __qualities.put("0.0", __zero);
 }