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