Lightweight Bartering Grid

lbg.peer.register.learning.consumption
Class SupplierReliabilityHistory

java.lang.Object
  extended by lbg.peer.register.learning.consumption.SupplierReliabilityHistory
All Implemented Interfaces:
java.lang.Comparable<SupplierReliabilityHistory>

public class SupplierReliabilityHistory
extends java.lang.Object
implements java.lang.Comparable<SupplierReliabilityHistory>

A SupplierReliabilityHistory describes the reliability of a Supplier Peer for a given Job.

Stores Task completion and cancellation counts for target Supplier and Job.

Author:
Cyril Briquet

Constructor Summary
SupplierReliabilityHistory()
          Constructs a new SupplierReliabilityHistory.
SupplierReliabilityHistory(SupplierReliabilityHistory b)
          Constructs a new SupplierReliabilityHistory, using target Supplier Reliability behavior to set initial Task completion/cancellation counts, i.e.
 
Method Summary
 void accountCancelledTask()
           
 void accountCompletedTask()
           
 int compareTo(SupplierReliabilityHistory other)
          Comparable implementation.
 boolean equals(java.lang.Object obj)
           
 int getCancelledTasksCount()
           
 int getCompletedTasksCount()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SupplierReliabilityHistory

public SupplierReliabilityHistory()
Constructs a new SupplierReliabilityHistory.


SupplierReliabilityHistory

public SupplierReliabilityHistory(SupplierReliabilityHistory b)
                           throws GridException
Constructs a new SupplierReliabilityHistory, using target Supplier Reliability behavior to set initial Task completion/cancellation counts, i.e. this is a copy constructor.

Throws:
GridException - if a parameter is illegal
Method Detail

toString

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

compareTo

public int compareTo(SupplierReliabilityHistory other)
Comparable implementation.

Compares 2 Supplier Reliability behaviors.

Smaller value is assigned to the more reliable Peer. Precisely, Peers with less cancelled Tasks is ranked first (i.e. lower). For couple of Peers with the same number of cancelled Tasks, the Peer with the most completed Tasks is ranked first (i.e. lower).

Specified by:
compareTo in interface java.lang.Comparable<SupplierReliabilityHistory>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getCompletedTasksCount

public int getCompletedTasksCount()

getCancelledTasksCount

public int getCancelledTasksCount()

accountCompletedTask

public void accountCompletedTask()

accountCancelledTask

public void accountCancelledTask()

Lightweight Bartering Grid

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