1 18 19 package org.apache.jmeter.protocol.http.parser; 20 21 import java.net.URL ; 22 23 31 public class URLString 32 implements Comparable { 34 35 private URL url; 36 private String urlAsString; 37 private int hashCode; 38 39 private URLString() { 41 } 42 43 public URLString(URL u) 44 { 45 url=u; 46 urlAsString=u.toExternalForm(); 47 52 53 hashCode=urlAsString.hashCode(); 54 } 55 56 59 public URLString(String s) 60 { 61 url=null; 62 urlAsString=s; 63 hashCode=urlAsString.hashCode(); 64 } 65 66 public String toString() 67 { 68 return urlAsString; 69 } 70 71 public URL getURL() 72 { 73 return url; 74 } 75 76 public int compareTo(Object o) 77 { 78 return urlAsString.compareTo(o.toString()); 79 } 80 81 public boolean equals(Object o) 82 { 83 return (o instanceof URLString && urlAsString.equals(o.toString())); 84 } 85 86 public int hashCode() 87 { 88 return hashCode; 89 } 90 } 91 | Popular Tags |