Lightweight Bartering Grid

lbg.peer.register.bartering
Class PeerBarteringProfile

java.lang.Object
  extended by lbg.peer.register.bartering.PeerBarteringProfile
Direct Known Subclasses:
TestPeerBarteringProfile

public class PeerBarteringProfile
extends java.lang.Object

Author:
Cyril Briquet

Field Summary
static int MAX_STORED_INTERACTIONS
           
 
Constructor Summary
PeerBarteringProfile(Peer managed_peer, ExternalPeerHandle profiled_peer, BarteringAccountantPolicy accountant)
           
 
Method Summary
 void accountConsumptionCancellation(Task t, long xstart_time)
           
 double accountConsumptionCompletion(Task t, long xstart_time, long consumed_external_power)
           
 void accountSupplyingCancellation(Task t, long xstart_time)
           
 double accountSupplyingCompletion(Task t, long xstart_time, long supplied_local_power)
           
 double estimateSupplyingTaskRuntime()
           
 BarteringAccountantPolicy getAccountant()
           
 double getConsumptionMC4()
           
 double getConsumptionMTBC()
          Consumption Tasks Mean Time Between Cancellations.
 double getConsumptionMTTC()
          Consumption Tasks Mean Cancellation Notification Time (MTTC, pronounced m cant).
 double getConsumptionTasksCancellationRatio()
           
 double getConsumptionTasksCompletionRatio()
           
 double getFavorsBalance()
          Favors balance of managed Peer with target Peer (guaranteed to be nonnegative).
 double getMeanConsumptionCompletionStride()
           
 double getMeanConsumptionTaskRuntime()
           
 double getMeanSupplyingCompletionStride()
           
 double getMeanSupplyingTaskRuntime()
           
 long getMostRecentConsumptionTaskCancellationTime()
           
 long getMostRecentSupplyingTaskCancellationTime()
           
 long getRecentlyCancelledConsumptionTasksCount()
          Current Consumption cancellation stride length.
 long getRecentlyCancelledSupplyingTasksCount()
          Current Supplying cancellation stride length.
 long getRecentlyCompletedConsumptionTasksCount()
          Current Consumption completion stride length.
 long getRecentlyCompletedSupplyingTasksCount()
          Current Supplying completion stride length.
 double getSupplyingMTBC()
          Supplying Tasks Mean Time Between Cancellations.
 double getSupplyingMTTC()
          Supplying Tasks Mean Cancellation Notification Time.
 double getSupplyingTasksCancellationRatio()
           
 double getSupplyingTasksCompletionRatio()
           
 long getTotalCancelledConsumptionTasks()
           
 long getTotalCancelledSupplyingTasks()
           
 long getTotalCompletedConsumptionTasks()
           
 long getTotalCompletedSupplyingTasks()
           
 double getTotalConsumedFavors()
           
 double getTotalSuppliedFavors()
           
 void setAccountant(BarteringAccountantPolicy accountant)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_STORED_INTERACTIONS

public static final int MAX_STORED_INTERACTIONS
See Also:
Constant Field Values
Constructor Detail

PeerBarteringProfile

public PeerBarteringProfile(Peer managed_peer,
                            ExternalPeerHandle profiled_peer,
                            BarteringAccountantPolicy accountant)
                     throws GridException
Throws:
GridException
Method Detail

toString

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

getAccountant

public BarteringAccountantPolicy getAccountant()
                                        throws GridException
Throws:
GridException

setAccountant

public void setAccountant(BarteringAccountantPolicy accountant)
                   throws GridException
Throws:
GridException

accountSupplyingCompletion

public double accountSupplyingCompletion(Task t,
                                         long xstart_time,
                                         long supplied_local_power)
                                  throws GridException
Throws:
GridException

accountConsumptionCompletion

public double accountConsumptionCompletion(Task t,
                                           long xstart_time,
                                           long consumed_external_power)
                                    throws GridException
Throws:
GridException

accountSupplyingCancellation

public void accountSupplyingCancellation(Task t,
                                         long xstart_time)
                                  throws GridException
Throws:
GridException

accountConsumptionCancellation

