package leigh.elements.sdk.type1;

import leigh.eo.sort.EOComparator;

import java.util.Comparator;

/**
 * An adapter to allow {@link EOComparator} to be used against a {@link Element}.
 *
 * @author Alex Leigh
 */
public class ElementComparator implements Comparator<Element> {
    private final EOComparator cfgComparator;

    public ElementComparator(EOComparator cfgComparator) {
        this.cfgComparator = cfgComparator;
    }

    @Override
    public int compare(Element o1, Element o2) {
        return cfgComparator.compare(o1.getCfg(), o2.getCfg());
    }
}
