org.dbe.eve.simulator
Class AbstractService

java.lang.Object
  extended by org.dbe.eve.simulator.AbstractService
Direct Known Subclasses:
DemandedService, Service

public abstract class AbstractService
extends java.lang.Object

The parent class for all types of services

Author:
Roman Greil

Field Summary
protected  java.util.Vector attributes
           
protected  int ID
           
(package private) static org.apache.log4j.Logger logger
           
 
Constructor Summary
AbstractService(int id)
          Constructs an AbstractService and sets its id
AbstractService(int id, int numberOfAttributes)
          Constructs an AbstractService with random Attributes and sets its ID.
AbstractService(java.util.Vector _attributes, int id)
          Constructs an AbstractService with Attributes and set its id
 
Method Summary
 boolean addAttribute(Attribute attributeToAdd)
          Adds an Attribute to the Attributes of this Service.
 double compareTo(java.lang.Object o)
          This method returns how many Attributes match the Attributes of the other service.
 java.util.Vector getAttributes()
          Returns the Vector of Attributes of the Service
 int getServiceID()
          return the ID of the Service
 java.lang.String toString()
          Represents the Service as String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

protected int ID

attributes

protected java.util.Vector attributes

logger

static org.apache.log4j.Logger logger
Constructor Detail

AbstractService

public AbstractService(int id)
Constructs an AbstractService and sets its id

Parameters:
id - the id of the new AbstractService

AbstractService

public AbstractService(java.util.Vector _attributes,
                       int id)
Constructs an AbstractService with Attributes and set its id

Parameters:
_attributes - is a Vector of Attributes
id - the id of the new AbstractService

AbstractService

public AbstractService(int id,
                       int numberOfAttributes)
Constructs an AbstractService with random Attributes and sets its ID.

Parameters:
id - the id of the new AbstractService
numberOfAttributes - is the number of Attributes which should be randomly generated
Method Detail

getServiceID

public int getServiceID()
return the ID of the Service

Returns:
ID of this Service

getAttributes

public java.util.Vector getAttributes()
Returns the Vector of Attributes of the Service

Returns:
Vector of Attributes

addAttribute

public boolean addAttribute(Attribute attributeToAdd)
Adds an Attribute to the Attributes of this Service.

Parameters:
attributeToAdd -
Returns:
true if it worked

toString

public java.lang.String toString()
Represents the Service as String

Overrides:
toString in class java.lang.Object
Returns:
A string which includes the AbstractService description

compareTo

public double compareTo(java.lang.Object o)
This method returns how many Attributes match the Attributes of the other service. If one of the two services is a demanded service, the value of the match is multiplied by the weight this attribute has compared to the others.