roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r376159 - /incubator/roller/trunk/src/org/roller/pojos/WeblogEntryWrapperComparator.java
Date Thu, 09 Feb 2006 02:57:36 GMT
Author: snoopdave
Date: Wed Feb  8 18:57:34 2006
New Revision: 376159

URL: http://svn.apache.org/viewcvs?rev=376159&view=rev
Log:
Fixes ROL-473 (page view for date should show all entries for date) and ROL-1041 (fix next/prev
links)

Added:
    incubator/roller/trunk/src/org/roller/pojos/WeblogEntryWrapperComparator.java

Added: incubator/roller/trunk/src/org/roller/pojos/WeblogEntryWrapperComparator.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/WeblogEntryWrapperComparator.java?rev=376159&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/WeblogEntryWrapperComparator.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/WeblogEntryWrapperComparator.java Wed Feb
 8 18:57:34 2006
@@ -0,0 +1 @@
+
package org.roller.pojos;

import java.io.Serializable;
import java.util.Comparator;
import
org.roller.pojos.wrapper.WeblogEntryDataWrapper;

/**
 * Sorts WeblogEntryData objects in
reverse chronological order
 * (most recently published entries first).  If they happen to
* have the same pubTime, then sort alphabetically by title.
 * 
 * @author lance.lavandowska
*/
public class WeblogEntryWrapperComparator implements Comparator, Serializable
{
    static
final long serialVersionUID = -9067148992322255150L;
    
    public int compare(Object val1,
Object val2)
    throws ClassCastException
    {
        WeblogEntryDataWrapper entry1 = (WeblogEntryDataWrapper)val1;
       WeblogEntryDataWrapper entry2 = (WeblogEntryDataWrapper)val2;
        long pubTime1
= entry1.getPubTime().getTime();
        long pubTime2 = entry2.getPubTime().getTime();

       if (pubTime1 > pubTime2)
        {
            return -1;
        }
        else
if (pubTime1 < pubTime2)
        {
        
     return 1;
        }

        // if pubTimes are the same, return
        // results of
String.compareTo() on Title
        return entry1.getTitle().compareTo(entry2.getTitle());
   }
}
\ No newline at end of file



Mime
View raw message