[vlma-devel] commit: Cleanup. (Adrien Grand )

git version control git at videolan.org
Sun Dec 14 21:05:19 CET 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sun Dec 14 21:04:21 2008 +0100| [81540ff21d93ec4c05580b64ccdf53b1bbad248a] | committer: Adrien Grand 

Cleanup.

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

 .../vlma/web/configuration/ConfigurationEdit.java  |    2 +-
 .../web/media/dtt/DTTChannelListController.java    |   27 ++++++--------
 .../media/satellite/SatChannelListController.java  |   29 +++++++---------
 .../vlma/web/welcome/WelcomeController.java        |   36 ++++++++++----------
 4 files changed, 44 insertions(+), 50 deletions(-)

diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/configuration/ConfigurationEdit.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/configuration/ConfigurationEdit.java
index 0218eaa..cea4a11 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/configuration/ConfigurationEdit.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/configuration/ConfigurationEdit.java
@@ -22,7 +22,7 @@ package org.videolan.vlma.web.configuration;
 
 public class ConfigurationEdit {
 
-    public static final String[] monitors = { "NONE", "SNMP", "HTTP" };
+    static final String[] monitors = { "NONE", "SNMP", "HTTP" };
 
     private Integer vlc_telnet_port;
     private String vlc_telnet_password;
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 6bfddbd..c0643ed 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
@@ -36,6 +36,17 @@ import org.videolan.vlma.model.DTTChannel;
 
 public class DTTChannelListController implements Controller {
 
+    private static final Comparator<DTTChannel> CHANNEL_COMPARATOR = new Comparator<DTTChannel>() {
+
+        public int compare(DTTChannel o1, DTTChannel o2) {
+            int result = o1.getFrequency() - o2.getFrequency();
+            if(result == 0)
+                result = o1.getSid() - o2.getSid();
+            return result;
+        }
+
+    };
+
     public ModelAndView handleRequest(HttpServletRequest arg0,
             HttpServletResponse arg1) throws Exception {
         String filter = arg0.getParameter("filter");
@@ -49,17 +60,7 @@ public class DTTChannelListController implements Controller {
             }
         }
 
-        Comparator<DTTChannel> comparator = new Comparator<DTTChannel>() {
-
-            public int compare(DTTChannel o1, DTTChannel o2) {
-                int result = o1.getFrequency() - o2.getFrequency();
-                if(result == 0)
-                    result = o1.getSid() - o2.getSid();
-                return result;
-            }
-
-        };
-        Collections.sort(dttChannels, comparator);
+        Collections.sort(dttChannels, CHANNEL_COMPARATOR);
 
         ModelAndView mav = new ModelAndView();
         mav.addObject("dttChannels", dttChannels);
@@ -69,10 +70,6 @@ public class DTTChannelListController implements Controller {
 
     private Data data;
 
-    public Data getData() {
-        return data;
-    }
-
     public void setData(Data data) {
         this.data = data;
     }
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 e1eed15..28e433b 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
@@ -37,6 +37,18 @@ import org.videolan.vlma.model.SatChannel;
 
 public class SatChannelListController implements Controller {
 
+    private static Comparator<SatChannel> CHANNEL_COMPARATOR = new Comparator<SatChannel>() {
+
+        public int compare(SatChannel o1, SatChannel o2) {
+            int result = o1.getFrequency() - o2.getFrequency();
+            if(result == 0) {
+                result = o1.getSid() - o2.getSid();
+            }
+            return result;
+        }
+
+    };
+
     public ModelAndView handleRequest(HttpServletRequest arg0,
             HttpServletResponse arg1) throws Exception {
         String filter = arg0.getParameter("filter");
@@ -53,18 +65,7 @@ public class SatChannelListController implements Controller {
             }
         }
 
-        Comparator<SatChannel> comparator = new Comparator<SatChannel>() {
-
-            public int compare(SatChannel o1, SatChannel o2) {
-                int result = o1.getFrequency() - o2.getFrequency();
-                if(result == 0) {
-                    result = o1.getSid() - o2.getSid();
-                }
-                return result;
-            }
-
-        };
-        Collections.sort(satChannels, comparator);
+        Collections.sort(satChannels, CHANNEL_COMPARATOR);
 
         ModelAndView mav = new ModelAndView();
         mav.addObject("satChannels", satChannels);
@@ -74,10 +75,6 @@ public class SatChannelListController implements Controller {
 
     private Data data;
 
-    public Data getData() {
-        return data;
-    }
-
     public void setData(Data data) {
         this.data = data;
     }
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/welcome/WelcomeController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/welcome/WelcomeController.java
index 7f5ff68..f3aed43 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/welcome/WelcomeController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/welcome/WelcomeController.java
@@ -39,6 +39,20 @@ import org.videolan.vlma.model.DTTChannel;
 
 public class WelcomeController implements Controller {
 
+    private static final Comparator<Media> MEDIA_COMPARATOR = new Comparator<Media>() {
+
+        // Sort medias according to their priority
+        public int compare(Media media0, Media media1) {
+            int result = media1.getProgram().getPriority() - media0.getProgram().getPriority();
+            if(result == 0) {
+                return media0.getName().compareTo(media1.getName());
+            } else {
+                return result;
+            }
+        }
+
+    };
+
     public ModelAndView handleRequest(HttpServletRequest arg0,
             HttpServletResponse arg1) throws Exception {
 
@@ -65,24 +79,10 @@ public class WelcomeController implements Controller {
             }
         }
 
-        Comparator<Media> comparator = new Comparator<Media>() {
-
-            // Sort medias according to their priority
-            public int compare(Media media0, Media media1) {
-                int result = media1.getProgram().getPriority() - media0.getProgram().getPriority();
-                if(result == 0) {
-                    return media0.getName().compareTo(media1.getName());
-                } else {
-                    return result;
-                }
-            }
-
-        };
-
-        Collections.sort(satChannels, comparator);
-        Collections.sort(dttChannels, comparator);
-        Collections.sort(fileChannels, comparator);
-        Collections.sort(streamChannels, comparator);
+        Collections.sort(satChannels, MEDIA_COMPARATOR);
+        Collections.sort(dttChannels, MEDIA_COMPARATOR);
+        Collections.sort(fileChannels, MEDIA_COMPARATOR);
+        Collections.sort(streamChannels, MEDIA_COMPARATOR);
 
         ModelAndView mav = new ModelAndView();
         mav.addObject("satChannels", satChannels);



More information about the vlma-devel mailing list