Lightweight Bartering Grid

lbg.peer.register
Class NeighborhoodNegotiationProfile

java.lang.Object
  extended by lbg.peer.register.NeighborhoodNegotiationProfile

public class NeighborhoodNegotiationProfile
extends java.lang.Object

Author:
Cyril Briquet

Constructor Summary
NeighborhoodNegotiationProfile(Peer managed_peer, PeerRegister grid_register, PeerStrategyConfiguration peer_strategy_config)
           
 
Method Summary
 void accountSentConsumptionGrants(java.lang.String peer_id, int tasks_count)
           
 void accountSentSupplyingRequests(java.lang.String peer_id, int tasks_count)
           
 void accountUsedConsumptionGrant(java.lang.String peer_id)
           
 void addReceivedConsumptionGrant(java.lang.String peer_id, int tasks_count)
           
 void addReceivedSupplyingRequest(java.lang.String peer_id, int tasks_count)
           
 boolean couldEvaluateConsumptionGrants()
          Returns whether Consumption Grants can be evaluated, which is allowed when either the number of registered Consumption Grantors has reached the specified threshold, or when the time since a Consumption Grantor has been resgistered has reached the specified threshold, or both.
 boolean couldEvaluateSupplyingRequests()
          Returns whether Supplying Requests can be evaluated, which is allowed when either the number of registered Supplying Requestors has reached the specified threshold, or when the time since a Supplying Requestor has been resgistered has reached the specified threshold, or both.
 boolean couldGenerateSupplyingRequests()
          Returns whether Supplying can be Requested, which is allowed when the time since some Supplying has been Requested to other Peers has reached the specified threshold.
 int countReceivedConsumptionGrants()
           
 int countReceivedSupplyingRequests()
           
 ConsumptionGrantsContainer getReceivedConsumptionGrants()
          Returns received Consumption grants.
 SupplyingRequestsContainer getReceivedSupplyingRequests()
          Returns received Supplying Requests.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NeighborhoodNegotiationProfile

public NeighborhoodNegotiationProfile(Peer managed_peer,
                                      PeerRegister grid_register,
                                      PeerStrategyConfiguration peer_strategy_config)
                               throws GridException
Throws:
GridException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addReceivedSupplyingRequest

public void addReceivedSupplyingRequest(java.lang.String peer_id,
                                        int tasks_count)
                                 throws GridException
Throws:
GridException

countReceivedSupplyingRequests

public int countReceivedSupplyingRequests()
                                   throws GridException
Throws:
GridException

couldEvaluateSupplyingRequests

public boolean couldEvaluateSupplyingRequests()
                                       throws GridException
Returns whether Supplying Requests can be evaluated, which is allowed when either the number of registered Supplying Requestors has reached the specified threshold, or when the time since a Supplying Requestor has been resgistered has reached the specified threshold, or both.

Returns:
true if Supplying Requests can be evaluated
Throws:
GridException

getReceivedSupplyingRequests

public SupplyingRequestsContainer getReceivedSupplyingRequests()
                                                        throws GridException
Returns received Supplying Requests.

Returns:
SupplyingRequestsContainer containing received Supplying Requests, or null if none has been received since they were last processed
Throws:
GridException

accountSentConsumptionGrants

public void accountSentConsumptionGrants(java.lang.String peer_id,
                                         int tasks_count)
                                  throws GridException
Throws:
GridException

couldGenerateSupplyingRequests

public boolean couldGenerateSupplyingRequests()
                                       throws GridException
Returns whether Supplying can be Requested, which is allowed when the time since some Supplying has been Requested to other Peers has reached the specified threshold.

Returns:
true if Supplying can be Requestd
Throws:
GridException

accountSentSupplyingRequests

public void accountSentSupplyingRequests(java.lang.String peer_id,
                                         int tasks_count)
                                  throws GridException
Throws:
GridException

addReceivedConsumptionGrant

public void addReceivedConsumptionGrant(java.lang.String peer_id,
                                        int tasks_count)
                                 throws GridException
Throws:
GridException

countReceivedConsumptionGrants

public int countReceivedConsumptionGrants()
                                   throws GridException
Throws:
GridException

couldEvaluateConsumptionGrants

public boolean couldEvaluateConsumptionGrants()
                                       throws GridException
Returns whether Consumption Grants can be evaluated, which is allowed when either the number of registered Consumption Grantors has reached the specified threshold, or when the time since a Consumption Grantor has been resgistered has reached the specified threshold, or both.

Returns:
true if Consumption Grants can be evaluated
Throws:
GridException

getReceivedConsumptionGrants

public ConsumptionGrantsContainer getReceivedConsumptionGrants()
                                                        throws GridException
Returns received Consumption grants.

Returns:
ConsumptionGrantsContainer containing received Consumption Grants, or null if none has been received since they were last processed
Throws:
GridException

accountUsedConsumptionGrant

public void accountUsedConsumptionGrant(java.lang.String peer_id)
                                 throws GridException
Throws:
GridException

Lightweight Bartering Grid

Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.