public void accountConsumptionCancellation(Task t,
                                           long xstart_time)
                                    throws GridException
Throws:
GridException

getTotalSuppliedFavors

public double getTotalSuppliedFavors()

getTotalConsumedFavors

public double getTotalConsumedFavors()

getFavorsBalance

public double getFavorsBalance()
Favors balance of managed Peer with target Peer (guaranteed to be nonnegative).


getTotalCompletedConsumptionTasks

public long getTotalCompletedConsumptionTasks()

getTotalCompletedSupplyingTasks

public long getTotalCompletedSupplyingTasks()

getTotalCancelledConsumptionTasks

public long getTotalCancelledConsumptionTasks()

getTotalCancelledSupplyingTasks

public long getTotalCancelledSupplyingTasks()

getRecentlyCompletedConsumptionTasksCount

public long getRecentlyCompletedConsumptionTasksCount()
Current Consumption completion stride length. Number of completed Consumption Tasks since the most recent cancellation of such a Task (or since the instanciation of PeerRegister if no such Task was cancelled).


getRecentlyCompletedSupplyingTasksCount

public long getRecentlyCompletedSupplyingTasksCount()
Current Supplying completion stride length. Number of completed Supplying Tasks since the most recent cancellation of such a Task (or since the instanciation of PeerRegister if no such Task was cancelled).


getRecentlyCancelledConsumptionTasksCount

public long getRecentlyCancelledConsumptionTasksCount()
Current Consumption cancellation stride length. Number of cancelled Consumption Tasks since the most recent completion of such a Task (or since the instanciation of PeerRegister if no such Task hasn't already been completed).


getRecentlyCancelledSupplyingTasksCount

public long getRecentlyCancelledSupplyingTasksCount()
Current Supplying cancellation stride length. Number of cancelled Supplying Tasks since the most recent completion of such a Task (or since the instanciation of PeerRegister if no such Task hasn't already been completed).


getMostRecentConsumptionTaskCancellationTime

public long getMostRecentConsumptionTaskCancellationTime()

getMostRecentSupplyingTaskCancellationTime

public long getMostRecentSupplyingTaskCancellationTime()

getMeanConsumptionCompletionStride

public double getMeanConsumptionCompletionStride()

getMeanSupplyingCompletionStride

public double getMeanSupplyingCompletionStride()

getConsumptionTasksCompletionRatio

public double getConsumptionTasksCompletionRatio()

getConsumptionTasksCancellationRatio

public double getConsumptionTasksCancellationRatio()

getSupplyingTasksCompletionRatio

public double getSupplyingTasksCompletionRatio()

getSupplyingTasksCancellationRatio

public double getSupplyingTasksCancellationRatio()

getConsumptionMTTC

public double getConsumptionMTTC()
Consumption Tasks Mean Cancellation Notification Time (MTTC, pronounced m cant).

Returns:
Consumption Tasks MTTC, or Double.MAX_VALUE if no Task has been cancelled yet

getSupplyingMTTC

public double getSupplyingMTTC()
Supplying Tasks Mean Cancellation Notification Time.

Returns:
Supplying Tasks MTTC, or Double.MAX_VALUE if no Task has been cancelled yet

getConsumptionMTBC

public double getConsumptionMTBC()
Consumption Tasks Mean Time Between Cancellations.

Returns:
Consumption Task MTBC, or Double.MAX_VALUE if less than two Tasks have been cancelled yet

getSupplyingMTBC

public double getSupplyingMTBC()
Supplying Tasks Mean Time Between Cancellations.

Returns:
Supplying Task MTBC, or Double.MAX_VALUE if less than two Tasks have been cancelled yet

getMeanConsumptionTaskRuntime

public double getMeanConsumptionTaskRuntime()

getMeanSupplyingTaskRuntime

public double getMeanSupplyingTaskRuntime()

estimateSupplyingTaskRuntime

public double estimateSupplyingTaskRuntime()
Returns:
an estimate of the runtime of a Supplying Task of the profiled Peer (>= 0.0), or -1.0 if no estimate is available

getConsumptionMC4

public double getConsumptionMC4()

Lightweight Bartering Grid

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