|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.clackrouter.component.base.ClackComponent net.clackrouter.component.base.Queue
public class Queue
Base class for any Clack queue.
This class measures queue occupancy in packets and can contain any type of packet. This class provides basic functionality inherited by more advanced queues
Nested Class Summary |
---|
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent |
---|
ClackComponent.Waiter |
Field Summary | |
---|---|
static int |
DEFAULT_SIZE
|
protected int |
m_max_size
|
protected java.util.ArrayList |
m_queue
|
protected boolean |
m_recent_drop
|
protected int |
m_total_drops
|
protected ClackOccData |
mQueueOccData
|
static int |
NUM_PORTS
|
static int |
PORT_HEAD
|
static int |
PORT_TAIL
|
protected java.util.Date |
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 | |
---|---|
Queue(Router router,
java.lang.String name)
|
|
Queue(Router router,
java.lang.String name,
int start_size)
|
Method Summary | |
---|---|
void |
acceptPacket(VNSPacket packet,
int port_number)
Enqueues a packet at the tail of the queue, if possible, or drops it if it is already at max occupancy. |
int |
getMaxOccupancy()
The max occupancy of the queue |
int |
getOccupancy()
The current occupancy of the queue |
javax.swing.JPanel |
getPropertiesView()
Method for getting the properties view associated with this component Property views are used to display more detailed information about internal component state. |
ClackOccData |
getQueueOccData()
Provides data of queue occupancy vs time for real-time graphs. |
java.util.Properties |
getSerializableProperties(boolean isTransient)
Serialize the queue's size for reloading the router |
int |
getTotalDropped()
Total number of packets dropped by this queue |
VertexView |
getView(JGraph graph,
CellMapper mapper)
Override default ClackComponent method that returns a ClackComponentView since queues are rendered differently within a RouterView. |
VNSPacket |
handlePullRequest(int port_number)
Removes a packet from the head of the queue, if possible, and returns it. |
void |
initializeProperties(java.util.Properties props)
Load the saved size value |
boolean |
isModifying()
Reports whether this component modifies packets passed through it This value is used by the static checking algorithm used to make sure port connections are valid. |
protected void |
queueOccupancyChanged()
Helper method to update graph and GUI queue when occupancy has been changed. |
boolean |
recentDropTest()
Test whether we have just dropped a packet (used by QueueView). |
void |
setMaxOccupancy(int newMax)
Set the max occupancy of this queue |
protected void |
setupPorts(int numports)
Allocates an array of ClackPort objects to be used by this component |
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 |
---|
public static int PORT_HEAD
public static int PORT_TAIL
public static int NUM_PORTS
public static int DEFAULT_SIZE
protected int m_max_size
protected int m_total_drops
protected boolean m_recent_drop
protected java.util.Date startTime
protected transient java.util.ArrayList m_queue
protected transient ClackOccData mQueueOccData
Constructor Detail |
---|
public Queue(Router router, java.lang.String name)
public Queue(Router router, java.lang.String name, int start_size)
Method Detail |
---|
protected void setupPorts(int numports)
ClackComponent
setupPorts
in class ClackComponent
numports
- the number of ports to createpublic boolean isModifying()
ClackComponent
isModifying
in class ClackComponent
public void acceptPacket(VNSPacket packet, int port_number)
acceptPacket
in class ClackComponent
packet
- The pushed packetport_number
- The number of the port that this packet is arriving onpublic VNSPacket handlePullRequest(int port_number)
handlePullRequest
in class ClackComponent
port_number
- The port that a packet is being requested on
protected void queueOccupancyChanged()
public int getOccupancy()
public int getMaxOccupancy()
public void setMaxOccupancy(int newMax)
public int getTotalDropped()
public boolean recentDropTest()
public ClackOccData getQueueOccData()
public javax.swing.JPanel getPropertiesView()
ClackComponent
getPropertiesView
in class ClackComponent
public VertexView getView(JGraph graph, CellMapper mapper)
getView
in class ClackComponent
graph
- the Router Graphmapper
- the CellMapper associated with this Router Graph
public java.util.Properties getSerializableProperties(boolean isTransient)
getSerializableProperties
in class ClackComponent
isTransient
- flag indicating if serialization is transient
public void initializeProperties(java.util.Properties props)
initializeProperties
in class ClackComponent
props
- all property values serialized for this component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |