org.ourgrid.peer.community.nof
Class Arbitrator

java.lang.Object
  extended by org.ourgrid.peer.community.nof.Arbitrator

public class Arbitrator
extends java.lang.Object

Chooses always the request with the greatest balance among the ones passed. This Accountant strategy takes no other characteristics of the consumers into account when choosing which request to fullfill.


Constructor Summary
Arbitrator()
           
 
Method Summary
static RequestEntry chooseRemoteRequestToLoseGum(java.util.Collection<RequestEntry> requests)
          Choose a request made by a community consumer that should have a gum preempted
static RequestEntry chooseRemoteRequestToReceiveGum(java.util.Collection<RequestEntry> requests)
          Choose a request made by a community consumer that deserves to receive a gum
static RequestEntry chooseRequestToLoseGum(java.util.Collection<RequestEntry> requests)
          Choose the request with most allocated gums
static RequestEntry chooseRequestToReceiveGum(java.util.Collection<RequestEntry> requests)
          Choose the request with less allocated gums
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Arbitrator

public Arbitrator()
Method Detail

chooseRequestToReceiveGum

public static RequestEntry chooseRequestToReceiveGum(java.util.Collection<RequestEntry> requests)
Choose the request with less allocated gums

Parameters:
requests - A collection of requests to be considered in the decision
Returns:
The request with the lowest number of allocated gums

chooseRequestToLoseGum

public static RequestEntry chooseRequestToLoseGum(java.util.Collection<RequestEntry> requests)
Choose the request with most allocated gums

Parameters:
requests - A collection of requests to be considered in the decision
Returns:
The request with the largest number of allocated gums

chooseRemoteRequestToReceiveGum

public static RequestEntry chooseRemoteRequestToReceiveGum(java.util.Collection<RequestEntry> requests)
Choose a request made by a community consumer that deserves to receive a gum

Parameters:
requests - A collection of requests to be considered in the decision
Returns:
The request with the lowest number of gums, which belongs to the consumer with the highest NoF balance

chooseRemoteRequestToLoseGum

public static RequestEntry chooseRemoteRequestToLoseGum(java.util.Collection<RequestEntry> requests)
Choose a request made by a community consumer that should have a gum preempted

Parameters:
requests - A collection of requests to be considered in the decision
Returns:
The request with the largest number of gums, which belongs to the consumer with the lowest NoF balance