package com.hithomelabs.princeton1.module5;

import java.util.Comparator;

public interface MeasurableHelper extends ComparatorHelper{

    static <T> boolean less(T v, T w, Comparator<T> cmp, SortingMetaData metaData) {
        if (metaData != null)
            metaData.incrementCompares();
        return ComparatorHelper.less(v, w, cmp);
    }

    static <T> boolean equals(T v, T w, Comparator<T> cmp, SortingMetaData metaData) {
        if (metaData != null)
            metaData.incrementCompares();
        return ComparatorHelper.equals(v, w, cmp);
    }

    static <T> void exch(T[] arr, int j, int i, SortingMetaData metaData) {
        if (metaData != null)
            metaData.incrementExchanges();
        ComparableHelper.exch(arr, j, i);
    }

}
