net.clackrouter.component.simplerouter
Class ByteQueue

java.lang.Object
  extended by net.clackrouter.component.base.ClackComponent
      extended by net.clackrouter.component.base.Queue
          extended by net.clackrouter.component.simplerouter.ByteQueue
All Implemented Interfaces:
Alarm

public class ByteQueue
extends Queue

A drop-tail queue measuring its occupancy in bytes.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
static int DEFAULT_MAX_SIZE
           
 
Fields inherited from class net.clackrouter.component.base.Queue
DEFAULT_SIZE, m_max_size, m_queue, m_recent_drop, m_total_drops, mQueueOccData, NUM_PORTS, PORT_HEAD, PORT_TAIL, startTime
 
Fields inherited from class net.clackrouter.component.base.ClackComponent
componentCell, m_has_error, m_log, m_name, m_num_ports, m_packetcount_in, m_packetcount_out, m_ports, mListeners, mRouter, pendingError, SIGNAL_ERROR_LEN_MSEC, UNIQUE_COUNT, view
 
Constructor Summary
ByteQueue(Router router, java.lang.String name)
           
ByteQueue(Router r, java.lang.String name, int max_size)
          Create a queue specifying its max size in bytes
 
Method Summary
 void acceptPacket(VNSPacket packet, int port_number)
          Add packet to the queue if the additional bytes can be stored without exceeding max size, otherwise drop.
 int getOccupancy()
          The current occupancy of the queue
 VNSPacket handlePullRequest(int port_number)
          Pull a packet from the head of the queue
 
Methods inherited from class net.clackrouter.component.base.Queue
getMaxOccupancy, getPropertiesView, getQueueOccData, getSerializableProperties, getTotalDropped, getView, initializeProperties, isModifying, queueOccupancyChanged, recentDropTest, setMaxOccupancy, setupPorts
 
Methods inherited from class net.clackrouter.component.base.ClackComponent
createCopy, createInputPullPort, createInputPushPort, createOutputPullPort, createOutputPushPort, error, fireListeners, getColor, getComponentCell, getHierarchicalView, getLog, getName, getNumPorts, getPacketCountIn, getPacketCountOut, getPendingError, getPort, getRouter, getTime, getTypeName, getUniqueCount, hasError, isHierarchical, log, notifyAlarm, poll, registerListener, sendOutPort, setAlarm, setComponentCell, setName, setPendingError, setView, showErrorDialog, signalError, try_repaint, unregisterListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_SIZE

public static int DEFAULT_MAX_SIZE
Constructor Detail

ByteQueue

public ByteQueue(Router router,
                 java.lang.String name)

ByteQueue

public ByteQueue(Router r,
                 java.lang.String name,
                 int max_size)
Create a queue specifying its max size in bytes

Method Detail

acceptPacket

public void acceptPacket(VNSPacket packet,
                         int port_number)
Add packet to the queue if the additional bytes can be stored without exceeding max size, otherwise drop.

Overrides:
acceptPacket in class Queue
Parameters:
packet - The pushed packet
port_number - The number of the port that this packet is arriving on

handlePullRequest

public VNSPacket handlePullRequest(int port_number)
Pull a packet from the head of the queue

Overrides:
handlePullRequest in class Queue
Parameters:
port_number - The port that a packet is being requested on
Returns:
a single packet, or null if queue is empty

getOccupancy

public int getOccupancy()
Description copied from class: Queue
The current occupancy of the queue

Overrides:
getOccupancy in class Queue