[vlma-devel] commit: Sort channels by frequency. (Adrien Grand )

git version control git at videolan.org
Sat Sep 20 12:55:47 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Sep 20 12:58:45 2008 +0200| [4e40902c4fd04a51aecb43ac3107b8e6f5cc87e0] | committer: Adrien Grand 

Sort channels by frequency.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=4e40902c4fd04a51aecb43ac3107b8e6f5cc87e0
---

 .../web/media/dtt/DTTChannelListController.java    |   11 +++++++++++
 .../media/satellite/SatChannelListController.java  |   11 +++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/dtt/DTTChannelListController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/dtt/DTTChannelListController.java
index 2e06bf3..6ae1d65 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/dtt/DTTChannelListController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/dtt/DTTChannelListController.java
@@ -21,6 +21,8 @@
 package org.videolan.vlma.web.media.dtt;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
@@ -47,6 +49,15 @@ public class DTTChannelListController implements Controller {
             }
         }
 
+        Comparator<DTTChannel> comparator = new Comparator<DTTChannel>() {
+
+            public int compare(DTTChannel o1, DTTChannel o2) {
+                return o1.getFrequency() - o2.getFrequency();
+            }
+
+        };
+        Collections.sort(dttChannels, comparator);
+
         ModelAndView mav = new ModelAndView();
         mav.addObject("dttChannels", dttChannels);
         mav.addObject("shortList", filter == "all");
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/satellite/SatChannelListController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/satellite/SatChannelListController.java
index b3fd851..d98c75a 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/satellite/SatChannelListController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/satellite/SatChannelListController.java
@@ -21,6 +21,8 @@
 package org.videolan.vlma.web.media.satellite;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
@@ -51,6 +53,15 @@ public class SatChannelListController implements Controller {
             }
         }
 
+        Comparator<SatChannel> comparator = new Comparator<SatChannel>() {
+
+            public int compare(SatChannel o1, SatChannel o2) {
+                return o1.getFrequency() - o2.getFrequency();
+            }
+
+        };
+        Collections.sort(satChannels, comparator);
+
         ModelAndView mav = new ModelAndView();
         mav.addObject("satChannels", satChannels);
         mav.addObject("shortList", filter == "all");



More information about the vlma-devel mailing list