Java Reference
In-Depth Information
L ISTING 12.4
Continued
if (value instanceof VersionId)
return compareToVersionId((VersionId) value);
if (value instanceof StarVersion)
return -1;
return 0;
}
/**
* An utility method when comparing VersionIds.
* See JNLP Specs. Appendix A.
*/
protected String[] normalize(String pieces[], int maxLen) {
if (pieces.length >= maxLen)
return pieces;
String normalized[] = new String[maxLen];
System.arraycopy(pieces, 0, normalized, 0, pieces.length);
Arrays.fill(normalized, pieces.length, maxLen, “0”);
return normalized;
}
public String[] getSingleValues(){
return singleValues;
}
/**
* Returns a human-readable representation of the versionId
*/
public String toString() {
StringBuffer stringbuffer = new StringBuffer();
for(int i = 0; i < singleValues.length - 1; i++) {
stringbuffer.append(singleValues[i]);
stringbuffer.append(DOT_CHAR);
}
if(singleValues.length > 0)
stringbuffer.append(singleValues[singleValues.length - 1]);
return stringbuffer.toString();
}
/**
* By now VersionIds are considered equals when they have the same
* string representation. THIS IS NOT ALWAYS TRUE !
*
*/
Search WWH ::




Custom Search