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

git version control git at videolan.org
Mon Oct 13 23:13:54 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Mon Oct 13 23:13:29 2008 +0200| [d38e0530901a5a630a332b9a021ba05462f0e4e2] | committer: Adrien Grand 

Cosmetics.

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

 .../java/org/videolan/vlma/model/DTTChannel.java   |    2 +-
 .../main/java/org/videolan/vlma/OrderGiver.java    |    7 +++----
 .../java/org/videolan/vlma/dao/VLMaDaoImpl.java    |   14 ++++++--------
 .../web/media/dtt/DTTChannelListController.java    |    2 +-
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/DTTChannel.java b/vlma-api/src/main/java/org/videolan/vlma/model/DTTChannel.java
index 253cce1..a18abdd 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/DTTChannel.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/DTTChannel.java
@@ -91,7 +91,7 @@ public class DTTChannel extends Media {
 
     @Override
     public boolean sameGroup(Media media) {
-        if (media.getClass() == DTTChannel.class) {
+        if (media instanceof DTTChannel) {
             DTTChannel c = (DTTChannel) media;
             return (c.getFrequency() == this.frequency);
         }
diff --git a/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java b/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java
index 29734e7..c3358be 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java
@@ -279,16 +279,14 @@ public class OrderGiver {
                                 g2.add(media);
                             }
                         }
-                        if(g2.size() == 0) {
-                            // No change
-                        } else if(g1.size() == 0) {
+                        if(g1.size() == 0) {
                             // All orders are on the new adapter
                             load.put(adapter.getServer(),
                                     load.get(adapter.getServer()) + orderLoad);
                             load.put(order.getAdapter().getServer(),
                                     load.get(order.getAdapter().getServer()) - orderLoad);
                             order.setAdapter(adapter);
-                        } else {
+                        } else if(g2.size() != 0) {
                             load.put(order.getAdapter().getServer(),
                                     load.get(order.getAdapter().getServer()) - orderLoad + g1.getLoad());
                             order.setMedias(g1);
@@ -297,6 +295,7 @@ public class OrderGiver {
                             Order order2 = new Order(adapter, g2);
                             orders.add(order2);
                         }
+                        // If g2.size() == 0, nothing to do
                         break;
                     }
                 }
diff --git a/vlma-core/src/main/java/org/videolan/vlma/dao/VLMaDaoImpl.java b/vlma-core/src/main/java/org/videolan/vlma/dao/VLMaDaoImpl.java
index f56529c..e381c21 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/dao/VLMaDaoImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/dao/VLMaDaoImpl.java
@@ -232,10 +232,9 @@ public class VLMaDaoImpl implements VLMaDao {
                         Iterator<Adapter> adapterIt = server.getAdapters().iterator();
                         while(adapterIt.hasNext()) {
                             Adapter adapter = adapterIt.next();
-                            if (adapter instanceof DVBSAdapter) {
-                                if(((DVBSAdapter)adapter).getSatellite().getId() == id) {
-                                    adapterIt.remove();
-                                }
+                            if (adapter instanceof DVBSAdapter
+                                    && ((DVBSAdapter)adapter).getSatellite().getId() == id) {
+                                adapterIt.remove();
                             }
                         }
                     }
@@ -254,10 +253,9 @@ public class VLMaDaoImpl implements VLMaDao {
                 servers.remove(id);
                 synchronized (medias) {
                     for(Media media : medias.values()) {
-                        if(media instanceof FilesChannel) {
-                            if(((FilesChannel)media).getServer().getId() == id) {
-                                medias.remove(media.getId());
-                            }
+                        if(media instanceof FilesChannel
+                                && ((FilesChannel)media).getServer().getId() == id) {
+                            medias.remove(media.getId());
                         }
                     }
                 }
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 6ae1d65..7d6c8aa 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
@@ -60,7 +60,7 @@ public class DTTChannelListController implements Controller {
 
         ModelAndView mav = new ModelAndView();
         mav.addObject("dttChannels", dttChannels);
-        mav.addObject("shortList", filter == "all");
+        mav.addObject("shortList", "all".equals(filter));
         return mav;
     }
 



More information about the vlma-devel mailing list