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

File Delta.java

 

Code metrics

0
0
0
2
93
17
0
-
-
0
-

Classes

Class Line # Actions
Delta 30 0 - 0 0
-1.0 -
Delta.Type 37 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

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;
21   
22    import java.util.List;
23   
24    /**
25    * A delta between two version of a list.
26    *
27    * @param <E> the type of compared elements
28    * @version $Id: 45cfe6a428611d8627ff75ed4d3a37e149775393 $
29    */
 
30    public interface Delta<E>
31    {
32    /**
33    * The kind of modification to apply on the list.
34    *
35    * @version $Id: 45cfe6a428611d8627ff75ed4d3a37e149775393 $
36    */
 
37    enum Type
38    {
39    /**
40    * Change one or several following elements.
41    */
42    CHANGE,
43   
44    /**
45    * Deleted one or several following elements.
46    */
47    DELETE,
48   
49    /**
50    * Insert one or several following elements.
51    */
52    INSERT
53    }
54   
55    /**
56    * Try to apply the delta on the provided list.
57    *
58    * @param target the list to modify
59    * @throws PatchException if the delta cannot be applied
60    */
61    void verify(List<E> target) throws PatchException;
62   
63    /**
64    * Apply the delta on the provided list.
65    *
66    * @param target the list to modify
67    * @throws PatchException if the delta cannot be applied
68    */
69    void apply(List<E> target) throws PatchException;
70   
71    /**
72    * Apply the an inverted version of the delta on the provided list.
73    *
74    * @param target the list to modify
75    * @throws PatchException if the delta cannot be applied
76    */
77    void restore(List<E> target) throws PatchException;
78   
79    /**
80    * @return the type of modification applied to the list
81    */
82    Type getType();
83   
84    /**
85    * @return the chunk before the modification
86    */
87    Chunk<E> getPrevious();
88   
89    /**
90    * @return the chunk after the modification
91    */
92    Chunk<E> getNext();
93    }