<commit_before>package com.peta2kuba.pa165_haunted_houses.service_layer.service;

import com.peta2kuba.pa165_haunted_houses.dao.HaunterDao;
import com.peta2kuba.pa165_haunted_houses.dao.HouseDao;
import com.peta2kuba.pa165_haunted_houses.entity.Haunter;
import com.peta2kuba.pa165_haunted_houses.entity.HauntingHours;
import com.peta2kuba.pa165_haunted_houses.entity.House;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Time;
import java.util.List;

/**
 * Implementation of the {@link com.peta2kuba.pa165_haunted_houses.service_layer.service.HouseService}. This class is part of the
 * service module of the application that provides the implementation of the
 * business logic.
 *
 * @author skornok on 24/11/15.
 */
@Service
public class HouseServiceImpl implements HouseService {

	@Autowired
	private HouseDao houseDao;

	@Autowired
	private HaunterDao haunterDao;

	@Override
	public void createHouse(final House house) {
		houseDao.create(house);
	}

	@Override
	public void editHouse(final House house) {
		houseDao.edit(house);
	}

	@Override
	public void removeHouse(final House house) {
		houseDao.remove(house);
	}

	@Override
	public House findById(final Long id) {
		return houseDao.findById(id);
	}

	@Override
	public List<House> findAll() {
		return houseDao.findAll();
	}

	@Override
	public List<Haunter> findHaunters() {
		return houseDao.findHaunters();
	}

	@Override
	public boolean exorcism(final Haunter haunter) {
		List<Haunter> haunters = houseDao.findHaunters();
		if (haunters != null && haunters.contains(haunter)) {
			Time now = new Time(System.currentTimeMillis());
			HauntingHours hh = haunter.getHauntingHours();

			// If I'm performing exorcism when the haunter is present, kill it! Kill it with fire!!!
			if (hh.getFromTime().before(hh.getToTime())) {
				if (now.after(hh.getFromTime()) && now.before(hh.getToTime())) {
					return removeHaunter(haunter);
				}
			} else {		// Haunter is not at work at the time? Nothing happens, come again another time.
				if (now.before(hh.getFromTime()) && now.after(hh.getToTime())) {
					return removeHaunter(haunter);
				}
			}
		}

		return false;
	}

	private boolean removeHaunter(Haunter h) {
		haunterDao.remove(h);

		return true;
	}
}<commit_msg>conflict error repaired<commit_after>package com.peta2kuba.pa165_haunted_houses.service_layer.service;

import com.peta2kuba.pa165_haunted_houses.dao.HaunterDao;
import com.peta2kuba.pa165_haunted_houses.dao.HouseDao;
import com.peta2kuba.pa165_haunted_houses.entity.Haunter;
import com.peta2kuba.pa165_haunted_houses.entity.HauntingHours;
import com.peta2kuba.pa165_haunted_houses.entity.House;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Time;
import java.util.List;

/**
 * Implementation of the
 * {@link com.peta2kuba.pa165_haunted_houses.service_layer.service.HouseService}.
 * This class is part of the service module of the application that provides the
 * implementation of the business logic.
 *
 * @author skornok on 24/11/15.
 */
@Service
public class HouseServiceImpl implements HouseService {

    @Autowired
    private HouseDao houseDao;

    @Autowired
    private HaunterDao haunterDao;

    @Override
    public void createHouse(final House house) {
        houseDao.create(house);
    }

    @Override
    public void editHouse(final House house) {
        houseDao.edit(house);
    }

    @Override
    public void removeHouse(final House house) {
        houseDao.remove(house);
    }

    @Override
    public House findById(final Long id) {
        return houseDao.findById(id);
    }

    @Override
    public List<House> findAll() {
        return houseDao.findAll();
    }

    @Override
    public List<Haunter> findHaunters() {
        return houseDao.findHaunters();
    }

    @Override
    public boolean exorcism(House house, final Haunter haunter, Time exorcismTime) {
        if ((house != null && haunter != null) && exorcismTime != null) {
            List<Haunter> haunters = house.getHaunters();
            if (haunters != null && haunters.contains(haunter)) {
                HauntingHours hh = haunter.getHauntingHours();

                // If I'm performing exorcism when the haunter is present, kill it! Kill it with fire!!!
                if (hh.getFromTime().before(hh.getToTime())) {
                    if (exorcismTime.after(hh.getFromTime()) && exorcismTime.before(hh.getToTime())) {
                        return removeHaunter(haunter);
                    }
                } else {
                    if (!(exorcismTime.before(hh.getFromTime()) && exorcismTime.after(hh.getToTime()))) {
                        return removeHaunter(haunter);
                    }
                }
            }
        }
        return false;
    }

    private boolean removeHaunter(Haunter h) {
        haunterDao.remove(h);
        return true;
    }
}
{'fraction_non_alphanumeric': 0.1032, 'fraction_numerical': 0.0136, 'mean_word_length': 3.3074935400516794, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5716476', 'n_tokens_mistral': 1708, 'n_tokens_neox': 1591, 'n_words': 343}