krysalis-version/src/java/org/krysalis/version/intro Overview.java,1.6,1.7
[email protected] Mon, 10 Mar 2003 12:44:56 -0800
Newsgroups
gmane.comp.krysalis.sandbox
Message-ID
<[email protected] >
Update of /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/intro
In directory sc8-pr-cvs1:/tmp/cvs-serv20296/src/java/org/krysalis/version/intro
Modified Files:
Overview.java
Log Message:
First stab at replacing Formats with Specifications for "non-Krysalis" formats.
Fixed some bugs via new tests.
Index: Overview.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/intro/Overview.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Overview.java 5 Mar 2003 19:58:27 -0000 1.6
--- Overview.java 10 Mar 2003 20:44:21 -0000 1.7
***************
*** 60,66 ****
import org.krysalis.version.collecting.UberVersionCollector;
import org.krysalis.version.exception.VersionException;
- import org.krysalis.version.formatting.VersionFormat;
- import org.krysalis.version.formatting.VersionFormatFactory;
- import org.krysalis.version.formatting.exception.VersionFormatException;
import org.krysalis.version.internal.data.ReleaseLevel;
import org.krysalis.version.internal.data.VersionData;
--- 60,63 ----
***************
*** 68,71 ****
--- 65,70 ----
import org.krysalis.version.internal.data.util.VersionDataIncrementor;
import org.krysalis.version.internal.data.util.VersionDataRangeIterator;
+ import org.krysalis.version.specification.VersionSpecification;
+ import org.krysalis.version.specification.VersionSpecificationFactory;
import org.krysalis.version.util.debug.DebugUtils;
***************
*** 77,100 ****
private String m_args[] = null;
! private VersionFormat m_format =
! VersionFormatFactory.createDefaultVersionFormat();
private VersionData m_data =
new VersionData(1, 1, ReleaseLevel.ALPHA, 1, 1, 1);
! public Overview(PrintWriter out, String args[])
! throws VersionFormatException {
m_out = out;
m_args = args;
! m_format = VersionFormatFactory.createDefaultVersionFormat();
if (m_args.length > 0) {
String versionStr = m_args[0];
! presentSection("Provided Format [" + versionStr + "]");
! m_data = m_format.parseVersion(versionStr);
! present("Provided Formatter : [" + m_format + "]");
present("Input : [" + versionStr + "]");
present("Data : [" + m_data + "]");
--- 76,100 ----
private String m_args[] = null;
! private VersionSpecification m_specification =
! VersionSpecificationFactory.createDefaultVersionSpecification();
private VersionData m_data =
new VersionData(1, 1, ReleaseLevel.ALPHA, 1, 1, 1);
! public Overview(PrintWriter out, String args[]) throws VersionException {
m_out = out;
m_args = args;
! m_specification =
! VersionSpecificationFactory.createDefaultVersionSpecification();
if (m_args.length > 0) {
String versionStr = m_args[0];
! presentSection("Provided Specification [" + versionStr + "]");
! m_data =
! m_specification.getVersionFormat().parseVersion(versionStr);
! present("Provided Specificationter : [" + m_specification + "]");
present("Input : [" + versionStr + "]");
present("Data : [" + m_data + "]");
***************
*** 105,109 ****
public void present() {
! presentFormats();
//presentSource();
--- 105,109 ----
public void present() {
! presentSpecifications();
//presentSource();
***************
*** 137,143 ****
present(
"Versions From : ["
! + m_format.toVersionString(lower)
+ "] -> ["
! + m_format.toVersionString(upper)
+ "]");
presentGap();
--- 137,143 ----
present(
"Versions From : ["
! + m_specification.getVersionFormat().toVersionString(lower)
+ "] -> ["
! + m_specification.getVersionFormat().toVersionString(upper)
+ "]");
presentGap();
***************
*** 152,156 ****
VersionData data = (VersionData) iterator.next();
! present("Version Data : [" + m_format.toVersionString(data) + "]");
}
--- 152,159 ----
VersionData data = (VersionData) iterator.next();
! present(
! "Version Data : ["
! + m_specification.getVersionFormat().toVersionString(data)
! + "]");
}
***************
*** 171,215 ****
}
! private void presentFormats() {
! presentSection("Version Formats");
! VersionFormat kf = VersionFormatFactory.createKrysalisVersionFormat();
! VersionFormat jf = VersionFormatFactory.createJavasoftVersionFormat();
! VersionFormat cf =
! VersionFormatFactory.createJakartaCommonsVersionFormat();
! VersionFormat df = VersionFormatFactory.createDefaultVersionFormat();
! presentFormat("Krysalis Format", kf);
! presentFormat("Javasoft Format", jf);
! presentFormat("Commons Format", cf);
! presentFormat("Default Format", df);
presentEndOfSection();
! presentSection("Version Formats in action...");
! presentFormatWorking("Krysalis Format", m_data, kf);
! presentFormatWorking("Javasoft Format", m_data, jf);
! presentFormatWorking("Commons Format", m_data, cf);
! presentFormatWorking("Default Format", m_data, df);
presentEndOfSection();
}
! private void presentFormat(String name, VersionFormat format) {
presentTitle(name);
- present("Description: " + format.getVersionFormatDescription());
- present("RegExp: " + format.getVersionFormatRegularExpression());
present(
! "Human-readable Format 'mask': " + format.getVersionFormatMask());
presentGap();
}
! private void presentFormatWorking(
String name,
VersionData data,
! VersionFormat format) {
! present(name + " -> " + format.toVersionString(data));
}
--- 174,234 ----
}
! private void presentSpecifications() {
! presentSection("Version Specifications");
! VersionSpecification kf =
! VersionSpecificationFactory.createKrysalisVersionSpecification();
! VersionSpecification jf =
! VersionSpecificationFactory.createJavasoftVersionSpecification();
! VersionSpecification cf =
! VersionSpecificationFactory
! .createJakartaCommonsVersionSpecification();
! VersionSpecification df =
! VersionSpecificationFactory.createDefaultVersionSpecification();
! presentSpecification("Krysalis Specification", kf);
! presentSpecification("Javasoft Specification", jf);
! presentSpecification("Commons Specification", cf);
! presentSpecification("Default Specification", df);
presentEndOfSection();
! presentSection("Version Specifications in action...");
! presentSpecificationWorking("Krysalis Specification", m_data, kf);
! presentSpecificationWorking("Javasoft Specification", m_data, jf);
! presentSpecificationWorking("Commons Specification", m_data, cf);
! presentSpecificationWorking("Default Specification", m_data, df);
presentEndOfSection();
}
! private void presentSpecification(
! String name,
! VersionSpecification specification) {
presentTitle(name);
present(
! "Description: "
! + specification.getVersionFormat().getVersionFormatDescription());
! present(
! "RegExp: "
! + specification
! .getVersionFormat()
! .getVersionFormatRegularExpression());
! present(
! "Human-readable Specification 'mask': "
! + specification.getVersionFormat().getVersionFormatMask());
presentGap();
}
! private void presentSpecificationWorking(
String name,
VersionData data,
! VersionSpecification specification) {
! present(
! name
! + " -> "
! + specification.getVersionFormat().toVersionString(data));
}
***************
*** 273,280 ****
/**
* Returns the format.
! * @return VersionFormat
*/
! public VersionFormat getFormat() {
! return m_format;
}
--- 292,299 ----
/**
* Returns the format.
! * @return VersionSpecification
*/
! public VersionSpecification getSpecification() {
! return m_specification;
}
***************
*** 307,312 ****
* @param format The format to set
*/
! public void setFormat(VersionFormat format) {
! m_format = format;
}
--- 326,331 ----
* @param format The format to set
*/
! public void setSpecification(VersionSpecification format) {
! m_specification = format;
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf