1   
2   
3   
4   
5   
6   package org.apache.maven.model;
7   
8   
9   
10  
11  
12  
13  @SuppressWarnings( "all" )
14  public class PatternSet
15      implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
16  {
17  
18        
19       
20      
21  
22      
23  
24  
25      private java.util.List<String> includes;
26  
27      
28  
29  
30      private java.util.List<String> excludes;
31  
32      
33  
34  
35      private java.util.Map<Object, InputLocation> locations;
36  
37      
38  
39  
40      private InputLocation location;
41  
42      
43  
44  
45      private InputLocation includesLocation;
46  
47      
48  
49  
50      private InputLocation excludesLocation;
51  
52  
53        
54       
55      
56  
57      
58  
59  
60  
61  
62      public void addExclude( String string )
63      {
64          getExcludes().add( string );
65      } 
66  
67      
68  
69  
70  
71  
72      public void addInclude( String string )
73      {
74          getIncludes().add( string );
75      } 
76  
77      
78  
79  
80  
81  
82      public PatternSet clone()
83      {
84          try
85          {
86              PatternSet copy = (PatternSet) super.clone();
87  
88              if ( this.includes != null )
89              {
90                  copy.includes = new java.util.ArrayList<String>();
91                  copy.includes.addAll( this.includes );
92              }
93  
94              if ( this.excludes != null )
95              {
96                  copy.excludes = new java.util.ArrayList<String>();
97                  copy.excludes.addAll( this.excludes );
98              }
99  
100             if ( copy.locations != null )
101             {
102                 copy.locations = new java.util.LinkedHashMap( copy.locations );
103             }
104 
105             return copy;
106         }
107         catch ( java.lang.Exception ex )
108         {
109             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
110                 + " does not support clone()" ).initCause( ex );
111         }
112     } 
113 
114     
115 
116 
117 
118 
119     public java.util.List<String> getExcludes()
120     {
121         if ( this.excludes == null )
122         {
123             this.excludes = new java.util.ArrayList<String>();
124         }
125 
126         return this.excludes;
127     } 
128 
129     
130 
131 
132 
133 
134     public java.util.List<String> getIncludes()
135     {
136         if ( this.includes == null )
137         {
138             this.includes = new java.util.ArrayList<String>();
139         }
140 
141         return this.includes;
142     } 
143 
144     
145 
146 
147 
148 
149 
150     public InputLocation getLocation( Object key )
151     {
152         if ( key instanceof String )
153         {
154             switch ( ( String ) key )
155             {
156                 case "" :
157                 {
158                     return this.location;
159                 }
160                 case "includes" :
161                 {
162                     return includesLocation;
163                 }
164                 case "excludes" :
165                 {
166                     return excludesLocation;
167                 }
168                 default :
169                 {
170                     return getOtherLocation( key );
171                 }
172                 }
173             }
174             else
175             {
176                 return getOtherLocation( key );
177             }
178     } 
179 
180     
181 
182 
183 
184 
185 
186     public void setLocation( Object key, InputLocation location )
187     {
188         if ( key instanceof String )
189         {
190             switch ( ( String ) key )
191             {
192                 case "" :
193                 {
194                     this.location = location;
195                     return;
196                 }
197                 case "includes" :
198                 {
199                     includesLocation = location;
200                     return;
201                 }
202                 case "excludes" :
203                 {
204                     excludesLocation = location;
205                     return;
206                 }
207                 default :
208                 {
209                     setOtherLocation( key, location );
210                     return;
211                 }
212                 }
213             }
214             else
215             {
216                 setOtherLocation( key, location );
217             }
218     } 
219 
220     
221 
222 
223 
224 
225 
226     public void setOtherLocation( Object key, InputLocation location )
227     {
228         if ( location != null )
229         {
230             if ( this.locations == null )
231             {
232                 this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
233             }
234             this.locations.put( key, location );
235         }
236     } 
237 
238     
239 
240 
241 
242 
243 
244     private InputLocation getOtherLocation( Object key )
245     {
246         return ( locations != null ) ? locations.get( key ) : null;
247     } 
248 
249     
250 
251 
252 
253 
254     public void removeExclude( String string )
255     {
256         getExcludes().remove( string );
257     } 
258 
259     
260 
261 
262 
263 
264     public void removeInclude( String string )
265     {
266         getIncludes().remove( string );
267     } 
268 
269     
270 
271 
272 
273 
274 
275     public void setExcludes( java.util.List<String> excludes )
276     {
277         this.excludes = excludes;
278     } 
279 
280     
281 
282 
283 
284 
285 
286     public void setIncludes( java.util.List<String> includes )
287     {
288         this.includes = includes;
289     } 
290 
291     
292             
293     
294 
295 
296     public String toString()
297     {
298         StringBuilder sb = new StringBuilder( 128 );
299 
300         sb.append("PatternSet [includes: {");
301         for (java.util.Iterator i = getIncludes().iterator(); i.hasNext(); )
302         {
303             String str = (String) i.next();
304             sb.append(str).append(", ");
305         }
306         if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
307 
308         sb.append("}, excludes: {");
309         for (java.util.Iterator i = getExcludes().iterator(); i.hasNext(); )
310         {
311             String str = (String) i.next();
312             sb.append(str).append(", ");
313         }
314         if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
315 
316         sb.append("}]");
317         return sb.toString();
318     }
319             
320           
321 }