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 public class CumulativeScopeArtifactFilter
36 extends AbstractScopeArtifactFilter
37 {
38
39 private Set<String> scopes;
40
41
42
43
44
45
46 public CumulativeScopeArtifactFilter( Collection<String> scopes )
47 {
48 this.scopes = new HashSet<>();
49
50 addScopes( scopes );
51 }
52
53
54
55
56
57
58 public CumulativeScopeArtifactFilter( CumulativeScopeArtifactFilter... filters )
59 {
60 this.scopes = new HashSet<>();
61
62 if ( filters != null )
63 {
64 for ( CumulativeScopeArtifactFilter filter : filters )
65 {
66 addScopes( filter.getScopes() );
67 }
68 }
69 }
70
71 private void addScopes( Collection<String> scopes )
72 {
73 if ( scopes != null )
74 {
75 for ( String scope : scopes )
76 {
77 addScope( scope );
78 }
79 }
80 }
81
82 private void addScope( String scope )
83 {
84 this.scopes.add( scope );
85
86 addScopeInternal( scope );
87 }
88
89 public Set<String> getScopes()
90 {
91 return scopes;
92 }
93
94 @Override
95 public int hashCode()
96 {
97 int hash = 17;
98
99 hash = hash * 31 + scopes.hashCode();
100
101 return hash;
102 }
103
104 @Override
105 public boolean equals( Object obj )
106 {
107 if ( this == obj )
108 {
109 return true;
110 }
111
112 if ( !( obj instanceof CumulativeScopeArtifactFilter ) )
113 {
114 return false;
115 }
116
117 CumulativeScopeArtifactFilter that = (CumulativeScopeArtifactFilter) obj;
118
119 return scopes.equals( that.scopes );
120 }
121
122 }