179 }
180 else if (!other.isDefaultSockFactory) {
181 return invokeComparator(other, this);
182 } else {
183 return invokeComparator(this, other);
184 }
185 }
186
187 // delegate the comparison work to the SocketFactory class
188 // as there is no enough information here, to do the comparison
189 private boolean invokeComparator(ClientId c1, ClientId c2) {
190 Object ret;
191 try {
192 ret = (c1.sockComparator).invoke(
193 c1.factory, c1.socketFactory, c2.socketFactory);
194 } catch(Exception e) {
195 if (debug) {
196 System.out.println("ClientId received an exception");
197 e.printStackTrace();
198 }
199 // Failed to invoke the comparator; flag unequality
200 return false;
201 }
202 if (((Integer) ret) == 0) {
203 return true;
204 }
205 return false;
206 }
207
208 private static String toStringControls(Control[] ctls) {
209 if (ctls == null) {
210 return "";
211 }
212 StringBuilder str = new StringBuilder();
213 for (int i = 0; i < ctls.length; i++) {
214 str.append(ctls[i].getID());
215 str.append(' ');
216 }
217 return str.toString();
218 }
219
|
179 }
180 else if (!other.isDefaultSockFactory) {
181 return invokeComparator(other, this);
182 } else {
183 return invokeComparator(this, other);
184 }
185 }
186
187 // delegate the comparison work to the SocketFactory class
188 // as there is no enough information here, to do the comparison
189 private boolean invokeComparator(ClientId c1, ClientId c2) {
190 Object ret;
191 try {
192 ret = (c1.sockComparator).invoke(
193 c1.factory, c1.socketFactory, c2.socketFactory);
194 } catch(Exception e) {
195 if (debug) {
196 System.out.println("ClientId received an exception");
197 e.printStackTrace();
198 }
199 // Failed to invoke the comparator; flag inequality
200 return false;
201 }
202 if (((Integer) ret) == 0) {
203 return true;
204 }
205 return false;
206 }
207
208 private static String toStringControls(Control[] ctls) {
209 if (ctls == null) {
210 return "";
211 }
212 StringBuilder str = new StringBuilder();
213 for (int i = 0; i < ctls.length; i++) {
214 str.append(ctls[i].getID());
215 str.append(' ');
216 }
217 return str.toString();
218 }
219
|