All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.gdela.socomo.composition.ComponentDep Maven / Gradle / Ivy

Go to download

Core parts of the tool for visualizing and analyzing source code modularity of a single java project.

There is a newer version: 2.3.1
Show newest version
package pl.gdela.socomo.composition;

import org.apache.commons.lang3.builder.CompareToBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public class ComponentDep implements Comparable {

	public final Component from;
	public final Component to;
	public int strength;

	ComponentDep(Component from, Component to) {
		this.from = from;
		this.to = to;
	}

	void incrementStrengthBy(int increment) {
		strength += increment;
	}

	@Override
	public String toString() {
		return from + " -> " + to;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		ComponentDep that = (ComponentDep) o;
		return new EqualsBuilder()
				.append(from, that.from)
				.append(to, that.to)
				.isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder(17, 9)
				.append(from)
				.append(to)
				.toHashCode();
	}

	@Override
	public int compareTo(ComponentDep that) {
		return new CompareToBuilder()
				.append(from, that.from)
				.append(to, that.to)
				.toComparison();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy