1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package nl.toolforge.karma.core.vc;
20
21 import nl.toolforge.karma.core.Patch;
22 import nl.toolforge.karma.core.Version;
23
24 /***
25 * A <code>PatchLine</code> is a special type of <code>DevelopmentLine</code>, used when a module has been released to
26 * (for example) the test department. NIET_WEG.
27 *
28 * @author D.A. Smedes
29 * @version $Id: PatchLine.java,v 1.8 2004/10/26 22:45:21 hippe Exp $
30 */
31 public class PatchLine extends DevelopmentLine {
32
33 /***
34 * Name prefix for the symbolic name that is applied to the module when a patchline is created. A symbolic name
35 * would look like this : <code>PATCHLINE_0-2</code>, indicating that a patchline is created for
36 * version <code>0-2</code>.
37 */
38 public static final String NAME_PREFIX = "PATCHLINE";
39
40 public static final String VERSION_SEPARATOR_PATTERN = "_";
41 public static final String VERSION_SEPARATOR = "_";
42
43 public static final String PATCH_SEPARATOR_PATTERN = "_";
44 public static final String PATCH_SEPARATOR = "_";
45
46 private Version version = null;
47
48 /***
49 * Creates a PatchLine for version <code>version</code>.
50 *
51 * @param version The version for which a PatchLine must be created.
52 */
53 public PatchLine(Version version) {
54 super(NAME_PREFIX + VERSION_SEPARATOR + version.getVersionNumber());
55
56 this.version = version;
57 }
58
59 public String getPatternString() {
60 return NAME_PREFIX + VERSION_SEPARATOR_PATTERN + Version.VERSION_PATTERN_STRING;
61 }
62
63 /***
64 * Given the patch line for a module, a matching pattern is required to select the corresponding patch versions. A
65 * patch line <code>PATCHLINE_0-0</code> will generate patch versions like <code>PATCHLINE_0-0-1</code>,
66 * <code>PATCHLINE_0-0-2</code> etc. This method will then return the following pattern string :
67 * <code>PATCHLINE_0-0-\d{1,4}</code>
68 *
69 * @return See the method description.
70 */
71 public String getMatchingPattern() {
72
73 return NAME_PREFIX + PATCH_SEPARATOR_PATTERN + version.getVersionNumber() + Patch.PATCH_PATTERN_POSTFIX;
74 }
75 }