1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rendering.block

File EmptyLinesBlock.java

 

Coverage histogram

../../../../img/srcFileCovDistChart4.png
78% of files have more coverage

Code metrics

4
13
6
1
93
43
8
0.62
2.17
6
1.33

Classes

Class Line # Actions
EmptyLinesBlock 32 13 0% 8 15
0.347826134.8%
 

Contributing tests

This file is covered by 17 tests. .

Source view

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.block;
21   
22    import org.apache.commons.lang3.builder.HashCodeBuilder;
23    import org.xwiki.rendering.listener.Listener;
24   
25    /**
26    * Represents an empty line between 2 standalone Blocks. A standalone block is block that is not included in another
27    * block. Standalone blocks are Paragraph, Standalone Macro, Lists, Table, etc.
28    *
29    * @version $Id: 41d811c826ca07cd5e880dca4e018e916fd3fc09 $
30    * @since 1.6M2
31    */
 
32    public class EmptyLinesBlock extends AbstractBlock
33    {
34    /**
35    * Number of empty lines between 2 standalone Blocks.
36    */
37    private int count;
38   
39    /**
40    * @param count the number of empty lines between 2 standalone Blocks
41    */
 
42  228 toggle public EmptyLinesBlock(int count)
43    {
44  228 setEmptyLinesCount(count);
45    }
46   
47    /**
48    * @return the number of empty lines between 2 standalone Blocks
49    */
 
50  228 toggle public int getEmptyLinesCount()
51    {
52  228 return this.count;
53    }
54   
55    /**
56    * @param count the number of empty lines between 2 standalone Blocks
57    */
 
58  228 toggle public void setEmptyLinesCount(int count)
59    {
60  228 this.count = count;
61    }
62   
 
63  228 toggle @Override
64    public void traverse(Listener listener)
65    {
66  228 listener.onEmptyLines(getEmptyLinesCount());
67    }
68   
 
69  0 toggle @Override
70    public boolean equals(Object obj)
71    {
72  0 if (obj == this) {
73  0 return true;
74    }
75   
76  0 if (obj instanceof EmptyLinesBlock) {
77  0 return getEmptyLinesCount() == ((EmptyLinesBlock) obj).getEmptyLinesCount() && super.equals(obj);
78    }
79   
80  0 return false;
81    }
82   
 
83  0 toggle @Override
84    public int hashCode()
85    {
86  0 HashCodeBuilder builder = new HashCodeBuilder();
87   
88  0 builder.append(super.hashCode());
89  0 builder.append(getEmptyLinesCount());
90   
91  0 return builder.toHashCode();
92    }
93    }