J-Sim v1.2.1-p7 API

drcl.comp.queue
Class ActiveQueue

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.comp.Component
          extended bydrcl.comp.queue.ActiveQueue
All Implemented Interfaces:
java.lang.Cloneable, ObjectDuplicable, java.io.Serializable
Direct Known Subclasses:
Queue, QueueFIFO

public abstract class ActiveQueue
extends Component

An ActiveQueue is a queue and it is designed to interact with a data pulling component. It accepts a null signal from the data pulling component which triggers a dequeue and the dequeued data is sent at the output@ port. If the queue is empty, this component remembers that the pulling component is available for more data, and when new data arrives, this component actively sends out the data at the output@ port without the pulling component to do the pulling again.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class drcl.comp.Component
Component.Locks
 
Field Summary
protected  int nrequests
           
protected  Port outport
           
static java.lang.String OUTPUT_PORT_ID
           
 
Fields inherited from class drcl.comp.Component
FLAG_COMPONENT_NOTIFICATION, FLAG_DEBUG_ENABLED, FLAG_DIRECT_OUTPUT_ENABLED, FLAG_ENABLED, FLAG_ERROR_ENABLED, FLAG_EVENT_ENABLED, FLAG_EXPOSED, FLAG_GARBAGE_DISPLAY_ENABLED, FLAG_GARBAGE_ENABLED, FLAG_HAS_EXPOSED_CHILD, FLAG_PORT_NOTIFICATION, FLAG_STARTED, FLAG_STOPPED, FLAG_TRACE_ENABLED, FLAG_UNDEFINED_START, id, infoPort, locks, name, parent, PortGroup_DEFAULT_GROUP, PortGroup_EVENT, PortGroup_SERVICE, Root, Trace_DATA, Trace_SEND
 
Constructor Summary
ActiveQueue()
           
ActiveQueue(java.lang.String id_)
           
 
Method Summary
protected  int _getnrequests()
           
protected  void _setnrequests(int nreq_)
           
abstract  java.lang.Object dequeue()
          Dequeues and returns the first object in the queue.
abstract  java.lang.Object enqueue(java.lang.Object obj_)
          Enqueues the object at the end of the queue
 java.lang.Object enqueueAt(java.lang.Object obj_, int pos_)
          Enqueues the object at the position specified.
 java.lang.Object firstElement()
          Retrieves but not dequeue the first object in the queue.
 int getAvailableSize()
          Returns the available size of the queue.
abstract  int getCapacity()
          Returns the capacity of the queue.
protected  long getEnqueCount()
           
abstract  int getSize()
          Returns the current size of the queue.
 void increaseEnqueCount()
          Increases the enqueue counter, for diagnosis purpose.
 java.lang.String info()
          Returns information regarding this component.
 java.lang.String info(java.lang.String prefix_)
           
abstract  boolean isEmpty()
          Return true if the queue is empty.
abstract  boolean isFull()
          Return true if the queue is full.
 java.lang.Object lastElement()
          Retrieves but not remove the last object in the queue.
 java.lang.Object peekAt(int pos_)
          Retrieves but not dequeue the object at the position specified.
protected  void process(java.lang.Object data_, Port inPort_)
          The main callback method of a component.
protected  java.lang.Object pull()
          Returns the first available data in the queue.
 void reset()
          Resets the component for being used anew.
 java.lang.Object retrieveAt(int pos_)
          Dequeues the object at the position specified.
abstract  void setCapacity(int capacity_)
          Sets the capacity of the queue.
 
