/*
 * Copyright 2016-2021 Talsma ICT
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.talsmasoftware.umldoclet.javadoc.dependencies;

import java.util.Objects;

import static java.util.Objects.requireNonNull;

public class PackageDependency {

    public final String fromPackage;
    public final String toPackage;

    public PackageDependency(String fromPackage, String toPackage) {
        this.fromPackage = requireNonNull(fromPackage, "No 'from' package defined for dependency.");
        this.toPackage = requireNonNull(toPackage, "No 'to' package defined for dependency.");
    }

    @Override
    public int hashCode() {
        return Objects.hash(fromPackage, toPackage);
    }

    @Override
    public boolean equals(Object other) {
        return this == other || (other instanceof PackageDependency
                && fromPackage.equals(((PackageDependency) other).fromPackage)
                && toPackage.equals(((PackageDependency) other).toPackage)
        );
    }

    @Override
    public String toString() {
        return fromPackage + "->" + toPackage;
    }
}

@@ -734,488 +734,1974 @@
 l;%0A%0A
-public class PackageDependency %7B%0A%0A    public final String fromPackage;%0A    public final String toPackage;%0A%0A    public PackageDependency(String fromPackage, String toPackage) %7B%0A        this.fromPackage = requireNonNull(fromPackage, %22No 'from' package defined for dependency.%22);%0A        this.toPackage = requireNonNull(toPackage, %22No 'to' package defined for dependency.%22);%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return Objects.hash(fromPackage, toPackage);%0A    %7D%0A
+/**%0A * Package dependency.%0A * %3Cp%3E%0A * Contains a 'from' package and a 'to' package. A (from) package has a dependency on a (to) package%0A * if there is at least one element in the 'from' package that needs at least one element in the 'to' package.%0A * %3Cp%3E%0A * This class overrides %7B@code equals%7D and %7B@code hashCode%7D methods so unique package dependencies%0A * can easily be included in hashed collections.%0A *%0A * @author Sjoerd Talsma%0A */%0Apublic class PackageDependency %7B%0A%0A    /**%0A     * The qualified name of the depending package.%0A     * This package contains at least one element that has a dependency on an element in the %7B@link #toPackage%7D.%0A     */%0A    public final String fromPackage;%0A%0A    /**%0A     * The qualified name of the depended-upon package.%0A     * This package contains at least one element that is needed by an element in the %7B@link #fromPackage%7D.%0A     */%0A    public final String toPackage;%0A%0A    /**%0A     * Create a new package dependency object.%0A     *%0A     * @param fromPackage The package that has a dependency on another package.%0A     * @param toPackage   The package that is depended upon.%0A     */%0A    public PackageDependency(String fromPackage, String toPackage) %7B%0A        this.fromPackage = requireNonNull(fromPackage, %22No 'from' package defined for dependency.%22);%0A        this.toPackage = requireNonNull(toPackage, %22No 'to' package defined for dependency.%22);%0A    %7D%0A%0A    /**%0A     * @return Hashcode implementation based on the %7B@link #fromPackage%7D and %7B@link #toPackage%7D values.%0A     */%0A    @Override%0A    public int hashCode() %7B%0A        return Objects.hash(fromPackage, toPackage);%0A    %7D%0A%0A    /**%0A     * Equal implementation based on the %7B@link #fromPackage%7D and %7B@link #toPackage%7D values.%0A     *%0A     * @param other The other object to compare with.%0A     * @return %7B@code true%7D if the other object is also a %7B@link PackageDependency%7D and contains%0A     * the same %7B@link #fromPackage%7D and %7B@link #toPackage%7D values, %7B@code false%7D otherwise.%0A     */
 %0A   
@@ -2989,24 +2989,113 @@
   );%0A    %7D%0A%0A
+    /**%0A     * @return Human-readable representation of this package dependency.%0A     */%0A
     @Overrid

Add JavaDoc.