Java Reference
In-Depth Information
L ISTING 12.5
Continued
return false;
}
}
Instances of the VersionString class will be typically created to represent client requests.
They will contain StarVersion or PlusVersion instances, together with simple VersionId s.
Listing 12.6 shows the StarVersion class.
12
L ISTING 12.6
The StarVersion Class
package com.marinilli.b2.c12;
/**
* Chapter 12 - A StarVersion implementation
*
* A 'star' single version string.
* An example of 'star' version is '1.2*'
*
* @author Mauro Marinilli
* @version 1.0
*/
public class StarVersion extends Versionable implements Comparable {
public final static String STAR_SYMBOL = “*”;
private VersionId versionId;
/**
* The Constructor.
* @param the string representing the version
*/
public StarVersion(String s) {
String trimmed = s.trim();
if (trimmed.endsWith(STAR_SYMBOL))
versionId = new VersionId(trimmed.substring(0,trimmed.length()-1));
}
/**
* Implements the superclass method
*/
public boolean match(Versionable v) {
return false;
}
Search WWH ::




Custom Search