Coverage report

  %line %branch
nl.toolforge.karma.core.vc.PatchLine
83% 
100% 

 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.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  165
   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  165
     super(NAME_PREFIX + VERSION_SEPARATOR + version.getVersionNumber());
 55  
 
 56  165
     this.version = version;
 57  165
   }
 58  
 
 59  
   public String getPatternString() {
 60  165
     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  
     // Something like should be returned, where 0-0 is the version to which the patch applies: PATCHLINE_0-0-{1}\\d{1,2}
 73  0
     return NAME_PREFIX + PATCH_SEPARATOR_PATTERN + version.getVersionNumber() + Patch.PATCH_PATTERN_POSTFIX;
 74  
   }
 75  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.