001    /*
002     * Cobertura - http://cobertura.sourceforge.net/
003     *
004     * Copyright (C) 2005 Mark Doliner
005     *
006     * Cobertura is free software; you can redistribute it and/or modify
007     * it under the terms of the GNU General Public License as published
008     * by the Free Software Foundation; either version 2 of the License,
009     * or (at your option) any later version.
010     *
011     * Cobertura is distributed in the hope that it will be useful, but
012     * WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014     * General Public License for more details.
015     *
016     * You should have received a copy of the GNU General Public License
017     * along with Cobertura; if not, write to the Free Software
018     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019     * USA
020     */
021    
022    package net.sourceforge.cobertura.reporting.html;
023    
024    import java.io.Serializable;
025    import java.util.Comparator;
026    
027    import net.sourceforge.cobertura.coveragedata.SourceFileData;
028    
029    public class SourceFileDataBaseNameComparator implements Comparator, Serializable
030    {
031    
032            private static final long serialVersionUID = 0L;
033    
034            public int compare(Object arg0, Object arg1)
035            {
036                    SourceFileData sourceFileData0 = (SourceFileData)arg0;
037                    SourceFileData sourceFileData1 = (SourceFileData)arg1;
038                    int comparison = sourceFileData0.getBaseName().compareTo(sourceFileData1.getBaseName());
039                    if (comparison != 0)
040                            return comparison;
041                    return sourceFileData0.getName().compareTo(sourceFileData1.getName());
042            }
043    
044    }