Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package edu.stanford.nlp.util;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.Serializable;
import java.util.Comparator;
import java.util.List;
import edu.stanford.nlp.util.logging.PrettyLoggable;
import edu.stanford.nlp.util.logging.PrettyLogger;
import edu.stanford.nlp.util.logging.Redwood.RedwoodChannels;
/**
* Pair is a Class for holding mutable pairs of objects.
*
* Implementation note:
* On a 32-bit JVM uses ~ 8 (this) + 4 (first) + 4 (second) = 16 bytes.
* On a 64-bit JVM uses ~ 16 (this) + 8 (first) + 8 (second) = 32 bytes.
*
* Many applications use a lot of Pairs so it's good to keep this
* number small.
*
* @author Dan Klein
* @author Christopher Manning (added stuff from Kristina's, rounded out)
* @version 2002/08/25
*/
public class Pair implements Comparable>, Serializable, PrettyLoggable {
/**
* Direct access is deprecated. Use first().
*
* @serial
*/
public T1 first;
/**
* Direct access is deprecated. Use second().
*
* @serial
*/
public T2 second;
public Pair() {
// first = null; second = null; -- default initialization
}
public Pair(T1 first, T2 second) {
this.first = first;
this.second = second;
}
public T1 first() {
return first;
}
public T2 second() {
return second;
}
public void setFirst(T1 o) {
first = o;
}
public void setSecond(T2 o) {
second = o;
}
@Override
public String toString() {
return "(" + first + "," + second + ")";
}
@Override
public boolean equals(Object o) {
if (o instanceof Pair) {
@SuppressWarnings("rawtypes")
Pair p = (Pair) o;
return (first == null ? p.first() == null : first.equals(p.first())) && (second == null ? p.second() == null : second.equals(p.second()));
} else {
return false;
}
}
@Override
public int hashCode() {
int firstHash = (first == null ? 0 : first.hashCode());
int secondHash = (second == null ? 0 : second.hashCode());
return firstHash*31 + secondHash;
}
public List