net.clackrouter.component.extension
Class Delay

java.lang.Object
  extended by net.clackrouter.component.base.ClackComponent
      extended by net.clackrouter.component.extension.Delay
All Implemented Interfaces:
Alarm

public class Delay
extends ClackComponent


Nested Class Summary
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
static int DEFAULT_DELAY
           
static int NUM_PORTS
           
static int PORT_IN
           
static int PORT_OUT
           
 
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
Delay(Router r, java.lang.String name)
           
Delay(Router r, java.lang.String name, int delay)
           
 
Method Summary
 java.awt.Color getColor()
          The color this component should be rendered in, assuming a standard component rendering by the ComponentView.ComponentRenderer class.
 int getDelay()
           
 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.
 java.util.Properties getSerializableProperties(boolean isTransient)
          Serialize the delay value for reloading the router
 VNSPacket handlePullRequest(int port_number)
          Called when a neighboring component wishes to "pull" a packet from this component.
 void initializeProperties(java.util.Properties props)
          Load the saved delay 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.
 void poll()
          Callback method to implement component functionality that is not initiated by a packet push.
 void setDelay(int d)
           
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
acceptPacket, createCopy, createInputPullPort, createInputPushPort, createOutputPullPort, createOutputPushPort, error, fireListeners, getComponentCell, getHierarchicalView, getLog, getName, getNumPorts, getPacketCountIn, getPacketCountOut, getPendingError, getPort, getRouter, getTime, getTypeName, getUniqueCount, getView, hasError, isHierarchical, log, notifyAlarm, 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

PORT_IN

public static int PORT_IN

PORT_OUT

public static int PORT_OUT

NUM_PORTS

public static int NUM_PORTS

DEFAULT_DELAY

public static int DEFAULT_DELAY
Constructor Detail

Delay

public Delay(Router r,
             java.lang.String name)

Delay

public Delay(Router r,
             java.lang.String name,
             int delay)
Method Detail

setupPorts

protected void setupPorts(int numports)
Description copied from class: ClackComponent
Allocates an array of ClackPort objects to be used by this component

Overrides:
setupPorts in class ClackComponent
Parameters:
numports - the number of ports to create

isModifying

public boolean isModifying()
Description copied from class: ClackComponent
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. Sub-classes that do not modify packets should override this method

Overrides:
isModifying in class ClackComponent
Returns:
by default, we assume the component modifies packets

getDelay

public int getDelay()

setDelay

public void setDelay(int d)

handlePullRequest

public VNSPacket handlePullRequest(int port_number)
Description copied from class: ClackComponent

Called when a neighboring component wishes to "pull" a packet from this component.

This function should only be valid for port numbers that are defined as pull ports. This is enforced by the ClackPort class. By default, we return nothing.

Overrides:
handlePullRequest in class ClackComponent
Parameters:
port_number - The port that a packet is being requested on
Returns:
A packet if available for pull, or null

poll

public void poll()
Description copied from class: ClackComponent

Callback method to implement component functionality that is not initiated by a packet push.

The pull method is often used to implement a "pull" component, or to serve as a packet source. The Router calls poll() once per processing loop if the component has been registered using the Router.registerForPoll(ClackComponent) method.

Overrides:
poll in class ClackComponent

getPropertiesView

public javax.swing.JPanel getPropertiesView()
Description copied from class: ClackComponent
Method for getting the properties view associated with this component Property views are used to display more detailed information about internal component state. This method creates a default property view, and can be overriden to provide custom properties views

Overrides:
getPropertiesView in class ClackComponent
Returns:
this component's property view

getSerializableProperties

public java.util.Properties getSerializableProperties(boolean isTransient)
Serialize the delay value for reloading the router

Overrides:
getSerializableProperties in class ClackComponent
Parameters:
isTransient - flag indicating if serialization is transient
Returns:
all property key-value pairs to serialize

initializeProperties

public void initializeProperties(java.util.Properties props)
Load the saved delay value

Overrides:
initializeProperties in class ClackComponent
Parameters:
props - all property values serialized for this component

getColor

public java.awt.Color getColor()
Description copied from class: ClackComponent

The color this component should be rendered in, assuming a standard component rendering by the ComponentView.ComponentRenderer class.

Other renderers may ignore this value.

Overrides:
getColor in class ClackComponent
Returns:
the rendering color