|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectes.ants.felixgm.trmsim_wsn.network.Sensor
es.ants.felixgm.trmsim_wsn.trm.powertrust.PowerTrust_Sensor
public class PowerTrust_Sensor
This class models a Sensor implementing PowerTrust
| Field Summary | |
|---|---|
protected static int |
_numSensors
Number of sensors composing the network this sensor belongs to |
protected double |
globalReputationScore
Score v_i |
protected boolean |
isPowerNode
Indicates if this sensor is a power node (true) or not (false) |
protected double[] |
mostRecentFeedbackScoreVector
Vector s_i |
protected double[] |
normalizedLocalTrustVector
Vector r_i |
protected java.util.Collection<Transaction> |
transactions
Collection of Transactions this sensor has had |
| Fields inherited from class es.ants.felixgm.trmsim_wsn.network.Sensor |
|---|
_maxDistance, activeState, collusion, dynamic, id, idCount, links, numRequests, numRequestsThreshold, numRequestsTimer, outcome, requiredService, runningSimulation, servicesGoodness, sleepTimer, sleepTimerAux, transmittedDistance, trmmodelWSN, xPosition, yPosition |
| Constructor Summary | |
|---|---|
PowerTrust_Sensor()
This constructor creates a new Sensor implementing PowerTrust |
|
PowerTrust_Sensor(int id,
double x,
double y)
This constructor creates a new Sensor implementing PowerTrust |
|
| Method Summary | |
|---|---|
void |
addNewTransaction(PowerTrust_Sensor client,
PowerTrust_Sensor server,
Outcome outcome)
This method adds a new Transaction to the collection of transactions of this sensor |
int |
compareTo(PowerTrust_Sensor comparedSensor)
This method compares two PowerTrust sensors according to their global reputation scores |
double |
computeGlobalReputation()
This method computes the global retupation of this node according to algorithm 3 of PowerTrust, i.e., v_i = (1-alpha)*sum(v_j*r_{ji})+alpha/m if this sensor is a power node and v_i = (1-alpha)*sum(v_j*r_{ji}), otherwise |
double |
get_globalReputationScore()
Returns the current global reputation score v_i^t |
Outcome |
get_outcome()
This method returns the last outcome of a performed transaction and, additionally, dynamically selects the new set of m power nodes |
double |
getNormalizedLocalTrustScore(PowerTrust_Sensor server)
This method computes the normalized local trust score r_{ij}\in[0,1] |
static int |
getNumSensors()
Returns the number of sensors composing the network this sensor belongs to |
boolean |
isPowerNode()
Indicates if this sensor is a power node (true) or not (false) |
void |
reset()
This method resets a Sensor to its initial state |
static void |
setNumSensors(int numSensors)
Sets the number of sensors composing the network this sensor belongs to |
void |
setPowerNode(boolean isPowerNode)
Sets this senor as a power node or not |
| Methods inherited from class es.ants.felixgm.trmsim_wsn.network.Sensor |
|---|
addLink, addService, addTransmittedDistance, cancelAllTimers, distance, distanceInHops, equals, findSensors, get_goodness, get_numServices, get_requiredService, get_services, get_transmittedDistance, get_TRModel_WSN, getNeighbors, getService, getX, getY, id, isActive, isNeighbor, isRunningSimulation, offersService, offersService, removeAllNeighbors, removeLink, removeService, resetId, run, serve, set_goodness, set_requiredService, set_TRModel_WSN, setActiveState, setCollusion, setDynamic, setMaxDistance, setRunningSimulation, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static int _numSensors
protected double globalReputationScore
protected double[] normalizedLocalTrustVector
protected double[] mostRecentFeedbackScoreVector
protected java.util.Collection<Transaction> transactions
protected boolean isPowerNode
| Constructor Detail |
|---|
public PowerTrust_Sensor()
public PowerTrust_Sensor(int id,
double x,
double y)
id - Identifier of the new sensorx - X coordinate of the new sensory - Y coordinate of the new sensor| Method Detail |
|---|
public void reset()
Sensor
reset in class Sensorpublic double getNormalizedLocalTrustScore(PowerTrust_Sensor server)
server - Server j
public double computeGlobalReputation()
public void addNewTransaction(PowerTrust_Sensor client,
PowerTrust_Sensor server,
Outcome outcome)
client - The client who requested the serviceserver - The server who provided the serviceoutcome - Outcome of the trnsaction to be addedpublic Outcome get_outcome()
get_outcome in class Sensorpublic int compareTo(PowerTrust_Sensor comparedSensor)
compareTo in interface java.lang.Comparable<PowerTrust_Sensor>comparedSensor - Sensor to be compared with this sensor
public static void setNumSensors(int numSensors)
numSensors - The number of sensors composing the network this sensor belongs topublic void setPowerNode(boolean isPowerNode)
isPowerNode - true if this sensor is to be a power node, false otherwisepublic boolean isPowerNode()
public static int getNumSensors()
public double get_globalReputationScore()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||