Java Reference
In-Depth Information
} else {
boolean result;
if (values[i].hasNext())
result # true ;
else {
result # false ;
values[i] #
value # (Value)values[i].next();
return result;
The test driver is similar to the previous driver. There are two main
The preferences of the service provider are generated by the Resource
Allocator .
The driver is responsible for booking the resource upon successful
negotiation and for recomputing the provider's preferences.
import Negotiation.*;
import booking.*;
import java.util.*;
public class TestLocal {
public static void main(String[] args){
Specification spec # createSpec();
ResourceAllocation resources # resources(spec);
// define the preference map of the server
PreferenceMap providerPref # resources.preference();
// creates the server negotiator
Negotiator provider # new BasicNegotiator(providerPref);
// define the preference map of the client
PreferenceMap clientPref # createClientPref(spec);
for ( int i # 0; i<300; !! i){
// creates the client negotiator
Negotiator client # new BasicNegotiator(clientPref);
// carry out the negotiation
Mediator mediator # new Mediator(10);
try {
Search WWH ::

Custom Search