Projects >> emergency-service-drools-app >>6c9d74826845d88ce7e51c5558bc7cff0aa044c6

Chunk
Conflicting content
    private List graphicableVehicles;
    private Vehicle activeVehicle;
    private Map vehicles;
<<<<<<< HEAD
    private GraphicableHighlightedHospital selectedHospital;
=======
>>>>>>> bc4c2cd4a8cca0febdd1a81d622ed5145a71e542
    private boolean turbo;

    public ParticularEmergencyRenderer(WorldUI ui, GraphicableEmergency emergency) {
Solution content
    private List graphicableVehicles;
    private Vehicle activeVehicle;
    private Map vehicles;
    private GraphicableHighlightedHospital selectedHospital;
    private boolean turbo;

    public ParticularEmergencyRenderer(WorldUI ui, GraphicableEmergency emergency) {
File
ParticularEmergencyRenderer.java
Developer's decision
Version 1
Kind of conflict
Attribute
Chunk
Conflicting content
        if (this.activeGraphicableVehicle == null) {
            return false;
        }
<<<<<<< HEAD
        if (this.selectedHospital == null) {
            return false;
        }
        if (this.activeGraphicableVehicle.getPolygon().intersects(selectedHospital.getPolygon())) {
            try {
                System.out.println("Hospital REACHED!");
                MessageFactory.sendMessage(new VehicleHitsHospitalMessage(this.activeVehicle.getId(), selectedHospital.getHospital(), this.emergency.getCallId(), new Date()));
            } catch (HornetQException ex) {
                Logger.getLogger(ParticularEmergencyRenderer.class.getName()).log(Level.SEVERE, null, ex);
            }
            return true;
        }
        return false;


=======

        Block collidesWith = null;
        for (int i = 0; i < BlockMap.hospitals.size(); i++) {
            Block entity1 = (Block) BlockMap.hospitals.get(i);
            if (this.activeGraphicableVehicle.getPolygon().intersects(entity1.poly)) {
                collidesWith = entity1;
                break;
            }
        }

        boolean collides = collidesWith != null;

        if (collides && !this.activeGraphicableVehicle.isIsCollidingWithAHospital()) {
            //TODO: add custom code. Maybe we should notify the ui about it
            //and not add a message to the queue here
            System.out.println("HOSPITAL REACHED!");
        }

        this.activeGraphicableVehicle.setIsCollidingWithAHospital(collides);


        return collides;
>>>>>>> bc4c2cd4a8cca0febdd1a81d622ed5145a71e542
    }

    public boolean checkCornerCollision() {
Solution content
        if (this.activeGraphicableVehicle == null) {
            return false;
        }

        Block collidesWith = null;
        for (int i = 0; i < BlockMap.hospitals.size(); i++) {
            Block entity1 = (Block) BlockMap.hospitals.get(i);
            if (this.activeGraphicableVehicle.getPolygon().intersects(entity1.poly)) {
                collidesWith = entity1;
                break;
            }
        }

        boolean collides = collidesWith != null;

        if (collides && !this.activeGraphicableVehicle.isIsCollidingWithAHospital()) {
            //TODO: add custom code. Maybe we should notify the ui about it
            //and not add a message to the queue here
            System.out.println("HOSPITAL REACHED!");
        }

        this.activeGraphicableVehicle.setIsCollidingWithAHospital(collides);


        return collides;
    }

    public boolean checkCornerCollision() {
File
ParticularEmergencyRenderer.java
Developer's decision
Version 2
Kind of conflict
For statement
If statement
Method invocation
Return statement
Variable
Chunk
Conflicting content
            } catch (HornetQException ex) {
        if (collides && !this.activeGraphicableVehicle.isIsCollidingWithACorner()) {
            try {
                System.out.println("CORNER REACHED!");
<<<<<<< HEAD
                MessageFactory.sendMessage(new VehicleHitsCornerMessage(this.activeVehicle.getId(), (int) collidesWith.poly.getX(), (int) collidesWith.poly.getY()));
=======
                MessageFactory.sendMessage(new VehicleHitsCornerMessage(this.emergency.getCallId(), this.activeVehicle.getId(), (int) collidesWith.poly.getX(), (int) collidesWith.poly.getY()));
>>>>>>> bc4c2cd4a8cca0febdd1a81d622ed5145a71e542
                Logger.getLogger(ParticularEmergencyRenderer.class.getName()).log(Level.SEVERE, null, ex);
            }
Solution content
        if (collides && !this.activeGraphicableVehicle.isIsCollidingWithACorner()) {
            try {
                System.out.println("CORNER REACHED!");
                MessageFactory.sendMessage(new VehicleHitsCornerMessage(this.emergency.getCallId(), this.activeVehicle.getId(), (int) collidesWith.poly.getX(), (int) collidesWith.poly.getY()));
            } catch (HornetQException ex) {
                Logger.getLogger(ParticularEmergencyRenderer.class.getName()).log(Level.SEVERE, null, ex);
            }
File
ParticularEmergencyRenderer.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
<<<<<<< HEAD
        this.ui.assignVehicleToEmergency(this.emergency.getCallId(), policeCar);
    }
    private void selectMockHospital(Long hospitalId) {
        Hospital mock = DistributedPeristenceServerService.getInstance().loadHospital(hospitalId);
        selectHospital(mock);
=======
    private void sendHeartBeat(int pulse) {
        //only if the active vehicle is an ambulance
        if (this.activeGraphicableVehicle == null || !(this.activeGraphicableVehicle instanceof GraphicableAmbulance)){
            return;
        }
        
        pulse += 235;
        try {
            this.activeGraphicableVehicle.setAlreadyHitAnEmergency(true);
            MessageFactory.sendMessage(new HeartBeatMessage(this.emergency.getCallId(), this.activeVehicle.getId(), pulse, new Date()));
        } catch (HornetQException ex) {
            Logger.getLogger(ParticularEmergencyRenderer.class.getName()).log(Level.SEVERE, null, ex);
        }
>>>>>>> bc4c2cd4a8cca0febdd1a81d622ed5145a71e542
    }
}
Solution content
        this.ui.assignVehicleToEmergency(this.emergency.getCallId(), policeCar);
    }

    private void sendHeartBeat(int pulse) {
        //only if the active vehicle is an ambulance
        if (this.activeGraphicableVehicle == null || !(this.activeGraphicableVehicle instanceof GraphicableAmbulance)){
            return;
        }
        
        pulse += 235;
        try {
            this.activeGraphicableVehicle.setAlreadyHitAnEmergency(true);
            MessageFactory.sendMessage(new HeartBeatMessage(this.emergency.getCallId(), this.activeVehicle.getId(), pulse, new Date()));
        } catch (HornetQException ex) {
            Logger.getLogger(ParticularEmergencyRenderer.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void selectMockHospital(long l) {
        Hospital mock = DistributedPeristenceServerService.getInstance().loadHospital(l);
        selectHospital(mock);
    }
}
File
ParticularEmergencyRenderer.java
Developer's decision
Manual
Kind of conflict
Comment
If statement
Method invocation
Method signature
Try statement
Variable