[Swift-commit] r3168 - trunk/src/org/griphyn/vdl/mapping
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Fri Oct 16 16:53:39 CDT 2009
Author: hategan
Date: 2009-10-16 16:53:38 -0500 (Fri, 16 Oct 2009)
New Revision: 3168
Modified:
trunk/src/org/griphyn/vdl/mapping/Path.java
Log:
cache toString()
Modified: trunk/src/org/griphyn/vdl/mapping/Path.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/Path.java 2009-10-16 21:53:10 UTC (rev 3167)
+++ trunk/src/org/griphyn/vdl/mapping/Path.java 2009-10-16 21:53:38 UTC (rev 3168)
@@ -19,6 +19,8 @@
/** True if any element of the Path contains a wildcard. */
private boolean wildcard;
+
+ private String tostrcached;
public static class EmptyPath extends Path {
public EmptyPath() {
@@ -245,7 +247,10 @@
* made that <code>Path.parse(somePath.stringForm()).equals(somePath)</code>.
* For a consistent such representation of this path use {@link stringForm}.
*/
- public String toString() {
+ public synchronized String toString() {
+ if (tostrcached != null) {
+ return tostrcached;
+ }
StringBuffer sb = new StringBuffer();
Iterator i = iterator();
while (i.hasNext()) {
@@ -260,7 +265,7 @@
sb.append(e.getName());
}
}
- return sb.toString();
+ return tostrcached = sb.toString();
}
public Iterator iterator() {
More information about the Swift-commit
mailing list