Skip to content
Snippets Groups Projects
Commit 245ebf9d authored by Terry D. Norbraten's avatar Terry D. Norbraten
Browse files

minimize object creation in loops

parent f33042aa
No related branches found
No related tags found
No related merge requests found
...@@ -50,17 +50,19 @@ public class EspduReceiver ...@@ -50,17 +50,19 @@ public class EspduReceiver
// Loop infinitely, receiving datagrams // Loop infinitely, receiving datagrams
EntityID eid; EntityID eid;
Vector3Double position; Vector3Double position;
Iterator<Pdu> it;
Pdu aPdu;
while (true) { while (true) {
socket.receive(packet); socket.receive(packet);
pduBundle = pduFactory.getPdusFromBundle(packet.getData(),packet.getLength()); pduBundle = pduFactory.getPdusFromBundle(packet.getData(), packet.getLength());
//System.out.println("Bundle size is " + pduBundle.size()); //System.out.println("Bundle size is " + pduBundle.size());
Iterator<Pdu> it = pduBundle.iterator(); it = pduBundle.iterator();
while (it.hasNext()) { while (it.hasNext()) {
Pdu aPdu = it.next(); aPdu = it.next();
System.out.print("got PDU of type: " + aPdu.getClass().getName()); System.out.print("got PDU of type: " + aPdu.getClass().getName());
if (aPdu instanceof EntityStatePdu) { if (aPdu instanceof EntityStatePdu) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment