es.ants.felixgm.trmsim_wsn.outcomes
Class Outcome

java.lang.Object
  extended by es.ants.felixgm.trmsim_wsn.outcomes.Outcome
Direct Known Subclasses:
BasicOutcome

public abstract class Outcome
extends java.lang.Object

This class models the outcome of a trust and reputation model. It includes the Satisfaction of the client with the received service

Since:
0.1
Version:
0.4
Author:
Félix Gómez Mármol, Gregorio Martínez Pérez

Field Summary
protected  Satisfaction satisfaction
          Satisfaction of the client with the received service
 
Constructor Summary
protected Outcome(Satisfaction satisfaction)
          Class Outcome constructor
 
Method Summary
abstract  Outcome aggregate(java.util.Collection<Outcome> outcomes)
          This method computes the average of all the given outcomes
static Outcome computeOutcomes(java.util.Collection<Outcome> outcomes)
          Returns an outcome with the average and standard deviation of a collection of outcomes
static Outcome computeOutcomes(java.util.Collection<Outcome> outcomes, Network network, Service requiredService, int numExecutions)
          This method computes the average of all the given outcomes, provided by the clients of the given network and, additionally,
 Satisfaction get_satisfaction()
          This method returns the satisfaction of the client with the received service
protected  java.lang.String getOutcomesFileLine()
          This method returns the line of the file where to save this outcome, including all its elements
 java.lang.String toString()
           
static void writeToFile(java.util.Collection<Outcome> outcomes, java.lang.String fileName)
          Writes the elements of a collection of outcomes into a given file.
 void writeToFile(java.lang.String fileName)
          Writes the output of this outcome toString() method into a given file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

satisfaction

protected Satisfaction satisfaction
Satisfaction of the client with the received service

Constructor Detail

Outcome

protected Outcome(Satisfaction satisfaction)
Class Outcome constructor

Parameters:
satisfaction - Satisfaction of the client with the received service
Method Detail

aggregate

public abstract Outcome aggregate(java.util.Collection<Outcome> outcomes)
This method computes the average of all the given outcomes

Parameters:
outcomes - Outcomes to be aggregated
Returns:
The aggregation of the given outcomes

computeOutcomes

public static Outcome computeOutcomes(java.util.Collection<Outcome> outcomes,
                                      Network network,
                                      Service requiredService,
                                      int numExecutions)
This method computes the average of all the given outcomes, provided by the clients of the given network and, additionally,

Parameters:
outcomes - Outcomes to be aggregated
network - The network the given outcomes come from
requiredService - The requested service
numExecutions - The number of executions of the trust and/or reputation model over the given network
Returns:
The aggregation of the given outcomes plus the transmitted distance for each kind of sensor

computeOutcomes

public static Outcome computeOutcomes(java.util.Collection<Outcome> outcomes)
Returns an outcome with the average and standard deviation of a collection of outcomes

Parameters:
outcomes - Outcomes to compute (aggregate)
Returns:
An outcome with the average and standard deviation of a collection of outcomes

toString

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

getOutcomesFileLine

protected java.lang.String getOutcomesFileLine()
This method returns the line of the file where to save this outcome, including all its elements

Returns:
The line of the file where to save this outcome, including all its elements

writeToFile

public void writeToFile(java.lang.String fileName)
                 throws java.lang.Exception
Writes the output of this outcome toString() method into a given file

Parameters:
fileName - Path of the file where to write this outcome
Throws:
java.lang.Exception

writeToFile

public static void writeToFile(java.util.Collection<Outcome> outcomes,
                               java.lang.String fileName)
Writes the elements of a collection of outcomes into a given file. Very useful when plotting results is desired

Parameters:
outcomes - Outcomes where to get the average and standard deviation satisfaction to write to the file
fileName - Path of the file where to write

get_satisfaction

public Satisfaction get_satisfaction()
This method returns the satisfaction of the client with the received service

Returns:
The satisfaction of the client with the received service