Changeset 1417 for trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/HTTPUtils.java
- Timestamp:
- 02/28/14 12:23:40 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-http/src/main/java/de/ugoe/cs/autoquest/plugin/http/HTTPUtils.java
r1383 r1417 62 62 return null; 63 63 } 64 65 /** 66 * <p> 67 * compares two addresses and returns true, if they are equal and false else. The addresses 68 * are equal, if either the ip-addresses and the ports match or the host names and the 69 * ports match. 70 * </p> 71 * 72 * @param address1 the first address to compare 73 * @param address2 the second address to compare 74 * 75 * @return as described 76 */ 77 public static boolean equals(Address address1, Address address2) { 78 if (address1 == null) { 79 return address2 == null; 80 } 81 else if (address2 == null) { 82 return false; 83 } 84 85 if (!equals(address1.getPort(), address2.getPort())) { 86 return false; 87 } 88 89 if (address1.getIp() != null) { 90 return equals(address1.getIp(), address2.getIp()); 91 } 92 else { 93 return equals(address1.getHost(), address2.getHost()); 94 } 95 } 64 96 97 /** 98 * <p> 99 * convenience method to compare to objects. They are considered equal if they both are null, 100 * or if their equals method returns true. 101 * </p> 102 * 103 * @param object1 the first object to compare 104 * @param object2 the second object to compare 105 * 106 * @return as described 107 */ 108 public static <T> boolean equals(T object1, T object2) { 109 if (object1 == null) { 110 return object2 == null; 111 } 112 else { 113 return object1.equals(object2); 114 } 115 } 116 65 117 /** 66 118 * <p>
Note: See TracChangeset
for help on using the changeset viewer.