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

File UnifiedDiffConfiguration.java

 

Coverage histogram

../../../../img/srcFileCovDistChart8.png
54% of files have more coverage

Code metrics

0
4
4
1
87
24
4
1
1
4
1

Classes

Class Line # Actions
UnifiedDiffConfiguration 32 4 0% 4 2
0.7575%
 

Contributing tests

This file is covered by 15 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.diff.display;
21   
22    import org.xwiki.diff.DiffConfiguration;
23   
24    /**
25    * Configuration for {@link UnifiedDiffDisplayer}.
26    *
27    * @param <E> the type of elements that are compared to produce the first level diff
28    * @param <F> the type of sub-elements that can be compared to produce the second level diff when an element is modified
29    * @version $Id: fb2eeca000d2976940c99cfcaaec00b1e42e327b $
30    * @since 4.1RC1
31    */
 
32    public class UnifiedDiffConfiguration<E, F> extends DiffConfiguration<F>
33    {
34    /**
35    * Needed for serialization.
36    */
37    private static final long serialVersionUID = 1L;
38   
39    /**
40    * The number of unmodified elements to display before and after a chunk of modified elements. This number
41    * determines how blocks are created. If the distance between two changes is less than the double of this value then
42    * those changes are put in the same block (they share the same context).
43    */
44    private int contextSize = 3;
45   
46    /**
47    * The object used to split the modified elements into sub-elements in order to produce a more detailed diff. This
48    * allows us to display changes at two levels of granularity (elements and their sub-elements).
49    */
50    private Splitter<E, F> splitter;
51   
52    /**
53    * @return the number of unmodified elements to display before and after a chunk of modified elements
54    */
 
55  47 toggle public int getContextSize()
56    {
57  47 return this.contextSize;
58    }
59   
60    /**
61    * Sets the number of unmodified elements to display before and after a chunk of modified elements.
62    *
63    * @param contextSize the context size
64    */
 
65  0 toggle public void setContextSize(int contextSize)
66    {
67  0 this.contextSize = contextSize;
68    }
69   
70    /**
71    * @return the object used to split the modified elements into sub-elements in order to produce a more detailed diff
72    */
 
73  43 toggle public Splitter<E, F> getSplitter()
74    {
75  43 return this.splitter;
76    }
77   
78    /**
79    * Sets The object used to split the modified elements into sub-elements in order to produce a more detailed diff.
80    *
81    * @param splitter the splitter
82    */
 
83  14 toggle public void setSplitter(Splitter<E, F> splitter)
84    {
85  14 this.splitter = splitter;
86    }
87    }