Package ptolemy.distributed.actor
Class DistributedReceiver
- java.lang.Object
-
- ptolemy.actor.AbstractReceiver
-
- ptolemy.distributed.actor.DistributedReceiver
-
- All Implemented Interfaces:
Receiver
public class DistributedReceiver extends AbstractReceiver
An implementation of the Receiver interface for distributed environments. Basically, its task is to forward tokens to distributed services whenever the put method is called.- Since:
- Ptolemy II 5.1
- Version:
- $Id$
- Author:
- Daniel Lazaro Cuadrado (kapokasa@kom.aau.dk)
- See Also:
AbstractReceiver
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (kapokasa)
-
-
Constructor Summary
Constructors Constructor Description DistributedReceiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Token
get()
Empty implementation of the inherited abstract method.boolean
hasRoom()
Empty implementation of the inherited abstract method.boolean
hasRoom(int numberOfTokens)
Empty implementation of the inherited abstract method.boolean
hasToken()
Empty implementation of the inherited abstract method.boolean
hasToken(int numberOfTokens)
Empty implementation of the inherited abstract method.void
put(Token token)
Forward copies of the token to the distributed services specified in the servicesReceiversListMap.void
setServicesReceiversListMap(java.util.HashMap servRecListMap)
Specify the servicesReceiversListMap that contains a sequence of services and IDs of receivers in the service.-
Methods inherited from class ptolemy.actor.AbstractReceiver
clear, elementList, getArray, getContainer, getCurrentTime, getModelTime, isKnown, putArray, putArrayToAll, putToAll, reset, setContainer, toString
-
-
-
-
Method Detail
-
get
public Token get() throws NoTokenException
Empty implementation of the inherited abstract method.- Specified by:
get
in interfaceReceiver
- Specified by:
get
in classAbstractReceiver
- Returns:
- A token read from the receiver.
- Throws:
NoTokenException
- If there is no token.
-
hasRoom
public boolean hasRoom()
Empty implementation of the inherited abstract method.- Specified by:
hasRoom
in interfaceReceiver
- Specified by:
hasRoom
in classAbstractReceiver
- Returns:
- True if the next call to put() will not result in a NoRoomException.
-
hasRoom
public boolean hasRoom(int numberOfTokens)
Empty implementation of the inherited abstract method.- Specified by:
hasRoom
in interfaceReceiver
- Specified by:
hasRoom
in classAbstractReceiver
- Parameters:
numberOfTokens
- The number of tokens to put into this receiver.- Returns:
- True if the next numberOfTokens calls to put() will not result in a NoRoomException.
-
hasToken
public boolean hasToken()
Empty implementation of the inherited abstract method.- Specified by:
hasToken
in interfaceReceiver
- Specified by:
hasToken
in classAbstractReceiver
- Returns:
- True if the next call to get() will not result in a NoTokenException.
-
hasToken
public boolean hasToken(int numberOfTokens)
Empty implementation of the inherited abstract method.- Specified by:
hasToken
in interfaceReceiver
- Specified by:
hasToken
in classAbstractReceiver
- Parameters:
numberOfTokens
- The number of tokens desired.- Returns:
- True if the next numberOfTokens calls to get() will not result in a NoTokenException.
-
put
public void put(Token token) throws IllegalActionException
Forward copies of the token to the distributed services specified in the servicesReceiversListMap. //TODO:This could be done in parallel. Is it worth the effort?- Specified by:
put
in interfaceReceiver
- Specified by:
put
in classAbstractReceiver
- Parameters:
token
- The token to be forwarded, or null to forward no token.- Throws:
IllegalActionException
- If the put fails (e.g. because of incompatible types).
-
setServicesReceiversListMap
public void setServicesReceiversListMap(java.util.HashMap servRecListMap)
Specify the servicesReceiversListMap that contains a sequence of services and IDs of receivers in the service.- Parameters:
servRecListMap
- The map that contains a sequence of services and IDs of receivers.
-
-