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

cdc.util.tuples.CTuple2 Maven / Gradle / Ivy

package cdc.util.tuples;

/**
 * Tuple of 2 comparable values.
 *
 * @author Damien Carbonne
 *
 * @param  Value 0 type.
 * @param  Value 1 type.
 */
public class CTuple2, T1 extends Comparable> extends Tuple2 implements CTuple> {
    public CTuple2(T0 value0,
                   T1 value1) {
        super(value0,
              value1);
    }

    @Override
    public Comparable getValue(int index) {
        return (Comparable) super.getValue(index);
    }

    @Override
    public int compareTo(CTuple2 other) {
        final int cmp0 = CTuple.compare(value0, other.value0);
        if (cmp0 == 0) {
            return CTuple.compare(value1, other.value1);
        } else {
            return cmp0;
        }
    }

    @Override
    public boolean equals(Object other) {
        return super.equals(other);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy