|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.ksu.cis.cooprobot.simulator.communication.RobotCommRecord
RobotCommRecord class keeps communication parameters of each robot. Communication parameters include range, delay, link, delivery probability and distance between each robot.
-- Range is the maximum distance which a robot can send messages to other robots.This class manipulates the parameters and also determines if sender and receiver robot are qualified to pass and get of both point-to-point and broadcast message.
To create a RobotCommRecord needs two parameter, robot name and communication
type. Communication type can be BROADCAST, POINT2POINT or BROADCASTANDP2P. A RobotCommRecord
is created when CommunicationsSystem
registers a robot to the system. It will be created
with specified communication type. In the creation process, it also intialize robot parameters
and create a priority queue.
Field Summary | |
private boolean |
isBroadcastEnabled
Broadcast cabability status |
private boolean |
isP2PEnabled
Point-to-Point capability status |
private boolean |
isReceiveLinkEnabled
Incoming link status |
private boolean |
isSendLinkEnabled
Outgoing link status |
private PriorityQueue |
messageQueue
Incoming message queue. |
private String |
name
Robot name |
private int |
range
Maximum distance which a robot can send messages to other robots. |
private Vector |
robotParameterVector
Vector of robot parameter |
Constructor Summary | |
RobotCommRecord(String name,
int commType)
RobotCommRecord Constructor |
Method Summary | |
void |
addMsgToQueue(Message msg)
A Process to add message to a priority queue |
boolean |
addRobotParameters(RobotParameters robot)
Adding robot parameter which related to this robotCommRecord. |
void |
disableBroadcast()
Disable Broadcast capability |
void |
disableP2P()
Disable Point-to-point capability |
void |
enableBroadcast()
Enable Broadcast capability |
void |
enableP2P()
Enable Point-to-point capability |
int |
getDelay(String name)
Get delay time |
int |
getDeliveryProb(String name)
Get delivery probability |
Vector |
getMessage(long time)
Get a Vector of message |
String |
getName()
Get robot name |
int |
getRange()
Get maximum range limit |
private RobotParameters |
getRobotParameters(String name)
Get robot parameter |
boolean |
isBroadcastEnabled()
Check if broadcast capability is on |
boolean |
isP2PEnabled()
Check if point-to-point capability is on |
boolean |
isReceiveBroadcastEnabled()
Check if robot can get broadcast message |
boolean |
isReceiveLinkEnabled()
Check if incoming link is enabled |
boolean |
isReceiveP2PEnabled()
Check if robot can get point-to-point message |
boolean |
isSendBroadcastEnabled()
Check if robot can send broadcast message |
boolean |
isSendLinkEnabled()
Check if outgoing link is enabled |
boolean |
isSendP2PEnabled()
Check if robot can send Point-2-point message |
private void |
setCommType(int commType)
Set communication type |
void |
setDelay(String name,
int delay)
Set delay time of a robot |
void |
setDeliveryProb(String name,
int prob)
Set delivery probability of a robot |
void |
setRange(int range)
Set maximum range limit |
void |
shutdownReceiveLink()
Shutdown incoming link |
void |
shutdownSendLink()
Shutdown outgoing link |
void |
startupReceiveLink()
Start up incoming link |
void |
startupSendLink()
Start up outgoing link |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private String name
private int range
private boolean isSendLinkEnabled
private boolean isReceiveLinkEnabled
private boolean isBroadcastEnabled
private boolean isP2PEnabled
private Vector robotParameterVector
private PriorityQueue messageQueue
Constructor Detail |
public RobotCommRecord(String name, int commType)
name
- - Robot namecommType
- - Communication type (BROADCAST,POINT2POINT or BROADCASTANDP2P)CommunicationsSystem
Method Detail |
public void addMsgToQueue(Message msg)
msg
- - message adding to a queuepublic Vector getMessage(long time)
time
- - message receive time which want to take out from the queue
private void setCommType(int commType)
commType
- - communication typeCommunicationsSystem
public void startupSendLink()
public void shutdownSendLink()
public void startupReceiveLink()
public void shutdownReceiveLink()
public void enableBroadcast()
public void disableBroadcast()
public void enableP2P()
public void disableP2P()
public boolean isSendLinkEnabled()
public boolean isReceiveLinkEnabled()
public boolean isBroadcastEnabled()
public boolean isP2PEnabled()
public int getRange()
public boolean isSendBroadcastEnabled()
public boolean isReceiveBroadcastEnabled()
public boolean isSendP2PEnabled()
public boolean isReceiveP2PEnabled()
public boolean addRobotParameters(RobotParameters robot)
robot
- - robot parameter adding to the vector
private RobotParameters getRobotParameters(String name)
name
- - robot name
public String getName()
public int getDelay(String name)
name
- - robot name
public int getDeliveryProb(String name)
name
- - robot name
public void setRange(int range)
range
- - maximum rnage limitpublic void setDelay(String name, int delay)
name
- - robot namedelay
- - delay timepublic void setDeliveryProb(String name, int prob)
name
- - robot nameprob
- - delivery probability
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |