1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package org.openoffice.xmerge.merger;
25 
26 import org.openoffice.xmerge.MergeException;
27 import org.openoffice.xmerge.merger.Iterator;
28 import org.openoffice.xmerge.merger.Difference;
29 
30 /**
31  *  This is the <code>MergeAlgorithm</code> interface. It is an
32  *  interface so that different merge algorithms may be plugged-in
33  *  to actually merge the diffs back to an original document.
34  *
35  *  @author smak
36  */
37 public interface MergeAlgorithm {
38 
39     /**
40      *  This method is to merge the difference to an <code>Iterator</code>.
41      *  The original <code>Iterator</code> will be modified after the call.
42      *
43      *  @param  orgSeq       The original sequence which the difference
44      *                       will be applied.  It will be modified.
45      *  @param  modSeq       The modified sequence where the difference
46      *                       content will be extracted.
47      *  @param  differences  The <code>Difference</code> array.
48      *
49      *  @return  An <code>Iterator</code> which is the modified original
50      *           <code>Iterator</code> Sequence.  Same as the first parameter.
51      *
52      *  @throws  MergeException  If an error occurs during the merge.
53      */
applyDifference(Iterator orgSeq, Iterator modSeq, Difference[] differences)54     public void applyDifference(Iterator orgSeq, Iterator modSeq,
55                                 Difference[] differences) throws MergeException;
56 }
57 
58