pamvotis.core
Class PacketBuffer

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

public class PacketBuffer
extends java.lang.Object

Simulates the hardware packet buffer of a noder

Author:
Vassilis Zafeiris

Constructor Summary
PacketBuffer(int size)
          Creates a packet buffer, which is actually called _vPacketQueue
 
Method Summary
 void dequeue()
          Removes the first element of the packet buffer.
 void enqueue(java.util.Vector<Packet> newPackets)
          Gets all the packets that the source manager polled from each source and adds them to the packet buffer.
 Packet firstPacket()
           
 boolean isEmpty()
          Checks if a packet buffer is empty.
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PacketBuffer

public PacketBuffer(int size)
Creates a packet buffer, which is actually called _vPacketQueue

Parameters:
size - The buffer capacity in packets.
Method Detail

enqueue

public void enqueue(java.util.Vector<Packet> newPackets)
Gets all the packets that the source manager polled from each source and adds them to the packet buffer. The source manager, at each slot, it polls one packet from each source

Parameters:
newPackets - A vector that contains all the packets polled from sources

firstPacket

public Packet firstPacket()
Returns:
The first element (packet) of the packet buffer
See Also:
Packet

dequeue

public void dequeue()
Removes the first element of the packet buffer.


isEmpty

public boolean isEmpty()
Checks if a packet buffer is empty.

Returns:
True if it is empty or false if not.

size

public int size()
Returns:
The size of the packet buffer.