Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
25   106   9   8.33
0   46   0.36   3
3     3  
1    
 
  HeaderLevel       Line # 26 25 0% 9 2 92.9% 0.9285714
 
  (89)
 
1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software 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 software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.rendering.listener;
21   
22    /**
23    * @version $Id: a1fb999b388a4ab8dd32bd9f4661e81d6dfff4ce $
24    * @since 1.5M2
25    */
 
26    public enum HeaderLevel
27    {
28    /**
29    * Header of level 1.
30    */
31    LEVEL1,
32   
33    /**
34    * Header of level 2.
35    */
36    LEVEL2,
37   
38    /**
39    * Header of level 3.
40    */
41    LEVEL3,
42   
43    /**
44    * Header of level 4.
45    */
46    LEVEL4,
47   
48    /**
49    * Header of level 5.
50    */
51    LEVEL5,
52   
53    /**
54    * Header of level 6.
55    */
56    LEVEL6;
57   
58    /**
59    * @return the header level as integer
60    */
 
61  504 toggle public int getAsInt()
62    {
63  504 return this.ordinal() + 1;
64    }
65   
 
66  248 toggle @Override
67    public String toString()
68    {
69  248 return "" + getAsInt();
70    }
71   
72    /**
73    * Convert provided integer into the corresponding header level enum entry.
74    *
75    * @param value the header level as integer
76    * @return the header level as enum entry
77    */
 
78  228 toggle public static HeaderLevel parseInt(int value)
79    {
80  228 HeaderLevel result;
81  228 switch (value) {
82  139 case 1:
83  139 result = HeaderLevel.LEVEL1;
84  139 break;
85  28 case 2:
86  28 result = HeaderLevel.LEVEL2;
87  28 break;
88  21 case 3:
89  21 result = HeaderLevel.LEVEL3;
90  21 break;
91  16 case 4:
92  16 result = HeaderLevel.LEVEL4;
93  16 break;
94  10 case 5:
95  10 result = HeaderLevel.LEVEL5;
96  10 break;
97  14 case 6:
98  14 result = HeaderLevel.LEVEL6;
99  14 break;
100  0 default:
101  0 throw new IllegalArgumentException("Invalid level [" + value + "]. Only levels 1 to 6 are allowed.");
102    }
103   
104  228 return result;
105    }
106    }