nl.tudelft.simulation.messaging.devices.components
Class ReceivingDevice

java.lang.Object
  extended bynl.tudelft.simulation.event.EventProducer
      extended bynl.tudelft.simulation.messaging.devices.components.Device
          extended bynl.tudelft.simulation.messaging.devices.components.ReceivingDevice
All Implemented Interfaces:
DeviceInterface, nl.tudelft.simulation.event.EventProducerInterface, ReceivingDeviceInterface, java.io.Serializable
Direct Known Subclasses:
LetterBox

public class ReceivingDevice
extends Device
implements ReceivingDeviceInterface

Standard implementation of a receiving device.

Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl . The source code and binary code of this software is proprietary information of Delft University of Technology.

Version:
$$Revision: 1.3 $$ $$Date: 2005/04/08 11:29:12 $$
Author:
Peter Jacobs , Stijn-Pieter van Houten , Alexander Verbraeck
See Also:
Serialized Form

Field Summary
protected  MessageQueueInterface queue
          The queue to store the messages in
 
Fields inherited from class nl.tudelft.simulation.messaging.devices.components.Device
name
 
Fields inherited from class nl.tudelft.simulation.event.EventProducer
listeners
 
Fields inherited from interface nl.tudelft.simulation.messaging.devices.components.ReceivingDeviceInterface
RECEIVED_NEW_MESSAGE_EVENT
 
Fields inherited from interface nl.tudelft.simulation.messaging.devices.components.DeviceInterface
STATE_CHANGE_EVENT
 
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
 
Constructor Summary
ReceivingDevice(java.lang.String name, DeviceType deviceType, int transmissionDelay, double transmissionFrequency, MessageQueueInterface queue)
          constructs a new receiving device, override the default transmission delay and frequency from the DeviceType.
ReceivingDevice(java.lang.String name, DeviceType deviceType, MessageQueueInterface queue)
          constructs a new receiving device, override the default transmission delay and frequency from the DeviceType.
 
Method Summary
 MessageQueueInterface getQueue()
          get the queue of messages that have already been received.
 java.lang.Object receive(Message message)
          receives a message
 
Methods inherited from class nl.tudelft.simulation.messaging.devices.components.Device
getDeviceType, getName, getState, getTransmissionDelay, getTransmissionFrequency, setState
 
Methods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getEventTypes, removeAllListeners, removeAllListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.tudelft.simulation.messaging.devices.components.DeviceInterface
getDeviceType, getName, getState, getTransmissionDelay, getTransmissionFrequency
 
Methods inherited from interface nl.tudelft.simulation.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypes, removeListener
 

Field Detail

queue

protected MessageQueueInterface queue
The queue to store the messages in

Constructor Detail

ReceivingDevice

public ReceivingDevice(java.lang.String name,
                       DeviceType deviceType,
                       MessageQueueInterface queue)
constructs a new receiving device, override the default transmission delay and frequency from the DeviceType.

Parameters:
name - the name or description of the device
deviceType - the type of device
queue - the type of queue to store the messages in

ReceivingDevice

public ReceivingDevice(java.lang.String name,
                       DeviceType deviceType,
                       int transmissionDelay,
                       double transmissionFrequency,
                       MessageQueueInterface queue)
constructs a new receiving device, override the default transmission delay and frequency from the DeviceType.

Parameters:
name - the name or description of the device
deviceType - the type of device
transmissionDelay - the default logarithmic transmission delay of the device.
transmissionFrequency - the maximum transmission frequency of the device.
queue - the type of queue to store the messages in
Method Detail

receive

public java.lang.Object receive(Message message)
Description copied from interface: ReceivingDeviceInterface
receives a message

Specified by:
receive in interface ReceivingDeviceInterface
Parameters:
message - the object or message to receive
Returns:
an acknowledgement object to indicate success, null is success, an Exception object indicates no success...

getQueue

public MessageQueueInterface getQueue()
Description copied from interface: ReceivingDeviceInterface
get the queue of messages that have already been received.

Specified by:
getQueue in interface ReceivingDeviceInterface
Returns:
Returns the message queue.
See Also:
ReceivingDeviceInterface.getQueue()


Copyright © 2004-2005 Delft University of Technology, the Netherlands. All Rights Reserved.