Rename new methods in Version

This commit is contained in:
Paul Schaub 2023-04-17 15:29:06 +02:00
parent 1a4affde35
commit 84a01df4bd
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
3 changed files with 39 additions and 38 deletions

View File

@ -101,7 +101,7 @@ public class VersionExternal implements Version {
} }
@Override @Override
public int getSopSpecVersionNumber() { public int getSopSpecRevisionNumber() {
String revision = getSopSpecVersion(); String revision = getSopSpecVersion();
String firstLine; String firstLine;
if (revision.contains("\n")) { if (revision.contains("\n")) {
@ -124,7 +124,7 @@ public class VersionExternal implements Version {
} }
@Override @Override
public String getSopSpecImplementationIncompletenessRemarks() { public String getSopSpecImplementationRemarks() {
String revision = getSopSpecVersion(); String revision = getSopSpecVersion();
if (revision.contains("\n")) { if (revision.contains("\n")) {
String tail = revision.substring(revision.indexOf("\n") + 1).trim(); String tail = revision.substring(revision.indexOf("\n") + 1).trim();

View File

@ -47,37 +47,6 @@ public interface Version {
*/ */
String getExtendedVersion(); String getExtendedVersion();
/**
* Return the version number of the latest targeted SOP spec revision.
*
* @return SOP spec revision number
*/
int getSopSpecVersionNumber();
/**
* Return the latest targeted revision of the SOP spec.
*
* @return SOP spec revision string
*/
default String getSopSpecRevisionString() {
return "draft-dkg-openpgp-stateless-cli-" + String.format("%02d", getSopSpecVersionNumber());
}
/**
* Return <pre>true</pre>, if this implementation of the SOP spec is known to be incomplete or defective.
*
* @return true if incomplete, false otherwise
*/
boolean isSopSpecImplementationIncomplete();
/**
* Return free-form text containing remarks about the completeness of the SOP implementation.
* If no remarks are known, this method returns <pre>null</pre>.
*
* @return remarks or null
*/
String getSopSpecImplementationIncompletenessRemarks();
/** /**
* Return the revision of the SOP specification that this implementation is implementing, for example, * Return the revision of the SOP specification that this implementation is implementing, for example,
* <pre>draft-dkg-openpgp-stateless-cli-06</pre>. * <pre>draft-dkg-openpgp-stateless-cli-06</pre>.
@ -95,14 +64,46 @@ public interface Version {
sb.append('~'); sb.append('~');
} }
sb.append(getSopSpecRevisionString()); sb.append(getSopSpecRevisionName());
if (getSopSpecImplementationIncompletenessRemarks() != null) { if (getSopSpecImplementationRemarks() != null) {
sb.append('\n') sb.append('\n')
.append('\n') .append('\n')
.append(getSopSpecImplementationIncompletenessRemarks()); .append(getSopSpecImplementationRemarks());
} }
return sb.toString(); return sb.toString();
} }
/**
* Return the version number of the latest targeted SOP spec revision.
*
* @return SOP spec revision number
*/
int getSopSpecRevisionNumber();
/**
* Return the name of the latest targeted revision of the SOP spec.
*
* @return SOP spec revision string
*/
default String getSopSpecRevisionName() {
return "draft-dkg-openpgp-stateless-cli-" + String.format("%02d", getSopSpecRevisionNumber());
}
/**
* Return <pre>true</pre>, if this implementation of the SOP spec is known to be incomplete or defective.
*
* @return true if incomplete, false otherwise
*/
boolean isSopSpecImplementationIncomplete();
/**
* Return free-form text containing remarks about the completeness of the SOP implementation.
* If there are no remarks, this method returns <pre>null</pre>.
*
* @return remarks or null
*/
String getSopSpecImplementationRemarks();
} }

View File

@ -69,7 +69,7 @@ public class VersionTest extends AbstractSOPTest {
assertTrue(sopSpec.startsWith("draft-dkg-openpgp-stateless-cli-")); assertTrue(sopSpec.startsWith("draft-dkg-openpgp-stateless-cli-"));
} }
int sopRevision = sop.version().getSopSpecVersionNumber(); int sopRevision = sop.version().getSopSpecRevisionNumber();
assertTrue(sop.version().getSopSpecRevisionString().endsWith("" + sopRevision)); assertTrue(sop.version().getSopSpecRevisionName().endsWith("" + sopRevision));
} }
} }