Methods inherited from class drcl.comp.Component
_resume, _start, _stop, addComponent, addComponent, addEventPort, addEventPort, addForkPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addServerPort, addServerPort, cancelFork, componentAdded, componentRemoved, connect, containsComponent, containsComponent, containsPort, debug, disconnectAll, disconnectAllPeers, disconnectAllPorts, drop, drop, duplicate, error, error, expose, exposeEventPorts, exposePort, exposePort, exposePort, exposePort, exposePort, findAvailable, findAvailable, findAvailable, finishing, fork, forkAt, getAllComponents, getAllPorts, getAllPorts, getAllWiresInside, getAllWiresInsideOut, getAllWiresOut, getComponent, getComponentFlag, getComponentFlag, getContract, getContractHT, getContractHT, getDebugFlagsInBinary, getDebugLevelNames, getForkManager, getID, getName, getParent, getPort, getPort, getRoot, getRuntime, getTime, iduplicate, isAncestorOf, isComponentNotificationEnabled, isContainer, isDebugEnabled, isDebugEnabledAt, isDirectlyRelatedTo, isDirectOutputEnabled, isEnabled, isErrorNoticeEnabled, isEventExportEnabled, isGarbageDisplayEnabled, isGarbageEnabled, isPortNotificationEnabled, isPortRemovable, isStarted, isStopped, isTraceEnabled, lock, notify, notifyAll, operate, portAdded, portRemoved, reboot, removeAll, removeAllComponents, removeAllPorts, removeAllPorts, removeComponent, removeComponent, removePort, removePort, removePort, resume, run, sduplicate, send, sendAt, setComponentFlag, setComponentFlag, setComponentNotificationEnabled, setContract, setDebugEnabled, setDebugEnabled, setDebugEnabledAt, setDebugEnabledAt, setDebugEnabledAt, setDirectOutputEnabled, setDirectOutputEnabled, setEnabled, setErrorNoticeEnabled, setErrorNoticeEnabled, setEventExportEnabled, setEventExportEnabled, setExecutionBoundary, setGarbageDisplayEnabled, setGarbageDisplayEnabled, setGarbageEnabled, setGarbageEnabled, setID, setID, setName, setPort, setPort, setPortNotificationEnabled, setPortRemovable, setRuntime, setTraceEnabled, setTraceEnabled, sleepFor, sleepUntil, stop, toString, unexpose, unlock, useLocalForkManager, useLocalForkManager, wait, yield
 
Methods inherited from class drcl.DrclObj
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OUTPUT_PORT_ID

public static final java.lang.String OUTPUT_PORT_ID
See Also:
Constant Field Values

nrequests

protected int nrequests

outport

protected Port outport
Constructor Detail

ActiveQueue

public ActiveQueue()

ActiveQueue

public ActiveQueue(java.lang.String id_)
Method Detail

reset

public void reset()
Description copied from class: Component
Resets the component for being used anew. All the internal variables must be set to the initial state. All the ports and child components are reset as well.

Overrides:
reset in class Component

info

public java.lang.String info()
Description copied from class: Component
Returns information regarding this component. Subclasses should override this method to provide useful information at run time.

Overrides:
info in class Component

info

public java.lang.String info(java.lang.String prefix_)

process

protected void process(java.lang.Object data_,
                       Port inPort_)
Description copied from class: Component
The main callback method of a component. Being invoked when data arrives at a port of its.

Overrides:
process in class Component
Parameters:
data_ - the arrival data.
inPort_ - the port where the data arrives.

getEnqueCount

protected final long getEnqueCount()

increaseEnqueCount

public final void increaseEnqueCount()
Increases the enqueue counter, for diagnosis purpose.


enqueue

public abstract java.lang.Object enqueue(java.lang.Object obj_)
Enqueues the object at the end of the queue

Returns:
the object being dropped due to the enqueue; null otherwise.

enqueueAt

public java.lang.Object enqueueAt(java.lang.Object obj_,
                                  int pos_)
Enqueues the object at the position specified.

Returns:
the object being dropped due to the enqueue; null otherwise.

dequeue

public abstract java.lang.Object dequeue()
Dequeues and returns the first object in the queue.

Returns:
the object dequeued; null if position is not valid.

retrieveAt

public java.lang.Object retrieveAt(int pos_)
Dequeues the object at the position specified.

Returns:
the object dequeued; null if position is not valid.

peekAt

public java.lang.Object peekAt(int pos_)
Retrieves but not dequeue the object at the position specified.

Returns:
the object; null if position is not valid.

firstElement

public java.lang.Object firstElement()
Retrieves but not dequeue the first object in the queue.

Returns:
the object; null if queue is empty.

lastElement

public java.lang.Object lastElement()
Retrieves but not remove the last object in the queue.

Returns:
the object; null if queue is empty.

isFull

public abstract boolean isFull()
Return true if the queue is full.


isEmpty

public abstract boolean isEmpty()
Return true if the queue is empty.


setCapacity

public abstract void setCapacity(int capacity_)
Sets the capacity of the queue.


getCapacity

public abstract int getCapacity()
Returns the capacity of the queue.


getSize

public abstract int getSize()
Returns the current size of the queue.


getAvailableSize

public int getAvailableSize()
Returns the available size of the queue.


_setnrequests

protected final void _setnrequests(int nreq_)

_getnrequests

protected final int _getnrequests()

pull

protected final java.lang.Object pull()
Returns the first available data in the queue.


J-Sim v1.2.1-p7 API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~