cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus/src/main/java/org/cloudbus/cloudsim/schedulers/cloudlet/network/PacketSchedulerSimple.java
private void receivePackets(NetworkCloudlet sourceCloudlet) {
        final CloudletReceiveTask task = (CloudletReceiveTask)sourceCloudlet.getCurrentTask();
        final List<VmPacket> receivedPkts = getPacketsSentToGivenTask(task);
        // Asumption: packet will not arrive in the same cycle
        receivedPkts.forEach(task::receivePacket);
        receivedPkts.forEach(pkt ->
            Log.println(
                Log.Level.DEBUG, getClass(), sourceCloudlet.getSimulation().clock(),
                "Cloudlet %d in VM %d received pkt with %d bytes from Cloudlet %d in VM %d",
                pkt.getReceiverCloudlet().getId(),
                pkt.getDestination().getId(),
                pkt.getSize(),
                pkt.getSenderCloudlet().getId(),
                pkt.getSource().getId())
        );

        /*Removes the received packets from the list of sent packets of the VM,
        to indicate they were in fact received and have to be removed
        from the list of the sender VM*/
        getListOfPacketsSentFromVm(task.getSourceVm()).removeAll(receivedPkts);

        /**
         * @todo @author manoelcampos The task has to wait the reception
         * of the expected packets up to a given timeout.
         * After that, the task has to stop waiting and fail.
         */
        scheduleNextTaskIfCurrentIsFinished(sourceCloudlet);
    }
/**
     * Check for packets to be received by a given cloudlet
     * and deliver them to it.
     *
     * @param sourceCloudlet cloudlet to check if there are packets to be received from.
     */
Check for packets to be received by a given cloudlet
and deliver them to it.

@param sourceCloudlet cloudlet to check if there are packets to be received from.
Check for packets to be received by a given cloudlet and deliver them to it . @param sourceCloudlet cloudlet to check if there are packets to be received from .
private void receivePackets(NetworkCloudlet sourceCloudlet) {
        final CloudletReceiveTask task = (CloudletReceiveTask)sourceCloudlet.getCurrentTask();
        final List<VmPacket> receivedPkts = getPacketsSentToGivenTask(task);
        receivedPkts.forEach(task::receivePacket);
        receivedPkts.forEach(pkt ->
            Log.println(
                Log.Level.DEBUG, getClass(), sourceCloudlet.getSimulation().clock(),
                "Cloudlet %d in VM %d received pkt with %d bytes from Cloudlet %d in VM %d",
                pkt.getReceiverCloudlet().getId(),
                pkt.getDestination().getId(),
                pkt.getSize(),
                pkt.getSenderCloudlet().getId(),
                pkt.getSource().getId())
        );
        /*Removes the received packets from the list of sent packets of the VM,
        to indicate they were in fact received and have to be removed
        from the list of the sender VM*/
        getListOfPacketsSentFromVm(task.getSourceVm()).removeAll(receivedPkts);
        /**
         * @todo @author manoelcampos The task has to wait the reception
         * of the expected packets up to a given timeout.
         * After that, the task has to stop waiting and fail.
         */
        scheduleNextTaskIfCurrentIsFinished(sourceCloudlet);
    }
private void receivePackets ( NetworkCloudlet sourceCloudlet ) { final CloudletReceiveTask task = ( CloudletReceiveTask ) sourceCloudlet . getCurrentTask ( ) ; final List < VmPacket > receivedPkts = getPacketsSentToGivenTask ( task ) ; receivedPkts . forEach ( task :: receivePacket ) ; receivedPkts . forEach ( pkt -> Log . println ( Log . Level . DEBUG , getClass ( ) , sourceCloudlet . getSimulation ( ) . clock ( ) , "Cloudlet %d in VM %d received pkt with %d bytes from Cloudlet %d in VM %d" , pkt . getReceiverCloudlet ( ) . getId ( ) , pkt . getDestination ( ) . getId ( ) , pkt . getSize ( ) , pkt . getSenderCloudlet ( ) . getId ( ) , pkt . getSource ( ) . getId ( ) ) ) ; /*Removes the received packets from the list of sent packets of the VM,
        to indicate they were in fact received and have to be removed
        from the list of the sender VM*/ getListOfPacketsSentFromVm ( task . getSourceVm ( ) ) . removeAll ( receivedPkts ) ; /**
         * @todo @author manoelcampos The task has to wait the reception
         * of the expected packets up to a given timeout.
         * After that, the task has to stop waiting and fail.
         */ scheduleNextTaskIfCurrentIsFinished ( sourceCloudlet ) ; }
Check for packets to be received by a given cloudlet
 and deliver them to it.
Check for packets to be received by a given cloudlet and deliver them to it .
// Asumption: packet will not arrive in the same cycle