pamvotis.core
Class MobileNode

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

public class MobileNode
extends java.lang.Object

Simulates a mobile node

Author:
Dimitris El. Vassis - Vassilis Zafeiris

Field Summary
static java.util.Random generator
           
 
Method Summary
 void addSource(Source s)
          Adds a new source to the source manager
 PacketBuffer getPacketBuffer()
          Gets the packet buffer of the node.
 Source getSource(int sourceId)
          Returns a source identified by its Id.
 java.util.Vector<Packet> pollPacketsFromSources()
          Calls the corresponding function of the source manager to poll one packet from each source
 void removeAllSources()
          Removes all the sources of a node.
 void removeSource(int sourceId)
          Removes a source from the source manager
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

generator

public static java.util.Random generator
Method Detail

getSource

public Source getSource(int sourceId)
                 throws ElementDoesNotExistException
Returns a source identified by its Id. The Id of a source is the element number at the source manager

Parameters:
sourceId - The Id of the source
Returns:
The source the id of which is 'sourceId'.
Throws:
ElementDoesNotExistException
See Also:
SourceManager.getSource(int)

addSource

public void addSource(Source s)
               throws ElementExistsException
Adds a new source to the source manager

Parameters:
s - The source to be added
Throws:
ElementExistsException
See Also:
SourceManager.addSource(Source)

removeSource

public void removeSource(int sourceId)
                  throws ElementDoesNotExistException
Removes a source from the source manager

Parameters:
sourceId - The Id of the source to be removed.
Throws:
ElementDoesNotExistException
See Also:
SourceManager.removeSource(int)

pollPacketsFromSources

public java.util.Vector<Packet> pollPacketsFromSources()
Calls the corresponding function of the source manager to poll one packet from each source

Returns:
A vector with the packets that are polled from the sources.
See Also:
SourceManager.pollPacketsFromSources()

getPacketBuffer

public PacketBuffer getPacketBuffer()
Gets the packet buffer of the node.

Returns:
The packet buffer of the node.
See Also:
PacketBuffer

removeAllSources

public void removeAllSources()
Removes all the sources of a node.

See Also:
SourceManager.clear()