org.cfpm.caves.za
Class EndorsementScheme

java.lang.Object
  extended by org.cfpm.caves.za.EndorsementScheme

public class EndorsementScheme
extends java.lang.Object

This class represents an endorsement scheme of an agent. This is basically a table of endorsement tokens ("labels") and their associated weights ("values"). It allows the agent to evaluate another agent by computing the overall endorsement value of all endorsements he has made to that agent.

Author:
Scott Moss, Ruth Meyer

Field Summary
(package private)  double base
          the base of the endorsement scheme, used in the calculation of the overall endorsement value
(package private)  jess.Value name
          the name of the endorsement scheme
(package private)  java.util.HashMap<jess.Value,java.lang.Integer> scheme
          the actual scheme = table of tokens and weights
 
Constructor Summary
EndorsementScheme(java.lang.String name, double base)
          Creates a new endorsement scheme with the given name and base
EndorsementScheme(jess.Value name, double base)
          Creates a new endorsement scheme with the given name and base
 
Method Summary
 void addEndorsement(jess.Value token, int value)
          adds an endorsement (pair of token and weight value)
 double calculateEndorsementValue(jess.ValueVector endorsements)
          calculates the overall endorsement value for the given list of endorsement tokens, using the formula from Moss (1995).
 jess.Value[] getEndorsementsList()
          returns the list of endorsement tokens
 jess.Value getName()
          returns the name of the endorsement scheme
 int getValue(jess.Value endorsement)
          returns the weight associated with the given endorsement token
 void print()
          prints the endorsement scheme (table of tokens and values) to console
 void setName(java.lang.String nameString)
          sets the name of the endorsement scheme
 void setName(jess.Value name)
          sets the name of the endorsement scheme
 java.lang.String toString()
          returns a String representation of the endorsement scheme
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

jess.Value name
the name of the endorsement scheme


base

double base
the base of the endorsement scheme, used in the calculation of the overall endorsement value


scheme

java.util.HashMap<jess.Value,java.lang.Integer> scheme
the actual scheme = table of tokens and weights

Constructor Detail

EndorsementScheme

public EndorsementScheme(java.lang.String name,
                         double base)
Creates a new endorsement scheme with the given name and base

Parameters:
name - the scheme's name as String
base - the scheme's base

EndorsementScheme

public EndorsementScheme(jess.Value name,
                         double base)
Creates a new endorsement scheme with the given name and base

Parameters:
name - the scheme's name
base - the scheme's base
Method Detail

addEndorsement

public void addEndorsement(jess.Value token,
                           int value)
adds an endorsement (pair of token and weight value)

Parameters:
token - the endorsement token
value - the weight to be associated with the token

calculateEndorsementValue

public double calculateEndorsementValue(jess.ValueVector endorsements)
calculates the overall endorsement value for the given list of endorsement tokens, using the formula from Moss (1995).

Parameters:
endorsements - list of endorsement tokens
Returns:
overall endorsement value

getName

public jess.Value getName()
returns the name of the endorsement scheme

Returns:
the name

setName

public void setName(jess.Value name)
sets the name of the endorsement scheme

Parameters:
name - the name

setName

public void setName(java.lang.String nameString)
sets the name of the endorsement scheme

Parameters:
nameString - the name as String

getEndorsementsList

public jess.Value[] getEndorsementsList()
returns the list of endorsement tokens

Returns:
list of endorsement tokens

toString

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

Overrides:
toString in class java.lang.Object
Returns:
a String consisting of "endorsement-scheme:" and the name

print

public void print()
prints the endorsement scheme (table of tokens and values) to console


getValue

public int getValue(jess.Value endorsement)
returns the weight associated with the given endorsement token

Parameters:
endorsement - endorsement token
Returns:
endorsement value (weight)