@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ( isManaged() ? 1231 : 1237 ); return result; }
@Override public String toString() { return String.format( "DependencyRelationship [%s => %s (managed=%s, scope=%s, index=%s)]", getDeclaring(), getTarget(), isManaged(), scope, getIndex() ); }
@Override public boolean equals( final Object obj ) { if ( this == obj ) { return true; } if ( !super.equals( obj ) ) { return false; } if ( !( obj instanceof DependencyRelationship ) ) { return false; } final DependencyRelationship other = (DependencyRelationship) obj; return isManaged() == other.isManaged(); }
@Override public DependencyRelationship selectDeclaring( final ProjectVersionRef ref ) { final ArtifactRef t = getTarget(); Set<ProjectRef> var = getExcludes(); return new SimpleDependencyRelationship( getSources(), getPomLocation(), ref, t, getScope(), getIndex(), isManaged(), isInherited(), optional, var.toArray( new ProjectRef[var.size()] ) ); }
@Override public DependencyRelationship addSources( final Collection<URI> sources ) { Set<URI> srcs = getSources(); srcs.addAll( sources ); return new SimpleDependencyRelationship( srcs, getPomLocation(), getDeclaring(), getTarget(), scope, getIndex(), isManaged(), isInherited(), optional ); }
@Override public DependencyRelationship addSource( final URI source ) { Set<URI> srcs = getSources(); srcs.add( source ); return new SimpleDependencyRelationship( srcs, getPomLocation(), getDeclaring(), getTarget(), scope, getIndex(), isManaged(), isInherited(), optional ); }
@Override public synchronized DependencyRelationship cloneFor( final ProjectVersionRef projectRef ) { return new SimpleDependencyRelationship( getSources(), getPomLocation(), projectRef, getTarget(), scope, getIndex(), isManaged(), isInherited(), optional ); }
@Override public DependencyRelationship selectTarget( final ProjectVersionRef ref ) { final ProjectVersionRef d = getDeclaring(); ArtifactRef t = getTarget(); t = (ArtifactRef) ( ( ref instanceof ArtifactRef ) ? ref : new SimpleArtifactRef( ref, t.getType(), t.getClassifier() ) ); Set<ProjectRef> var = getExcludes(); return new SimpleDependencyRelationship( getSources(), getPomLocation(), d, t, getScope(), getIndex(), isManaged(), isInherited(), optional, var.toArray( new ProjectRef[var.size()] ) ); }