Coverage Report - org.apache.maven.doxia.module.confluence.parser.SectionBlock
 
Classes in this File Line Coverage Branch Coverage Complexity
SectionBlock
100%
36/36
90%
18/20
6
 
 1  
 package org.apache.maven.doxia.module.confluence.parser;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.doxia.sink.Sink;
 23  
 
 24  
 /**
 25  
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
 26  
  * @version $Id: SectionBlock.java 772533 2009-05-07 07:35:06Z ltheussl $
 27  
  */
 28  
 class SectionBlock
 29  
     implements Block
 30  
 {
 31  
     private Block text;
 32  
 
 33  
     private int level;
 34  
 
 35  
     SectionBlock( Block text, int level )
 36  58
     {
 37  58
         this.text = text;
 38  58
         this.level = level;
 39  58
     }
 40  
 
 41  
     /** {@inheritDoc} */
 42  
     public void traverse( Sink sink )
 43  
     {
 44  58
         if ( level == Sink.SECTION_LEVEL_1 )
 45  
         {
 46  18
             sink.section1();
 47  18
             sink.sectionTitle1();
 48  
         }
 49  40
         else if ( level == Sink.SECTION_LEVEL_2 )
 50  
         {
 51  10
             sink.section2();
 52  10
             sink.sectionTitle2();
 53  
         }
 54  30
         else if ( level == Sink.SECTION_LEVEL_3 )
 55  
         {
 56  14
             sink.section3();
 57  14
             sink.sectionTitle3();
 58  
         }
 59  16
         else if ( level == Sink.SECTION_LEVEL_4 )
 60  
         {
 61  8
             sink.section4();
 62  8
             sink.sectionTitle4();
 63  
         }
 64  8
         else if ( level == Sink.SECTION_LEVEL_5 )
 65  
         {
 66  8
             sink.section5();
 67  8
             sink.sectionTitle5();
 68  
         }
 69  
 
 70  58
         this.text.traverse( sink );
 71  
 
 72  58
         if ( level == Sink.SECTION_LEVEL_1 )
 73  
         {
 74  18
             sink.sectionTitle1_();
 75  18
             sink.section1_();
 76  
         }
 77  40
         else if ( level == Sink.SECTION_LEVEL_2 )
 78  
         {
 79  10
             sink.sectionTitle2_();
 80  10
             sink.section2_();
 81  
         }
 82  30
         else if ( level == Sink.SECTION_LEVEL_3 )
 83  
         {
 84  14
             sink.sectionTitle3_();
 85  14
             sink.section3_();
 86  
 
 87  
         }
 88  16
         else if ( level == Sink.SECTION_LEVEL_4 )
 89  
         {
 90  8
             sink.sectionTitle4_();
 91  8
             sink.section4_();
 92  
         }
 93  8
         else if ( level == Sink.SECTION_LEVEL_5 )
 94  
         {
 95  8
             sink.sectionTitle5_();
 96  8
             sink.section5_();
 97  
         }
 98  58
     }
 99  
 }