es.ants.felixgm.trmsim_wsn.trm.templatetrm
Class TemplateTRM_Network

java.lang.Object
  extended by es.ants.felixgm.trmsim_wsn.network.Network
      extended by es.ants.felixgm.trmsim_wsn.trm.templatetrm.TemplateTRM_Network

public class TemplateTRM_Network
extends Network

This class models a network composed by sensors implementing TemplateTRM

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

Field Summary
 
Fields inherited from class es.ants.felixgm.trmsim_wsn.network.Network
clients, maxDistance, sensors, servers, services
 
Constructor Summary
TemplateTRM_Network(int numSensors, double probClients, double rangeFactor, java.util.Collection<java.lang.Double> probServices, java.util.Collection<java.lang.Double> probGoodness, java.util.Collection<Service> services)
          This constructor creates a new random TemplateTRM Network using the given parameters
TemplateTRM_Network(java.lang.String xmlFilePath)
          This method loads a network from a XML file and creates the specific corresponding TemplateTRM Network
 
Method Summary
 Sensor newSensor()
          This method creates a new sensor.
 Sensor newSensor(int id, double x, double y)
          This method creates a new sensor.
 
Methods inherited from class es.ants.felixgm.trmsim_wsn.network.Network
get_clients, get_maxDistance, get_numClients, get_numSensors, get_numServers, get_sensors, get_sensorsTransmittedDistance, get_servers, get_services, oscillate, reachesQualifiedService, reset, set_collusion, set_dynamic, setNewNeighbors, toString, writeToXMLFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TemplateTRM_Network

public TemplateTRM_Network(int numSensors,
                           double probClients,
                           double rangeFactor,
                           java.util.Collection<java.lang.Double> probServices,
                           java.util.Collection<java.lang.Double> probGoodness,
                           java.util.Collection<Service> services)
This constructor creates a new random TemplateTRM Network using the given parameters

Parameters:
numSensors - Network number sensors
probClients - The network will have a number of clients depending of this parameter.
rangeFactor - Range Factor.
probServices - Probability of servers offers services.
probGoodness - Probability of servers being good.
services - Services that servers offers to clients.

TemplateTRM_Network

public TemplateTRM_Network(java.lang.String xmlFilePath)
                    throws java.lang.Exception
This method loads a network from a XML file and creates the specific corresponding TemplateTRM Network

Parameters:
xmlFilePath - Path of the XML to load the network from
Throws:
java.lang.Exception - If the XML file given does not have the appropriate structure, or if a sensor links to an undefined sensor, or if a sensor links to itself
Method Detail

newSensor

public Sensor newSensor()
Description copied from class: Network
This method creates a new sensor. It must be redefined in each subclass according to the requirements of each particular trust and reputation model

Specified by:
newSensor in class Network
Returns:
New created sensor

newSensor

public Sensor newSensor(int id,
                        double x,
                        double y)
Description copied from class: Network
This method creates a new sensor. It must be redefined in each subclass according to the requirements of each particular trust and reputation model

Specified by:
newSensor in class Network
Parameters:
id - Sensor's identifier
x - X coordinate of the new sensor
y - Y coordinate of the new sensor
Returns:
New created sensor