nl.uu.cs.ape.models.Pair Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of APE Show documentation
Show all versions of APE Show documentation
APE is a command line tool and an API for the automated exploration of possible computational pipelines (workflows) from large collections of computational tools.
The newest version!
package nl.uu.cs.ape.models;
import lombok.Getter;
/**
* The {@code Pair} class represents pairs of objects.
* E.g.: {@code }.
*
* @param the type parameter
* @author Vedran Kasalica
*/
public class Pair {
/** First pair element. */
@Getter
private T first;
@Getter
/** Second pair element. */
private T second;
/**
* Instantiates a new Pair.
*
* @param first the first
* @param second the second
*/
public Pair(T first, T second) {
this.first = first;
this.second = second;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((first == null) ? 0 : first.hashCode());
result = prime * result + ((second == null) ? 0 : second.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pair other = (Pair) obj;
if (first == null) {
if (other.first != null)
return false;
} else if (!first.equals(other.first))
return false;
if (second == null) {
if (other.second != null)
return false;
} else if (!second.equals(other.second))
return false;
return true;
}
}