[vlma-devel] commit: Move non trivial methods to vlma-code. (Adrien Grand )

git version control git at videolan.org
Sat Feb 14 07:17:14 CET 2009


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Feb 14 02:08:23 2009 +0100| [0571fca87174763b8c4a0e10800f97e297aec59d] | committer: Adrien Grand 

Move non trivial methods to vlma-code.

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

 .../main/java/org/videolan/vlma/model/Adapter.java |   14 --------------
 .../vlma/order/management/OrderManager.java        |    8 ++++++--
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java b/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java
index e26f4e2..559168c 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/Adapter.java
@@ -185,20 +185,6 @@ public abstract class Adapter implements Serializable {
     }
 
     /**
-     * Increments the adapter's score.
-     */
-    public void increaseScore() {
-        this.score += 10;
-    }
-
-    /**
-     * Decrements the adapter's score.
-     */
-    public void decreaseScore() {
-        --this.score;
-    }
-
-    /**
      * Capacity of the adapter: how many orders can reference this adapter.
      *
      * @return the capacity of the adapter
diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java b/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java
index 66cd752..96225ee 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/management/OrderManager.java
@@ -29,6 +29,7 @@ import java.util.Set;
 
 import org.apache.commons.collections.keyvalue.DefaultMapEntry;
 import org.apache.log4j.Logger;
+import org.videolan.vlma.model.Adapter;
 import org.videolan.vlma.model.Order;
 import org.videolan.vlma.model.Program;
 import org.videolan.vlma.model.Server;
@@ -86,12 +87,15 @@ public class OrderManager {
                 }
             }
             entry.getValue().setValue(broadcasted ? State.STARTED : State.TO_START);
+
             // Update the adapter's score
+            Adapter adapter = entry.getValue().getKey().getAdapter();
             if (broadcasted) {
-                entry.getValue().getKey().getAdapter().increaseScore();
+                adapter.setScore(adapter.getScore() + 5);
             } else {
-                entry.getValue().getKey().getAdapter().decreaseScore();
+                adapter.setScore(adapter.getScore() - 1);
             }
+
         }
         return result;
     }



More information about the vlma-devel mailing list