|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
de.upb.swtpra.kernel.Agent
de.upb.swtpra.kernel.ShuttleAgentBase
de.upb.swtpra05.group03.shuttle.ShuttleControl
Represents the shuttle by extending ShuttleAgentBase, forwards
all received messages to all ShuttleModules and controls the
states of the orders.
| Field Summary | |
private CryptoMessagesHandlerInterface |
cryptoMsgHandler
this class encrypts all messages to the company control and decrypts all messages received from them |
(package private) static java.util.logging.Logger |
log
Define a static logger variable to output logmessages |
private de.upb.swtpra.kernel.id.KernelID |
myKernelID
The ID of the kernel |
private boolean |
running
Flag to control the shuttles status |
private java.util.LinkedList |
sendQueue
Queue of outgoing Messages which coudln't be sent by the time they were supposed to |
private java.util.List |
sentModules
A Collection containing all SentModules |
private java.util.List |
shuttleModules
A Collection containing all ShuttleModules |
| Fields inherited from class de.upb.swtpra.kernel.ShuttleAgentBase |
|
| Fields inherited from class de.upb.swtpra.kernel.Agent |
|
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
ShuttleControl(de.upb.swtpra.kernel.id.KernelID id)
Constructor of ShuttleControl |
|
| Method Summary | |
private void |
deliverToSentModules(de.upb.swtpra.kernel.message.Message msg)
Delivers a Message to any SentModule. |
private void |
deliverToShuttleModules(de.upb.swtpra.kernel.message.Message msg)
Delivers a Message to any ShuttleModule. |
private void |
gameConstants(de.upb.swtpra.kernel.message.GameConstantsMessage msg)
Sets the size of the company the shuttle is member of and gets if needed the associates |
de.upb.swtpra.kernel.id.ID |
getMyAgentID()
Forwards the method getAgentID() from ShuttleAgentBase |
de.upb.swtpra.kernel.id.ID |
getMyBankingAgentID()
Forwards the method getBankingAgentID() from ShuttleAgentBase |
de.upb.swtpra.kernel.id.ID |
getMyBrokerAgentID()
Forwards the method getBrokerID() from ShuttleAgentBase |
de.upb.swtpra.kernel.id.ID |
getMyKernelID()
Gets the KernelID attribute of the ShuttleControl object |
void |
init(ModuleContainerInterface container)
Initializes this module. |
private java.util.LinkedList |
makeShuttleReady()
Initalizes the shuttle so that the shuttle is ready. |
void |
newMessageReceived(de.upb.swtpra.kernel.message.Message msg)
Delivers a new Message to ShuttleModule. |
void |
run()
Main processing method for the ShuttleControl object which especially inherits from Thread |
void |
sendMessage(de.upb.swtpra.kernel.message.Message msg)
helper to send messages out call this instead of sendNextMessage() |
private void |
sendQueuedMessages()
Tries to send all Messages which couldn't be sent by the time they were supposed to. |
private static void |
sendToBed(long time)
Lets the shuttle sleep for the specified period of time or till an InterruptedException is thrown |
| Methods inherited from class de.upb.swtpra.kernel.ShuttleAgentBase |
getBankingAgentID, getBrokerID, getCompanyLogin, getCompanyPassword, getTopologyID, receive, register, sendNextMessage |
| Methods inherited from class de.upb.swtpra.kernel.Agent |
getAgentID, getNextMessage, isMessageAvailable, send, setAgentID |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
static final java.util.logging.Logger log
private de.upb.swtpra.kernel.id.KernelID myKernelID
private boolean running
private java.util.List shuttleModules
ShuttleModules
private java.util.List sentModules
SentModules
private java.util.LinkedList sendQueue
private CryptoMessagesHandlerInterface cryptoMsgHandler
| Constructor Detail |
public ShuttleControl(de.upb.swtpra.kernel.id.KernelID id)
id - The ID of the Kernel| Method Detail |
public void init(ModuleContainerInterface container)
Module
init in interface Modulecontainer - The module manager which contain all modulespublic void run()
run in interface java.lang.Runnableprivate void deliverToShuttleModules(de.upb.swtpra.kernel.message.Message msg)
ShuttleModule.
msg - The Message to deliverprivate void deliverToSentModules(de.upb.swtpra.kernel.message.Message msg)
SentModule.
msg - The Message to deliverpublic void newMessageReceived(de.upb.swtpra.kernel.message.Message msg)
newMessageReceived in interface ShuttleModulemsg - The Message to deliverprivate java.util.LinkedList makeShuttleReady()
private void sendQueuedMessages()
private void gameConstants(de.upb.swtpra.kernel.message.GameConstantsMessage msg)
msg - The received GameConstantsMessageprivate static void sendToBed(long time)
time - The time the shuttle should sleeppublic void sendMessage(de.upb.swtpra.kernel.message.Message msg)
sendMessage in interface ShuttleControlInterfacemsg - message to sendpublic de.upb.swtpra.kernel.id.ID getMyAgentID()
getMyAgentID in interface ShuttleControlInterfacepublic de.upb.swtpra.kernel.id.ID getMyBankingAgentID()
getMyBankingAgentID in interface ShuttleControlInterfacepublic de.upb.swtpra.kernel.id.ID getMyBrokerAgentID()
getMyBrokerAgentID in interface ShuttleControlInterfacepublic de.upb.swtpra.kernel.id.ID getMyKernelID()
getMyKernelID in interface ShuttleControlInterface
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||