package leigh.elements;

import leigh.elements.sdk.type1.Element;
import leigh.elements.sdk.type1.ElementComparator;
import leigh.eo.sort.EONumericComparator;
import leigh.mecha.sort.SortCardinality;

import java.util.ArrayList;
import java.util.Locale;

public class ElementsSort {
    public static final String KEY_UI_INDEX = "uiIndex";

    public static ArrayList<Element> sort(ArrayList<Element> src, String key, Locale locale) {
        ArrayList<Element> children = new ArrayList(src);
        children.sort(new ElementComparator(
                new EONumericComparator(KEY_UI_INDEX, SortCardinality.ASCENDING, locale)));
        return children;
    }
}
