[jsemver] 21/95: Rename AlphaNumericVersion to MetadataVersion
Alexandre Viau
reazem-guest at moszumanska.debian.org
Mon Feb 16 14:58:26 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 41072894c9e94c206b1fa3effae022743b2e713b
Author: Zafar Khaja <zafarkhaja at gmail.com>
Date: Fri Mar 8 00:11:11 2013 +0400
Rename AlphaNumericVersion to MetadataVersion
---
README.md | 2 +-
pom.xml | 2 +-
...phaNumericVersion.java => MetadataVersion.java} | 14 +++---
.../java/com/github/zafarkhaja/semver/Version.java | 20 ++++----
...icVersionTest.java => MetadataVersionTest.java} | 54 +++++++++++-----------
5 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/README.md b/README.md
index ccf5cbd..26ecf53 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-Java SemVer v0.4.2
+Java SemVer v0.5.0
==================
Java SemVer is a Java implementation of the Semantic Versioning Specification
(http://semver.org/).
diff --git a/pom.xml b/pom.xml
index 0fa0105..cb8a736 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
<groupId>com.github.zafarkhaja</groupId>
<artifactId>semver</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>semver</name>
diff --git a/src/main/java/com/github/zafarkhaja/semver/AlphaNumericVersion.java b/src/main/java/com/github/zafarkhaja/semver/MetadataVersion.java
similarity index 87%
rename from src/main/java/com/github/zafarkhaja/semver/AlphaNumericVersion.java
rename to src/main/java/com/github/zafarkhaja/semver/MetadataVersion.java
index 981f9bd..086cd14 100644
--- a/src/main/java/com/github/zafarkhaja/semver/AlphaNumericVersion.java
+++ b/src/main/java/com/github/zafarkhaja/semver/MetadataVersion.java
@@ -30,21 +30,21 @@ import java.util.regex.Pattern;
*
* @author Zafar Khaja <zafarkhaja at gmail.com>
*/
-class AlphaNumericVersion implements Comparable<AlphaNumericVersion> {
+class MetadataVersion implements Comparable<MetadataVersion> {
private final String value;
static final String FORMAT = "([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)";
private static final Pattern PATTERN = Pattern.compile("^" + FORMAT + "$");
- AlphaNumericVersion(String value) {
+ MetadataVersion(String value) {
if (value == null) {
- throw new NullPointerException("Alpha-numeric version MUST NOT be NULL");
+ throw new NullPointerException("Metadata version MUST NOT be NULL");
}
Matcher matcher = PATTERN.matcher(value);
if (!matcher.matches()) {
throw new IllegalArgumentException(
- "Alpha-numeric version MUST consist of dot separated identifiers [0-9A-Za-z-]"
+ "Metadata version MUST consist of dot separated identifiers [0-9A-Za-z-]"
);
}
this.value = matcher.group(0);
@@ -55,10 +55,10 @@ class AlphaNumericVersion implements Comparable<AlphaNumericVersion> {
if (this == other) {
return true;
}
- if (!(other instanceof AlphaNumericVersion)) {
+ if (!(other instanceof MetadataVersion)) {
return false;
}
- return compareTo((AlphaNumericVersion) other) == 0 ? true : false;
+ return compareTo((MetadataVersion) other) == 0 ? true : false;
}
@Override
@@ -72,7 +72,7 @@ class AlphaNumericVersion implements Comparable<AlphaNumericVersion> {
}
@Override
- public int compareTo(AlphaNumericVersion other) {
+ public int compareTo(MetadataVersion other) {
String[] thisIds = value.split("\\.");
String[] otherIds = other.value.split("\\.");
diff --git a/src/main/java/com/github/zafarkhaja/semver/Version.java b/src/main/java/com/github/zafarkhaja/semver/Version.java
index 072c2c2..372a785 100644
--- a/src/main/java/com/github/zafarkhaja/semver/Version.java
+++ b/src/main/java/com/github/zafarkhaja/semver/Version.java
@@ -33,8 +33,8 @@ import java.util.regex.Pattern;
public class Version implements Comparable<Version> {
private final NormalVersion normal;
- private final AlphaNumericVersion preRelease;
- private final AlphaNumericVersion build;
+ private final MetadataVersion preRelease;
+ private final MetadataVersion build;
private static final String PRE_RELEASE_PREFIX = "-";
private static final String BUILD_PREFIX = "+";
@@ -47,10 +47,10 @@ public class Version implements Comparable<Version> {
.append(NormalVersion.FORMAT)
.append("(?:")
.append(PRE_RELEASE_PREFIX)
- .append(AlphaNumericVersion.FORMAT)
+ .append(MetadataVersion.FORMAT)
.append(")?").append("(?:")
.append("\\").append(BUILD_PREFIX)
- .append(AlphaNumericVersion.FORMAT)
+ .append(MetadataVersion.FORMAT)
.append(")?")
.append("$");
@@ -59,8 +59,8 @@ public class Version implements Comparable<Version> {
Version(
NormalVersion normal,
- AlphaNumericVersion preRelease,
- AlphaNumericVersion build
+ MetadataVersion preRelease,
+ MetadataVersion build
) {
this.normal = normal;
this.preRelease = preRelease;
@@ -79,14 +79,14 @@ public class Version implements Comparable<Version> {
Integer.parseInt(matcher.group(3))
);
- AlphaNumericVersion preRelease =
+ MetadataVersion preRelease =
(matcher.group(4) != null) ?
- new AlphaNumericVersion(matcher.group(4)) :
+ new MetadataVersion(matcher.group(4)) :
null;
- AlphaNumericVersion build =
+ MetadataVersion build =
(matcher.group(5) != null) ?
- new AlphaNumericVersion(matcher.group(5)) :
+ new MetadataVersion(matcher.group(5)) :
null;
return new Version(normal, preRelease, build);
diff --git a/src/test/java/com/github/zafarkhaja/semver/AlphaNumericVersionTest.java b/src/test/java/com/github/zafarkhaja/semver/MetadataVersionTest.java
similarity index 68%
rename from src/test/java/com/github/zafarkhaja/semver/AlphaNumericVersionTest.java
rename to src/test/java/com/github/zafarkhaja/semver/MetadataVersionTest.java
index 9b45110..87e55cc 100644
--- a/src/test/java/com/github/zafarkhaja/semver/AlphaNumericVersionTest.java
+++ b/src/test/java/com/github/zafarkhaja/semver/MetadataVersionTest.java
@@ -33,7 +33,7 @@ import org.junit.runner.RunWith;
* @author Zafar Khaja <zafarkhaja at gmail.com>
*/
@RunWith(Enclosed.class)
-public class AlphaNumericVersionTest {
+public class MetadataVersionTest {
public static class CoreFunctionalityTest {
@@ -48,7 +48,7 @@ public class AlphaNumericVersionTest {
};
for (String ver : invalidVersions) {
try {
- AlphaNumericVersion v = new AlphaNumericVersion(ver);
+ MetadataVersion v = new MetadataVersion(ver);
} catch (Exception e) {
continue;
}
@@ -58,37 +58,37 @@ public class AlphaNumericVersionTest {
@Test
public void mustCompareEachIdentifierSeparately() {
- AlphaNumericVersion v1 = new AlphaNumericVersion("beta.2.abc");
- AlphaNumericVersion v2 = new AlphaNumericVersion("beta.1.edf");
+ MetadataVersion v1 = new MetadataVersion("beta.2.abc");
+ MetadataVersion v2 = new MetadataVersion("beta.1.edf");
assertTrue(0 < v1.compareTo(v2));
}
@Test
public void shouldCompareIdentifiersCountIfCommonIdentifiersAreEqual() {
- AlphaNumericVersion v1 = new AlphaNumericVersion("beta.abc");
- AlphaNumericVersion v2 = new AlphaNumericVersion("beta.abc.def");
+ MetadataVersion v1 = new MetadataVersion("beta.abc");
+ MetadataVersion v2 = new MetadataVersion("beta.abc.def");
assertTrue(0 > v1.compareTo(v2));
}
@Test
public void shouldComapareDigitsOnlyIdentifiersNumerically() {
- AlphaNumericVersion v1 = new AlphaNumericVersion("alpha.123");
- AlphaNumericVersion v2 = new AlphaNumericVersion("alpha.321");
+ MetadataVersion v1 = new MetadataVersion("alpha.123");
+ MetadataVersion v2 = new MetadataVersion("alpha.321");
assertTrue(0 > v1.compareTo(v2));
}
@Test
public void shouldCompareMixedIdentifiersLexicallyInAsciiSortOrder() {
- AlphaNumericVersion v1 = new AlphaNumericVersion("beta.abc");
- AlphaNumericVersion v2 = new AlphaNumericVersion("beta.111");
+ MetadataVersion v1 = new MetadataVersion("beta.abc");
+ MetadataVersion v2 = new MetadataVersion("beta.111");
assertTrue(0 < v1.compareTo(v2));
}
@Test
public void shouldOverrideEqualsMethod() {
- AlphaNumericVersion v1 = new AlphaNumericVersion("alpha.123");
- AlphaNumericVersion v2 = new AlphaNumericVersion("alpha.123");
- AlphaNumericVersion v3 = new AlphaNumericVersion("alpha.321");
+ MetadataVersion v1 = new MetadataVersion("alpha.123");
+ MetadataVersion v2 = new MetadataVersion("alpha.123");
+ MetadataVersion v3 = new MetadataVersion("alpha.321");
assertTrue(v1.equals(v2));
assertFalse(v1.equals(v3));
}
@@ -98,23 +98,23 @@ public class AlphaNumericVersionTest {
@Test
public void shouldBeReflexive() {
- AlphaNumericVersion v = new AlphaNumericVersion("alpha.123");
+ MetadataVersion v = new MetadataVersion("alpha.123");
assertTrue(v.equals(v));
}
@Test
public void shouldBeSymmetric() {
- AlphaNumericVersion v1 = new AlphaNumericVersion("alpha.123");
- AlphaNumericVersion v2 = new AlphaNumericVersion("alpha.123");
+ MetadataVersion v1 = new MetadataVersion("alpha.123");
+ MetadataVersion v2 = new MetadataVersion("alpha.123");
assertTrue(v1.equals(v2));
assertTrue(v2.equals(v1));
}
@Test
public void shouldBeTransitive() {
- AlphaNumericVersion v1 = new AlphaNumericVersion("alpha.123");
- AlphaNumericVersion v2 = new AlphaNumericVersion("alpha.123");
- AlphaNumericVersion v3 = new AlphaNumericVersion("alpha.123");
+ MetadataVersion v1 = new MetadataVersion("alpha.123");
+ MetadataVersion v2 = new MetadataVersion("alpha.123");
+ MetadataVersion v3 = new MetadataVersion("alpha.123");
assertTrue(v1.equals(v2));
assertTrue(v2.equals(v3));
assertTrue(v1.equals(v3));
@@ -122,8 +122,8 @@ public class AlphaNumericVersionTest {
@Test
public void shouldBeConsistent() {
- AlphaNumericVersion v1 = new AlphaNumericVersion("alpha.123");
- AlphaNumericVersion v2 = new AlphaNumericVersion("alpha.123");
+ MetadataVersion v1 = new MetadataVersion("alpha.123");
+ MetadataVersion v2 = new MetadataVersion("alpha.123");
assertTrue(v1.equals(v2));
assertTrue(v1.equals(v2));
assertTrue(v1.equals(v2));
@@ -131,14 +131,14 @@ public class AlphaNumericVersionTest {
@Test
public void shouldReturnFalseIfOtherVersionIsOfDifferentType() {
- AlphaNumericVersion v = new AlphaNumericVersion("alpha.123");
+ MetadataVersion v = new MetadataVersion("alpha.123");
assertFalse(v.equals(new String("alpha.123")));
}
@Test
public void shouldReturnFalseIfOtherVersionIsNull() {
- AlphaNumericVersion v1 = new AlphaNumericVersion("alpha.123");
- AlphaNumericVersion v2 = null;
+ MetadataVersion v1 = new MetadataVersion("alpha.123");
+ MetadataVersion v2 = null;
assertFalse(v1.equals(v2));
}
}
@@ -147,8 +147,8 @@ public class AlphaNumericVersionTest {
@Test
public void shouldReturnSameHashCodeIfVersionsAreEqual() {
- AlphaNumericVersion v1 = new AlphaNumericVersion("alpha.123");
- AlphaNumericVersion v2 = new AlphaNumericVersion("alpha.123");
+ MetadataVersion v1 = new MetadataVersion("alpha.123");
+ MetadataVersion v2 = new MetadataVersion("alpha.123");
assertTrue(v1.equals(v2));
assertEquals(v1.hashCode(), v2.hashCode());
}
@@ -159,7 +159,7 @@ public class AlphaNumericVersionTest {
@Test
public void shouldReturnStringRepresentation() {
String value = "beta.abc.def";
- AlphaNumericVersion v = new AlphaNumericVersion(value);
+ MetadataVersion v = new MetadataVersion(value);
assertEquals(value, v.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