<commit_before>package models;

import java.awt.image.BufferedImage;

/**
 * Description : Classe permettant de g�n�rer un tableau avec les morceaux de l'image
 * 
 * @author <NAME>
 * @author <NAME>
 *
 */
public class PictureParts {
	
	/**
	 * Picture used as reference to build all image parts
	 */
	private BufferedImage refImage;
	
	/**
	 * Parts of the pictures
	 */
	private BufferedImage[] parts;
	
	/**
	 * Constructor
	 * @param BufferedImage picture to split in parts
	 * @param xParts number of cols
	 * @param yParts number of rows
	 */
	public PictureParts(BufferedImage picture, int nbParts) {
		
		refImage = picture;
		nbParts = nbParts <= 0 || nbParts > 10 ? 2 : nbParts;
		
		parts = new BufferedImage[nbParts];
		
		init(nbParts);
	}
	
	
	/**
	 * Initialize internal data
	 * 
	 * @param int nbParts number parts
	 */
	protected void init(int nbParts) {
		
		int heightPart = (int) refImage.getHeight() / nbParts;
		
		int posTileY;
		
		for(int numTileY = 0 ; numTileY < nbParts ; numTileY++) {
			
			posTileY = heightPart * numTileY;
			
			/*System.out.println
			(
				"Params de l'image (" + this.buffPicture.getWidth() + "; " + this.buffPicture.getHeight() +") \n" +
				"Extraction de la Tile ("+ numTileX +"; "+ numTileY +") \n" +
				"Taille de la Tile (" + sizeWidth + "; " + sizeHeight + ")\n" +
				"Position de la Tile (" + posTileX +  "; " + posTileY + ")" +
				"Taille tableau (" + this.pieces.length + "; " + this.pieces + ")"
			);*/
			
			parts[numTileY] = refImage.getSubimage(0, posTileY, refImage.getWidth(), heightPart);
		}
	}
	
	
	/**
	 * Get a picture part, 
	 * @param x
	 * @param y
	 * @return
	 */
	public BufferedImage getPart(int x) {
		
		if (parts != null) {
			if (x > 0 && x < parts.length) { // rows range test
				return parts[x];
			}
		}
		return null;
	}
	
	/**
	 * Get all picture parts
	 * @return
	 */
	public BufferedImage[] getAllParts() {
		return parts;
	}
}
<commit_msg>Correction d'une boulette qui faisait planter l'ensemble<commit_after>package models;

import java.awt.image.BufferedImage;

/**
 * Description : Classe permettant de g�n�rer un tableau avec les morceaux de l'image
 * 
 * @author <NAME>
 * @author <NAME>
 *
 */
public class PictureParts {
	
	/**
	 * Picture used as reference to build all image parts
	 */
	private BufferedImage refImage;
	
	/**
	 * Parts of the pictures
	 */
	private BufferedImage[] parts;
	
	/**
	 * Constructor
	 * @param BufferedImage picture to split in parts
	 * @param xParts number of cols
	 * @param yParts number of rows
	 */
	public PictureParts(BufferedImage picture, int nbParts) {
		
		refImage = picture;
		nbParts = nbParts <= 0 || nbParts > 10 ? 2 : nbParts;
		
		parts = new BufferedImage[nbParts];
		
		init(nbParts);
	}
	
	
	/**
	 * Initialize internal data
	 * 
	 * @param int nbParts number parts
	 */
	protected void init(int nbParts) {
		
		int heightPart = (int) refImage.getHeight() / nbParts;
		
		int posTileY;
		
		for(int numTileY = 0 ; numTileY < nbParts ; numTileY++) {
			
			posTileY = heightPart * numTileY;
			
			/*System.out.println
			(
				"Params de l'image (" + this.buffPicture.getWidth() + "; " + this.buffPicture.getHeight() +") \n" +
				"Extraction de la Tile ("+ numTileX +"; "+ numTileY +") \n" +
				"Taille de la Tile (" + sizeWidth + "; " + sizeHeight + ")\n" +
				"Position de la Tile (" + posTileX +  "; " + posTileY + ")" +
				"Taille tableau (" + this.pieces.length + "; " + this.pieces + ")"
			);*/
			
			parts[numTileY] = refImage.getSubimage(0, posTileY, refImage.getWidth(), heightPart);
		}
	}
	
	
	/**
	 * Get a picture part, 
	 * @param x
	 * @param y
	 * @return
	 */
	public BufferedImage getPart(int x) {
		
		if (parts != null) {
			if (x >= 0 && x < parts.length) { // rows range test
				return parts[x];
			}
		}
		return null;
	}
	
	/**
	 * Get all picture parts
	 * @return
	 */
	public BufferedImage[] getAllParts() {
		return parts;
	}
}

{'fraction_non_alphanumeric': 0.14085583290881304, 'fraction_numerical': 0.003565970453387672, 'mean_word_length': 2.7578947368421054, 'pattern_counts': {'":': 0, '<': 13, '<?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': '5498138', 'n_tokens_mistral': 1567, 'n_tokens_neox': 1319, 'n_words': 366}