Search in sources :

Example 1 with CompoundComparator

use of delta.common.utils.collections.CompoundComparator in project lotro-tools by dmorcellet.

the class DeedsContainer method writeSortedDeeds.

/**
 * Write a XML file with a sorted list of deeds.
 * @param deeds Deeds to sort and write.
 * @param out Output file.
 */
public static void writeSortedDeeds(List<DeedDescription> deeds, File out) {
    List<Comparator<DeedDescription>> comparators = new ArrayList<Comparator<DeedDescription>>();
    comparators.add(new DeedNameComparator());
    comparators.add(new DeedDescriptionComparator());
    CompoundComparator<DeedDescription> comparator = new CompoundComparator<DeedDescription>(comparators);
    Collections.sort(deeds, comparator);
    DeedXMLWriter writer = new DeedXMLWriter();
    writer.writeDeeds(out, deeds, EncodingNames.UTF_8);
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) DeedNameComparator(delta.games.lotro.lore.deeds.comparators.DeedNameComparator) ArrayList(java.util.ArrayList) DeedDescriptionComparator(delta.games.lotro.lore.deeds.comparators.DeedDescriptionComparator) DeedXMLWriter(delta.games.lotro.lore.deeds.io.xml.DeedXMLWriter) CompoundComparator(delta.common.utils.collections.CompoundComparator) DeedDescriptionComparator(delta.games.lotro.lore.deeds.comparators.DeedDescriptionComparator) DeedNameComparator(delta.games.lotro.lore.deeds.comparators.DeedNameComparator) CompoundComparator(delta.common.utils.collections.CompoundComparator) Comparator(java.util.Comparator)

Aggregations

CompoundComparator (delta.common.utils.collections.CompoundComparator)1 DeedDescription (delta.games.lotro.lore.deeds.DeedDescription)1 DeedDescriptionComparator (delta.games.lotro.lore.deeds.comparators.DeedDescriptionComparator)1 DeedNameComparator (delta.games.lotro.lore.deeds.comparators.DeedNameComparator)1 DeedXMLWriter (delta.games.lotro.lore.deeds.io.xml.DeedXMLWriter)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1