[jsemver] 14/95: Format StringBuilder usage for readability
Alexandre Viau
reazem-guest at moszumanska.debian.org
Mon Feb 16 14:58:25 UTC 2015
This is an automated email from the git hooks/post-receive script.
reazem-guest pushed a commit to branch master
in repository jsemver.
commit 00e87f31da407007d1bcd519725086a5e8764940
Author: Zafar Khaja <zafarkhaja at gmail.com>
Date: Tue Mar 5 22:54:45 2013 +0400
Format StringBuilder usage for readability
---
.../java/com/github/zafarkhaja/semver/Version.java | 31 +++++++++-------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/src/main/java/com/github/zafarkhaja/semver/Version.java b/src/main/java/com/github/zafarkhaja/semver/Version.java
index 72c0569..b66bcba 100644
--- a/src/main/java/com/github/zafarkhaja/semver/Version.java
+++ b/src/main/java/com/github/zafarkhaja/semver/Version.java
@@ -43,20 +43,17 @@ public class Version implements Comparable<Version> {
static {
StringBuilder sb = new StringBuilder();
-
- sb.append("^");
- sb.append(NormalVersion.FORMAT);
- sb.append("(?:");
- sb.append(PRE_RELEASE_PREFIX);
- sb.append(AlphaNumericVersion.FORMAT);
- sb.append(")?");
- sb.append("(?:");
- sb.append("\\");
- sb.append(BUILD_PREFIX);
- sb.append(AlphaNumericVersion.FORMAT);
- sb.append(")?");
- sb.append("$");
-
+ sb.append("^")
+ .append(NormalVersion.FORMAT)
+ .append("(?:")
+ .append(PRE_RELEASE_PREFIX)
+ .append(AlphaNumericVersion.FORMAT)
+ .append(")?").append("(?:")
+ .append("\\").append(BUILD_PREFIX)
+ .append(AlphaNumericVersion.FORMAT)
+ .append(")?")
+ .append("$");
+
SEMVER_PATTERN = Pattern.compile(sb.toString());
}
@@ -171,12 +168,10 @@ public class Version implements Comparable<Version> {
public String toString() {
StringBuilder sb = new StringBuilder(getNormalVersion());
if (preRelease != null) {
- sb.append(PRE_RELEASE_PREFIX);
- sb.append(getPreReleaseVersion());
+ sb.append(PRE_RELEASE_PREFIX).append(getPreReleaseVersion());
}
if (build != null) {
- sb.append(BUILD_PREFIX);
- sb.append(getBuildVersion());
+ sb.append(BUILD_PREFIX).append(getBuildVersion());
}
return sb.toString();
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jsemver.git
More information about the pkg-java-commits
mailing list