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 public boolean equals( Object o )
85 {
86 if ( o instanceof MetadataGraphEdge )
87 {
88 MetadataGraphEdge e = (MetadataGraphEdge) o;
89
90 return objectsEqual( version, e.version )
91 && ArtifactScopeEnum.checkScope( scope ).getScope().
92 equals( ArtifactScopeEnum.checkScope( e.scope ).getScope() )
93 && depth == e.depth;
94 }
95 return false;
96 }
97
98
99 public String getVersion()
100 {
101 return version;
102 }
103
104 public void setVersion( String version )
105 {
106 this.version = version;
107 }
108
109 public ArtifactScopeEnum getScope()
110 {
111 return scope;
112 }
113
114 public void setScope( ArtifactScopeEnum scope )
115 {
116 this.scope = scope;
117 }
118
119 public int getDepth()
120 {
121 return depth;
122 }
123
124 public void setDepth( int depth )
125 {
126 this.depth = depth;
127 }
128
129 public boolean isResolved()
130 {
131 return resolved;
132 }
133
134 public void setResolved( boolean resolved )
135 {
136 this.resolved = resolved;
137 }
138
139 public int getPomOrder()
140 {
141 return pomOrder;
142 }
143
144 public void setPomOrder( int pomOrder )
145 {
146 this.pomOrder = pomOrder;
147 }
148
149 public String getArtifactUri()
150 {
151 return artifactUri;
152 }
153
154 public void setArtifactUri( String artifactUri )
155 {
156 this.artifactUri = artifactUri;
157 }
158
159 public MetadataGraphVertex getSource()
160 {
161 return source;
162 }
163
164 public void setSource( MetadataGraphVertex source )
165 {
166 this.source = source;
167 }
168
169 public MetadataGraphVertex getTarget()
170 {
171 return target;
172 }
173
174 public void setTarget( MetadataGraphVertex target )
175 {
176 this.target = target;
177 }
178
179 @Override
180 public String toString()
181 {
182 return "[ " + "FROM:("
183 + ( source == null ? "no source" : ( source.md == null ? "no source MD" : source.md.toString() ) ) + ") "
184 + "TO:(" + ( target == null ? "no target" : ( target.md == null ? "no target MD" : target.md.toString() ) )
185 + ") " + "version=" + version + ", scope=" + ( scope == null ? "null" : scope.getScope() ) + ", depth="
186 + depth + "]";
187 }
188
189
190 }