/**
 * 
 */
package org.forkalsrud.album.exif;

import java.util.Comparator;
import java.util.List;

/**
 * @author knut
 */
public class ComposingComparator<T> implements Comparator<T> {

	List<Comparator<T>> cmp;

	public ComposingComparator(List<Comparator<T>> args) {

		cmp = args;
	}

	@Override
    public int compare(T o1, T o2) {

		for (Comparator<T> c : cmp) {
			int result = c.compare(o1, o2);
			if (result != 0) {
				return result;
			}
		}
		return 0; 
	}

}
