/*
 * Copyright (c) 2011, Patrik Dufresne. All rights reserved.
 * Patrik Dufresne PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.planimod.core.comparators;

import java.util.Comparator;

import org.apache.commons.collections.ComparatorUtils;
import org.apache.commons.collections.Transformer;

import com.planimod.core.Team;

/**
 * Provide comparator for team.
 * 
 * @author Patrik Dufresne
 * 
 */
public class TeamComparators {

	/**
	 * Comparator to sort section by name.
	 * 
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public static Comparator<Team> byName() {
		return ComparatorUtils.nullLowComparator(ComparatorUtils
				.transformedComparator(new HumanNaturalComparator(),
						new Transformer() {
							@Override
							public Object transform(Object arg0) {
								return ((Team) arg0).getName();
							}
						}));
	}

}
