View Javadoc

1   /*
2   Karma core - Core of the Karma application
3   Copyright (C) 2004  Toolforge <www.toolforge.nl>
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19  package nl.toolforge.karma.core;
20  
21  /***
22   * @author D.A. Smedes
23   * @version $Id: Patch.java,v 1.6 2004/11/02 22:57:08 amooy Exp $
24   */
25  public class Patch extends Version {
26  
27    public static final String PATCH_PATTERN_POSTFIX = "-{1}//d{1,2}";
28  
29    /***
30     * Override for {@link Version.VERSION_PATTERN_STRING}. A patch can have one more digit.
31     *
32     * @see #PATCH_PATTERN_POSTFIX
33     */
34    public static final String VERSION_PATTERN_STRING = Version.VERSION_PATTERN_STRING + PATCH_PATTERN_POSTFIX;
35  
36    public static int INITIAL_PATCH = 1;
37  
38    /***
39     * Patches have the following format : <code>0-0-x</code>, where x is the actual patch number within the
40     * <code>0-0</code> version. The full thing has to be provided.
41     *
42     * @param patchNumber
43     */
44    public Patch(String patchNumber) {
45      super(patchNumber);
46    }
47  
48    public String getPatternString() {
49      return VERSION_PATTERN_STRING;
50    }
51  
52    /***
53     * Overridden to throw an IllegalStateException because you cannot increase the major
54     * version number of a patch version. 
55     * @see nl.toolforge.karma.core.Version#increaseMajor()
56     */
57    public void increaseMajor() {
58      throw new IllegalStateException("IncreaseMajor() is not supported for patch versions.");
59    }
60  }