pamvotis.core
Class SourceManager

java.lang.Object
  extended by pamvotis.core.SourceManager

public class SourceManager
extends java.lang.Object

Manages the sources of a node. Polls packets from every source and returns them in a vector of packets through the pollPacketsFromSources function.

Author:
Vassilis Zafeiris

Constructor Summary
SourceManager(MobileNode node)
           
 
Method Summary
 void addSource(Source s)
          Add a source to the node's source manager.
 void clear()
          Removes all active sources.
 Source getSource(int id)
          Finds a node's active source whose ID is 'id'.
 java.util.Vector<Packet> pollPacketsFromSources()
          Polls packets from all sources.
 boolean removeSource(int sourceId)
          Removes a source with the given session id.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceManager

public SourceManager(MobileNode node)
Method Detail

pollPacketsFromSources

public java.util.Vector<Packet> pollPacketsFromSources()
Polls packets from all sources. The interarrival timer of each source is decreased by 1

Returns:
a vector of packets polled from sources

addSource

public void addSource(Source s)
               throws ElementExistsException
Add a source to the node's source manager.

Parameters:
s - The source instance.
Throws:
ElementExistsException

removeSource

public boolean removeSource(int sourceId)
                     throws ElementDoesNotExistException
Removes a source with the given session id.

Parameters:
sourceId -
Returns:
true if the source exists or false if it doesn't
Throws:
ElementDoesNotExistException

getSource

public Source getSource(int id)
                 throws ElementDoesNotExistException
Finds a node's active source whose ID is 'id'.

Parameters:
id - The ID of the source.
Returns:
The source the id of which is 'id'.
Throws:
ElementDoesNotExistException

clear

public void clear()
Removes all active sources.