1 package org.apache.maven.artifact.resolver.filter;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Collection;
23 import java.util.HashSet;
24 import java.util.Set;
25
26
27
28
29
30
31
32
33
34
35
36 public class CumulativeScopeArtifactFilter
37 extends AbstractScopeArtifactFilter
38 {
39
40 private Set<String> scopes;
41
42
43
44
45
46
47 public CumulativeScopeArtifactFilter( Collection<String> scopes )
48 {
49 this.scopes = new HashSet<String>();
50
51 addScopes( scopes );
52 }
53
54
55
56
57
58
59 public CumulativeScopeArtifactFilter( CumulativeScopeArtifactFilter... filters )
60 {
61 this.scopes = new HashSet<String>();
62
63 if ( filters != null )
64 {
65 for ( CumulativeScopeArtifactFilter filter : filters )
66 {
67 addScopes( filter.getScopes() );
68 }
69 }
70 }
71
72 private void addScopes( Collection<String> scopes )
73 {
74 if ( scopes != null )
75 {
76 for ( String scope : scopes )
77 {
78 addScope( scope );
79 }
80 }
81 }
82
83 private void addScope( String scope )
84 {
85 this.scopes.add( scope );
86
87 addScopeInternal( scope );
88 }
89
90 public Set<String> getScopes()
91 {
92 return scopes;
93 }
94
95 @Override
96 public int hashCode()
97 {
98 int hash = 17;
99
100 hash = hash * 31 + scopes.hashCode();
101
102 return hash;
103 }
104
105 @Override
106 public boolean equals( Object obj )
107 {
108 if ( this == obj )
109 {
110 return true;
111 }
112
113 if ( !( obj instanceof CumulativeScopeArtifactFilter ) )
114 {
115 return false;
116 }
117
118 CumulativeScopeArtifactFilter that = (CumulativeScopeArtifactFilter) obj;
119
120 return scopes.equals( that.scopes );
121 }
122
123 }