Package de.tudresden.sumo.util
Class Query
java.lang.Object
de.tudresden.sumo.util.Observable
de.tudresden.sumo.util.Query
- Direct Known Subclasses:
CloseQuery
,CommandProcessor
The Class Query.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doClose()
Disconnect client from the sumo server.protected ResponseMessage
doQuery
(RequestMessage msg) Sends a request message to SUMO and returns a response message.protected ResponseContainer
doQuerySingle
(Command request) LikedoQuery(RequestMessage)
, but good for one-command/ one-response queries.protected void
doSetOrder
(int index) Set multi-client ordering index.protected void
doSimulationStep
(double targetTime) Do next time step and update subscription results.protected void
fireAndForget
(Command request) fireAndForget function.Gets the out stream.protected ResponseMessage
queryAndVerify
(RequestMessage reqMsg) LikedoQuery(RequestMessage)
; in addition, verifies that all responses are successful and and the statuses match the requests.protected ResponseContainer
queryAndVerifySingle
(Command request) LikequeryAndVerify(RequestMessage)
, but good for one-command/ one-response queries.protected static void
Verify.protected static void
Verify.protected static void
Verify.protected static String
verifyGetVarResponse
(Command resp, int commandID, int variable, String objectID) Verify get var response.Methods inherited from class de.tudresden.sumo.util.Observable
addObserver, notifyObservers
-
Constructor Details
-
Query
Instantiates a new query.- Parameters:
sock
- the sock- Throws:
IOException
- Signals that an I/O exception has occurred.
-
-
Method Details
-
doQuery
Sends a request message to SUMO and returns a response message.- Parameters:
msg
- the msg- Returns:
- the response message
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
queryAndVerify
LikedoQuery(RequestMessage)
; in addition, verifies that all responses are successful and and the statuses match the requests.- Parameters:
reqMsg
- the req msg- Returns:
- the verified response message
- Throws:
IOException
- Signals that an I/O exception has occurred.- See Also:
-
doQuerySingle
LikedoQuery(RequestMessage)
, but good for one-command/ one-response queries.- Parameters:
request
- the request- Returns:
- the response container
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
doSetOrder
Set multi-client ordering index.- Parameters:
index
- the index- Throws:
IOException
- Signals that an I/O exception has occurred.
-
doClose
Disconnect client from the sumo server.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
doSimulationStep
Do next time step and update subscription results.- Parameters:
targetTime
- the target time- Throws:
IOException
- Signals that an I/O exception has occurred.
-
queryAndVerifySingle
LikequeryAndVerify(RequestMessage)
, but good for one-command/ one-response queries.- Parameters:
request
- the request- Returns:
- the response container for the specified request
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
fireAndForget
fireAndForget function.- Parameters:
request
- the request
-
verifyGetVarResponse
protected static String verifyGetVarResponse(Command resp, int commandID, int variable, String objectID) throws TraCIException.UnexpectedData Verify get var response.- Parameters:
resp
- the respcommandID
- the command IDvariable
- the variableobjectID
- the object ID- Returns:
- the string
- Throws:
TraCIException.UnexpectedData
- the unexpected data
-
verify
protected static void verify(String description, Object expected, Object actual) throws TraCIException.UnexpectedData Verify.- Parameters:
description
- the descriptionexpected
- the expectedactual
- the actual- Throws:
TraCIException.UnexpectedData
- the unexpected data
-
verify
protected static void verify(String description, int expected, short actual) throws TraCIException.UnexpectedData Verify.- Parameters:
description
- the descriptionexpected
- the expectedactual
- the actual- Throws:
TraCIException.UnexpectedData
- the unexpected data
-
verify
protected static void verify(String description, int expected, byte actual) throws TraCIException.UnexpectedData Verify.- Parameters:
description
- the descriptionexpected
- the expectedactual
- the actual- Throws:
TraCIException.UnexpectedData
- the unexpected data
-
getOutStream
Gets the out stream.- Returns:
- the out stream
-