<commit_before>// CollisionController.java

package de.htwg.battleship.controller.impl;

import de.htwg.battleship.model.IShip;
import de.htwg.battleship.util.StatCollection;

/**
 * Controller for checking if ship collides.
 * use the Chain-of-Responsibility-Pattern
 * @author <NAME> (<EMAIL>)
 * @version 1.00
 * @since 2014-12-04
 */
public abstract class CollisionController {

    /**
     * Orientation of the first ship.
     * indicates the responsibility of the Controller implementation
     */
    boolean firstShip;
    /**
     * Orientation of the second ship.
     * indicates the responsibility of the Controller implementation
     */
    boolean secondShip;

    /**
     * Next Controller implementation of the chain.
     */
    CollisionController next;

    public abstract boolean isCollision(IShip shipIn, IShip ship);

    public final boolean responsibility(final IShip shipIn, final IShip ship) {
        if ((shipIn.isOrientation() == firstShip)
                && (ship.isOrientation() == secondShip)) {
            return isCollision(shipIn, ship);
        }
        return next.responsibility(shipIn, ship);
    }
}

/**
 * Controller implementation for both ship orientations equals true.
 * @author <NAME> (<EMAIL>)
 */<commit_msg>added comments<commit_after>// CollisionController.java

package de.htwg.battleship.controller.impl;

import de.htwg.battleship.model.IShip;
import de.htwg.battleship.util.StatCollection;

/**
 * Controller for checking if ship collides.
 * use the Chain-of-Responsibility-Pattern
 * @author <NAME> (<EMAIL>)
 * @version 1.00
 * @since 2014-12-04
 */
public abstract class CollisionController {

    /**
     * Orientation of the first ship.
     * indicates the responsibility of the Controller implementation
     */
    boolean firstShip;
    /**
     * Orientation of the second ship.
     * indicates the responsibility of the Controller implementation
     */
    boolean secondShip;

    /**
     * Next Controller implementation of the chain.
     */
    CollisionController next;

    /**
     * Method to test if the two ship collides.
     * @param shipIn ship one
     * @param ship ship two
     * @return true if there is a collision
     *         false if not
     */
    public abstract boolean isCollision(IShip shipIn, IShip ship);

    /**
     * Method to search who is responsible for the case in the chain.
     * @param shipIn first ship
     * @param ship second ship
     * @return true if there is a collision
     *         false if not
     */
    public final boolean responsibility(final IShip shipIn, final IShip ship) {
        if ((shipIn.isOrientation() == firstShip)
                && (ship.isOrientation() == secondShip)) {
            return isCollision(shipIn, ship);
        }
        return next.responsibility(shipIn, ship);
    }
}

/**
 * Controller implementation for both ship orientations equals true.
 * @author <NAME> (<EMAIL>)
 */
{'fraction_non_alphanumeric': 0.09640190088255261, 'fraction_numerical': 0.00746775288526816, 'mean_word_length': 2.711586901763224, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '833949', 'n_tokens_mistral': 841, 'n_tokens_neox': 802, 'n_words': 261}