1 /**
2  * @copyright
3  * ====================================================================
4  *    Licensed to the Apache Software Foundation (ASF) under one
5  *    or more contributor license agreements.  See the NOTICE file
6  *    distributed with this work for additional information
7  *    regarding copyright ownership.  The ASF licenses this file
8  *    to you under the Apache License, Version 2.0 (the
9  *    "License"); you may not use this file except in compliance
10  *    with the License.  You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *    Unless required by applicable law or agreed to in writing,
15  *    software distributed under the License is distributed on an
16  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  *    KIND, either express or implied.  See the License for the
18  *    specific language governing permissions and limitations
19  *    under the License.
20  * ====================================================================
21  * @endcopyright
22  */
23 
24 package org.apache.subversion.javahl.types;
25 
26 import org.apache.subversion.javahl.ClientException;
27 import org.apache.subversion.javahl.NativeResources;
28 
29 import java.util.List;
30 
31 /**
32  * Object that describes a revision range list, including operations on it.
33  * Returned from new accessors in {@link Mergeinfo}.
34  * @since 1.9
35  */
36 public class RevisionRangeList implements java.io.Serializable
37 {
38     // Update the serialVersionUID when there is a incompatible change
39     // made to this class.  See any of the following, depending upon
40     // the Java release.
41     private static final long serialVersionUID = 1L;
42 
43     /**
44      * Load the required native library.
45      */
46     static
47     {
NativeResources.loadNativeLibrary()48         NativeResources.loadNativeLibrary();
49     }
50 
51     private List<RevisionRange> ranges;
52 
53     /**
54      * Wrap a list of revision ranges.
55      */
RevisionRangeList(List<RevisionRange> ranges)56     public RevisionRangeList(List<RevisionRange> ranges)
57     {
58         this.ranges = ranges;
59     }
60 
61     /**
62      * @return The wrapped list of revision ranges.
63      */
getRanges()64     public List<RevisionRange> getRanges()
65     {
66         return ranges;
67     }
68 
69     /**
70      * Remove revisions in <code>eraser</code> from the current object
71      * and return the resulting difference.
72      * @param eraser The list of revisions to remoove.
73      * @param considerInheritance Determines how to account for the
74      *   {@link RevisionRange#isInherited} property when comparing
75      *   revision ranges for equality.
76      */
remove(List<RevisionRange> eraser, boolean considerInheritance)77     public native List<RevisionRange> remove(List<RevisionRange> eraser,
78                                              boolean considerInheritance)
79         throws ClientException;
80 
81     /**
82      * Remove revisions in <code>eraser</code> from the current object
83      * and return the resulting difference.
84      * @param eraser The list of revisions to remoove.
85      * @param considerInheritance Determines how to account for the
86      *   {@link RevisionRange#isInherited} property when comparing
87      *   revision ranges for equality.
88      */
remove(RevisionRangeList eraser, boolean considerInheritance)89     public RevisionRangeList remove(RevisionRangeList eraser,
90                                     boolean considerInheritance)
91         throws ClientException
92     {
93         return new RevisionRangeList
94             (remove(eraser.ranges, considerInheritance));
95     }
96 
97     // TODO: More svn_rangelist_t operations
98 }
99