Noticed a copy-paste error that resulted in a small inefficiency, then

noticed that there were tabs in here... fixed the "bug" and reformatted the
file with spaces.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1446 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2004-06-12 01:00:51 +00:00
parent c1e578c274
commit 46d157a3ae
@@ -1,5 +1,5 @@
//
// $Id: StringUtil.java,v 1.72 2004/03/06 20:05:41 ray Exp $
// $Id: StringUtil.java,v 1.73 2004/06/12 01:00:51 ray Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne
@@ -443,17 +443,6 @@ public class StringUtil
} else if (val instanceof Collection) {
toString(buf, ((Collection)val).iterator(), openBox, closeBox);
} else if (val instanceof Enumeration) {
buf.append(openBox);
Enumeration enum = (Enumeration)val;
for (int i = 0; enum.hasMoreElements(); i++) {
if (i > 0) {
buf.append(sep);
}
buf.append(toString(enum.nextElement()));
}
buf.append(closeBox);
} else if (val instanceof Iterator) {
buf.append(openBox);
Iterator iter = (Iterator)val;
@@ -465,6 +454,17 @@ public class StringUtil
}
buf.append(closeBox);
} else if (val instanceof Enumeration) {
buf.append(openBox);
Enumeration enm = (Enumeration)val;
for (int i = 0; enm.hasMoreElements(); i++) {
if (i > 0) {
buf.append(sep);
}
buf.append(toString(enm.nextElement()));
}
buf.append(closeBox);
} else if (val instanceof Point2D) {
Point2D p = (Point2D)val;
buf.append(openBox);
@@ -562,20 +562,6 @@ public class StringUtil
}
buf.append(closeBox);
} else if (val instanceof Collection) {
listToString(buf, ((Collection)val).iterator(), formatter);
} else if (val instanceof Enumeration) {
buf.append(openBox);
Enumeration enum = (Enumeration)val;
for (int i = 0; enum.hasMoreElements(); i++) {
if (i > 0) {
buf.append(", ");
}
buf.append(formatter.toString(enum.nextElement()));
}
buf.append(closeBox);
} else if (val instanceof Iterator) {
buf.append(openBox);
Iterator iter = (Iterator)val;
@@ -587,6 +573,17 @@ public class StringUtil
}
buf.append(closeBox);
} else if (val instanceof Enumeration) {
buf.append(openBox);
Enumeration enm = (Enumeration)val;
for (int i = 0; enm.hasMoreElements(); i++) {
if (i > 0) {
buf.append(", ");
}
buf.append(formatter.toString(enm.nextElement()));
}
buf.append(closeBox);
} else {
// fall back on the general purpose
toString(buf, val);