org.ocopomo.endorsement
Class EndorsementScheme

java.lang.Object
  extended by org.ocopomo.endorsement.EndorsementScheme

public class EndorsementScheme
extends java.lang.Object

This class implements capabilities useful for the management of the endorsements schemes, allowing the mapping of the endorsements to numerical values

Author:
Francesco Poggi, Scott Moss

Constructor Summary
EndorsementScheme(java.lang.String name, double base)
           
 
Method Summary
 void addEndorsement(java.lang.String token, int value)
          Add an endorsement to the endorsement scheme.
 double endorsementPowerValue(java.util.ArrayList<java.lang.String> endorsements)
          Returns a double that represents the evaluation of the ArrayList of endorsements in input in relation to the current endorsement scheme (calculated taken into consideration the scheme base).
 double endorsementPowerValue(java.lang.String[] endorsements)
          Returns a double that represents the evaluation of the array of endorsements in input in relation to the current endorsement scheme (calculated taken into consideration the scheme base).
 double endorsementValue(java.util.ArrayList<java.lang.String> endorsements)
          Returns a double that represents the evaluation of the ArrayList of endorsements in input in relation to the current endorsement scheme.
 double endorsementValue(java.lang.String[] endorsements)
          Returns a double that represents the evaluation of the array of endorsements in input in relation to the current endorsement scheme.
 boolean existEndorsement(java.lang.String token)
          Check whether the endorsement token is defined inside this endorsement scheme
 java.lang.String getName()
          Returns the name of the current endorsement scheme
 java.lang.String getRandomToken()
          Returns a token inside this endorsement scheme chosen randomly
 int numTokens()
           
 void setName(java.lang.String val)
          Sets the name of the current endorsement scheme
 java.lang.String toString()
          Provides a String representation of the current endorsement scheme
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EndorsementScheme

public EndorsementScheme(java.lang.String name,
                         double base)
Method Detail

addEndorsement

public void addEndorsement(java.lang.String token,
                           int value)
Add an endorsement to the endorsement scheme.

Parameters:
token - The name of the endorsement to be added
value - The numerical value of the new endorsement

numTokens

public int numTokens()

getRandomToken

public java.lang.String getRandomToken()
Returns a token inside this endorsement scheme chosen randomly

Returns:
A String with a random token inside this endorsement scheme.

existEndorsement

public boolean existEndorsement(java.lang.String token)
Check whether the endorsement token is defined inside this endorsement scheme

Parameters:
token - The endorsement token to check
Returns:
true if token is defined inside this endorsement scheme, false otherwise

endorsementValue

public double endorsementValue(java.util.ArrayList<java.lang.String> endorsements)
Returns a double that represents the evaluation of the ArrayList of endorsements in input in relation to the current endorsement scheme.

Parameters:
endorsements - An ArrayList containing the name of the endorsements
Returns:
the evaluation of the endorsements in input

endorsementValue

public double endorsementValue(java.lang.String[] endorsements)
Returns a double that represents the evaluation of the array of endorsements in input in relation to the current endorsement scheme.

Parameters:
endorsements - An array containing the name of the endorsements
Returns:
the evaluation of the endorsements in input

endorsementPowerValue

public double endorsementPowerValue(java.util.ArrayList<java.lang.String> endorsements)
Returns a double that represents the evaluation of the ArrayList of endorsements in input in relation to the current endorsement scheme (calculated taken into consideration the scheme base).

Parameters:
endorsements - An ArrayList containing the name of the endorsements
Returns:
the evaluation of the endorsements in input

endorsementPowerValue

public double endorsementPowerValue(java.lang.String[] endorsements)
Returns a double that represents the evaluation of the array of endorsements in input in relation to the current endorsement scheme (calculated taken into consideration the scheme base).

Parameters:
endorsements - An array containing the name of the endorsements
Returns:
the evaluation of the endorsements in input

getName

public java.lang.String getName()
Returns the name of the current endorsement scheme

Returns:
The name of the endorsement scheme

setName

public void setName(java.lang.String val)
Sets the name of the current endorsement scheme

Parameters:
val - the name to be set

toString

public java.lang.String toString()
Provides a String representation of the current endorsement scheme

Overrides:
toString in class java.lang.Object