Coverage Report - org.paneris.bibliomania.BookFormat
 
Classes in this File Line Coverage Branch Coverage Complexity
BookFormat
0%
0/21
0%
0/4
3.667
 
 1  
 package org.paneris.bibliomania;
 2  
 
 3  
 import org.melati.poem.ValidationPoemException;
 4  
 import org.paneris.bibliomania.generated.BookFormatBase;
 5  
 
 6  
 import org.apache.oro.text.regex.MalformedPatternException;
 7  
 import org.apache.oro.text.regex.Perl5Compiler;
 8  
 import org.apache.oro.text.regex.Perl5Pattern;
 9  
 
 10  
 public class BookFormat extends BookFormatBase {
 11  0
   public BookFormat() {}
 12  
 
 13  0
   private Perl5Pattern regexp = null;
 14  0
   private boolean regexpValid = true;
 15  
 
 16  
   public void setDescriptionregexp(String re) {
 17  
     try {
 18  0
       Perl5Pattern newRegexp = (Perl5Pattern)new Perl5Compiler().compile(
 19  
                                    re, Perl5Compiler.CASE_INSENSITIVE_MASK);
 20  0
       super.setDescriptionregexp(re);
 21  0
       regexp = newRegexp;
 22  0
       regexpValid = true;
 23  
     }
 24  0
     catch (MalformedPatternException e) {
 25  0
       throw new ValidationPoemException(null, e);
 26  0
     }
 27  0
   }
 28  
 
 29  
   public Perl5Pattern getDescriptionPerl5Regexp() {
 30  0
     if (!regexpValid)
 31  0
       return null;
 32  
 
 33  0
     if (regexp != null) 
 34  0
       return regexp;
 35  
     else
 36  
       try {
 37  0
         regexp =
 38  
             (Perl5Pattern)new Perl5Compiler().compile(
 39  
                 getDescriptionregexp(), Perl5Compiler.CASE_INSENSITIVE_MASK);
 40  0
         regexpValid = true;
 41  0
         return regexp;
 42  
       }
 43  0
       catch (MalformedPatternException e) {
 44  0
         regexpValid = false;
 45  0
         return regexp;
 46  
       }
 47  
   }
 48  
 }