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

File SpecialSymbolBlock.java

 

Coverage histogram

../../../../img/srcFileCovDistChart6.png
69% of files have more coverage

Code metrics

4
13
6
1
95
44
9
0.69
2.17
6
1.5

Classes

Class Line # Actions
SpecialSymbolBlock 31 13 0% 9 9
0.608695660.9%
 

Contributing tests

This file is covered by 369 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    * Represent a non-alphanumeric and non-space symbol ({@code >}, {@code ]}, ...).
27    *
28    * @version $Id: 77c2aa6d3bd0a4bc1ba506080da80847372f00bb $
29    * @since 1.5M2
30    */
 
31    public class SpecialSymbolBlock extends AbstractBlock
32    {
33    /**
34    * The symbol.
35    */
36    private char symbol;
37   
38    /**
39    * @param symbol the symbol
40    */
 
41  499484 toggle public SpecialSymbolBlock(char symbol)
42    {
43  499484 this.symbol = symbol;
44    }
45   
46    /**
47    * @return the symbol
48    */
 
49  2005475 toggle public char getSymbol()
50    {
51  2005474 return this.symbol;
52    }
53   
 
54  364023 toggle @Override
55    public void traverse(Listener listener)
56    {
57  364023 listener.onSpecialSymbol(getSymbol());
58    }
59   
60    /**
61    * {@inheritDoc}
62    *
63    * @since 1.8RC2
64    */
 
65  0 toggle @Override
66    public String toString()
67    {
68  0 return String.valueOf(getSymbol());
69    }
70   
 
71  1534100 toggle @Override
72    public boolean equals(Object obj)
73    {
74  1534100 if (obj == this) {
75  0 return true;
76    }
77   
78  1534100 if (obj instanceof SpecialSymbolBlock && super.equals(obj)) {
79  5 return getSymbol() == ((SpecialSymbolBlock) obj).getSymbol();
80    }
81   
82  1534095 return false;
83    }
84   
 
85  0 toggle @Override
86    public int hashCode()
87    {
88  0 HashCodeBuilder builder = new HashCodeBuilder();
89   
90  0 builder.appendSuper(super.hashCode());
91  0 builder.append(getSymbol());
92   
93  0 return builder.toHashCode();
94    }
95    }