es.ants.felixgm.trmsim_wsn.trm.btrm_wsn
Class BTRM_Sensor

java.lang.Object
  extended by es.ants.felixgm.trmsim_wsn.network.Sensor
      extended by es.ants.felixgm.trmsim_wsn.trm.btrm_wsn.BTRM_Sensor
All Implemented Interfaces:
java.lang.Runnable

public class BTRM_Sensor
extends Sensor

This class models a Sensor implementing BTRM-WSN

Since:
0.2
Version:
0.2
Author:
Félix Gómez Mármol, Gregorio Martínez Pérez and Antonio Bernárdez

Field Summary
protected static int _numServers
          Number of servers composing the network this sensor belongs to
 
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
BTRM_Sensor()
          This constructor creates a new Sensor implementing BTRM-WSN
BTRM_Sensor(int id, double x, double y)
          This constructor creates a new Sensor implementing BTRM-WSN
 
Method Summary
 void addLink(Sensor node)
          Adds a link to a given sensor
 int get_numServers()
          Returns the number of servers of the network
 double getHeuristic(Sensor sensor)
          Gets the heuristic value with a given neighbor
 double getPheromone(Sensor sensor)
          Gets the pheromone trace with a given neighbor
 void reset()
          This method resets a Sensor to its initial state
 void setHeuristic(Sensor sensor, double value)
          Sets the heuristic trace value of the link connecting to a certain neighbor
static void setNumServers(int numServers)
          Sets the number of servers
 void setPheromone(Sensor sensor, double value)
          Sets the pheromone trace value of the link connecting to a certain neighbor
 java.lang.String toString()
          This method returns a String representation of this sensor
 
Methods inherited from class es.ants.felixgm.trmsim_wsn.network.Sensor
addService, addTransmittedDistance, cancelAllTimers, distance, distanceInHops, equals, findSensors, get_goodness, get_numServices, get_outcome, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_numServers

protected static int _numServers
Number of servers composing the network this sensor belongs to

Constructor Detail

BTRM_Sensor

public BTRM_Sensor()
This constructor creates a new Sensor implementing BTRM-WSN


BTRM_Sensor

public BTRM_Sensor(int id,
                   double x,
                   double y)
This constructor creates a new Sensor implementing BTRM-WSN

Parameters:
id - Identifier of the new sensor
x - X coordinate of the new sensor
y - Y coordinate of the new sensor
Method Detail

addLink

public void addLink(Sensor node)
Description copied from class: Sensor
Adds a link to a given sensor

Overrides:
addLink in class Sensor
Parameters:
node - Sensor to link to

get_numServers

public int get_numServers()
Returns the number of servers of the network

Returns:
Number of servers

setNumServers

public static void setNumServers(int numServers)
Sets the number of servers

Parameters:
numServers - Number of servers

getPheromone

public double getPheromone(Sensor sensor)
Gets the pheromone trace with a given neighbor

Parameters:
sensor - One of this sensor's neighbors
Returns:
The pheromone trace with the given neighbor sensor

getHeuristic

public double getHeuristic(Sensor sensor)
Gets the heuristic value with a given neighbor

Parameters:
sensor - One of this sensor's neighbors
Returns:
The heuristic value with the given neighbor sensor

setPheromone

public void setPheromone(Sensor sensor,
                         double value)
Sets the pheromone trace value of the link connecting to a certain neighbor

Parameters:
sensor - Neighbor whose pheromone trace is to be modified
value - New pheromone value

setHeuristic

public void setHeuristic(Sensor sensor,
                         double value)
Sets the heuristic trace value of the link connecting to a certain neighbor

Parameters:
sensor - Neighbor whose heuristic trace is to be modified
value - New heuristic value

reset

public void reset()
Description copied from class: Sensor
This method resets a Sensor to its initial state

Specified by:
reset in class Sensor

toString

public java.lang.String toString()
Description copied from class: Sensor
This method returns a String representation of this sensor

Overrides:
toString in class Sensor
Returns:
A String representation of this sensor