1 package org.apache.maven.repository.metadata;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.artifact.ArtifactScopeEnum;
23
24
25
26
27
28
29
30
31
32 public class MetadataGraphEdge
33 {
34 String version;
35 ArtifactScopeEnum scope;
36 int depth = -1;
37 int pomOrder = -1;
38 boolean resolved = true;
39 String artifactUri;
40
41
42
43
44
45
46
47 MetadataGraphVertex source;
48 MetadataGraphVertex target;
49
50
51 public MetadataGraphEdge( String version, boolean resolved, ArtifactScopeEnum scope, String artifactUri, int depth,
52 int pomOrder )
53 {
54 super();
55 this.version = version;
56 this.scope = scope;
57 this.artifactUri = artifactUri;
58 this.depth = depth;
59 this.resolved = resolved;
60 this.pomOrder = pomOrder;
61 }
62
63
64
65
66 private static boolean objectsEqual( Object o1, Object o2 )
67 {
68 if ( o1 == null && o2 == null )
69 {
70 return true;
71 }
72 if ( o1 == null || o2 == null )
73 {
74 return false;
75 }
76 return o1.equals( o2 );
77 }
78
79
80
81
82
83 @Override
84 @SuppressWarnings( "checkstyle:equalshashcode" )
85 public boolean equals( Object o )
86 {
87 if ( o instanceof MetadataGraphEdge )
88 {
89 MetadataGraphEdge e = (MetadataGraphEdge) o;
90
91 return objectsEqual( version, e.version )
92 && ArtifactScopeEnum.checkScope( scope ).getScope().
93 equals( ArtifactScopeEnum.checkScope( e.scope ).getScope() )
94 && depth == e.depth;
95 }
96 return false;
97 }
98
99
100 public String getVersion()
101 {
102 return version;
103 }
104
105 public void setVersion( String version )
106 {
107 this.version = version;
108 }
109
110 public ArtifactScopeEnum getScope()
111 {
112 return scope;
113 }
114
115 public void setScope( ArtifactScopeEnum scope )
116 {
117 this.scope = scope;
118 }
119
120 public int getDepth()
121 {
122 return depth;
123 }
124
125 public void setDepth( int depth )
126 {
127 this.depth = depth;
128 }
129
130 public boolean isResolved()
131 {
132 return resolved;
133 }
134
135 public void setResolved( boolean resolved )
136 {
137 this.resolved = resolved;
138 }
139
140 public int getPomOrder()
141 {
142 return pomOrder;
143 }
144
145 public void setPomOrder( int pomOrder )
146 {
147 this.pomOrder = pomOrder;
148 }
149
150 public String getArtifactUri()
151 {
152 return artifactUri;
153 }
154
155 public void setArtifactUri( String artifactUri )
156 {
157 this.artifactUri = artifactUri;
158 }
159
160 public MetadataGraphVertex getSource()
161 {
162 return source;
163 }
164
165 public void setSource( MetadataGraphVertex source )
166 {
167 this.source = source;
168 }
169
170 public MetadataGraphVertex getTarget()
171 {
172 return target;
173 }
174
175 public void setTarget( MetadataGraphVertex target )
176 {
177 this.target = target;
178 }
179
180 @Override
181 public String toString()
182 {
183 return "[ " + "FROM:("
184 + ( source == null ? "no source" : ( source.md == null ? "no source MD" : source.md.toString() ) ) + ") "
185 + "TO:(" + ( target == null ? "no target" : ( target.md == null ? "no target MD" : target.md.toString() ) )
186 + ") " + "version=" + version + ", scope=" + ( scope == null ? "null" : scope.getScope() ) + ", depth="
187 + depth + "]";
188 }
189
190
191 }