es.ants.felixgm.trmsim_wsn.network
Class Service

java.lang.Object
  extended by es.ants.felixgm.trmsim_wsn.network.Service
Direct Known Subclasses:
LFTM_Service

public class Service
extends java.lang.Object

This class models a service offered in a P2P, Ad-hoc or Wireless Sensor Network, or even an agent in a multi-agent system.

Currently it is defined only by its name or identifier, but it can be extended to be defined by more characteristics such as the prize, the quality or the cost, for instance

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

Field Summary
protected  java.lang.String id
          Services's identifier
 
Constructor Summary
Service(java.lang.String id)
          Class Service constructor
 
Method Summary
 Service clone()
          This method creates and returns a copy of this service
 boolean equals(Service service)
          Indicates if two services are equal or not, according to their identifiers
 java.lang.String id()
          Returns the service id
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected java.lang.String id
Services's identifier

Constructor Detail

Service

public Service(java.lang.String id)
Class Service constructor

Parameters:
id - Services's identifier
Method Detail

equals

public boolean equals(Service service)
Indicates if two services are equal or not, according to their identifiers

Parameters:
service - Service to be compared
Returns:
true if the given service is equal to this, false otherwise

clone

public Service clone()
This method creates and returns a copy of this service

Overrides:
clone in class java.lang.Object
Returns:
A copy a this service

id

public java.lang.String id()
Returns the service id

Returns:
String with the service id.

toString

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