<commit_before>package hu.kazocsaba.imageviewer;

import java.applet.Applet;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Window;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent;
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.swing.CellRendererPane;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.MouseInputListener;

/**
 * The component that displays the image itself.
 * @author <NAME>
 */
class ImageComponent extends JComponent {
	private ResizeStrategy resizeStrategy = ResizeStrategy.SHRINK_TO_FIT;
	private BufferedImage image;
	private boolean pixelatedZoom=false;
	private Object interpolationType=RenderingHints.VALUE_INTERPOLATION_BICUBIC;
	private double zoomFactor=1;
	private final List<ImageMouseMotionListener> moveListeners = new ArrayList<ImageMouseMotionListener>(4);
	private final List<ImageMouseClickListener> clickListeners = new ArrayList<ImageMouseClickListener>(4);
	private final MouseEventTranslator mouseEventTranslator = new MouseEventTranslator();
	private final PaintManager paintManager = new PaintManager();
	
	/* Handles repositioning the scroll pane when the image is resized so that the same area remains visible. */
	class Rescroller {
		private Point2D preparedCenter=null;
		
		void prepare() {
			if (image!=null && hasSize()) {
				Rectangle viewRect=scrollPane.getViewport().getViewRect();
				preparedCenter=new Point2D.Double(viewRect.getCenterX(), viewRect.getCenterY());
				try {
					getImageTransform().inverseTransform(preparedCenter, preparedCenter);
				} catch (NoninvertibleTransformException e) {
					throw new Error(e);
				}
			}
		}

		void rescroll() {
			if (preparedCenter!=null) {
				Dimension viewSize=scrollPane.getViewport().getExtentSize();
				getImageTransform().transform(preparedCenter, preparedCenter);
				Rectangle view = new Rectangle((int)Math.round(preparedCenter.getX()-viewSize.width/2.0), (int)Math.round(preparedCenter.getY()-viewSize.height/2.0), viewSize.width, viewSize.height);
				preparedCenter=null;
				scrollRectToVisible(view);
			}
		}
		
	}
	private Rescroller rescroller=new Rescroller();
	
	/**
	 * This set is shared by all synchronized image components and contains all
	 * synchronized image components. Unless there is no synchronization; then it is null.
	 */
	private Set<ImageComponent> trackSizeIfEmpty = null;
	
	private final PropertyChangeSupport propertyChangeSupport;
	private final Object eventSource;
	private final JScrollPane scrollPane;

	public ImageComponent(Object eventSource, PropertyChangeSupport propertyChangeSupport, JScrollPane scrollPane) {
		this.eventSource = eventSource;
		this.propertyChangeSupport=propertyChangeSupport;
		this.scrollPane=scrollPane;
		mouseEventTranslator.register(this);
		setOpaque(true);
		scrollPane.getViewport().addChangeListener(new ChangeListener() {

			@Override
			public void stateChanged(ChangeEvent e) {
				System.out.println("Scroll viewport changed");
				mouseEventTranslator.correctionalFire();
			}
		});
	}
	<commit_msg>Left in a debug message by accident.<commit_after>package hu.kazocsaba.imageviewer;

import java.applet.Applet;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Window;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent;
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.swing.CellRendererPane;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.MouseInputListener;

/**
 * The component that displays the image itself.
 * @author <NAME>
 */
class ImageComponent extends JComponent {
	private ResizeStrategy resizeStrategy = ResizeStrategy.SHRINK_TO_FIT;
	private BufferedImage image;
	private boolean pixelatedZoom=false;
	private Object interpolationType=RenderingHints.VALUE_INTERPOLATION_BICUBIC;
	private double zoomFactor=1;
	private final List<ImageMouseMotionListener> moveListeners = new ArrayList<ImageMouseMotionListener>(4);
	private final List<ImageMouseClickListener> clickListeners = new ArrayList<ImageMouseClickListener>(4);
	private final MouseEventTranslator mouseEventTranslator = new MouseEventTranslator();
	private final PaintManager paintManager = new PaintManager();
	
	/* Handles repositioning the scroll pane when the image is resized so that the same area remains visible. */
	class Rescroller {
		private Point2D preparedCenter=null;
		
		void prepare() {
			if (image!=null && hasSize()) {
				Rectangle viewRect=scrollPane.getViewport().getViewRect();
				preparedCenter=new Point2D.Double(viewRect.getCenterX(), viewRect.getCenterY());
				try {
					getImageTransform().inverseTransform(preparedCenter, preparedCenter);
				} catch (NoninvertibleTransformException e) {
					throw new Error(e);
				}
			}
		}

		void rescroll() {
			if (preparedCenter!=null) {
				Dimension viewSize=scrollPane.getViewport().getExtentSize();
				getImageTransform().transform(preparedCenter, preparedCenter);
				Rectangle view = new Rectangle((int)Math.round(preparedCenter.getX()-viewSize.width/2.0), (int)Math.round(preparedCenter.getY()-viewSize.height/2.0), viewSize.width, viewSize.height);
				preparedCenter=null;
				scrollRectToVisible(view);
			}
		}
		
	}
	private Rescroller rescroller=new Rescroller();
	
	/**
	 * This set is shared by all synchronized image components and contains all
	 * synchronized image components. Unless there is no synchronization; then it is null.
	 */
	private Set<ImageComponent> trackSizeIfEmpty = null;
	
	private final PropertyChangeSupport propertyChangeSupport;
	private final Object eventSource;
	private final JScrollPane scrollPane;

	public ImageComponent(Object eventSource, PropertyChangeSupport propertyChangeSupport, JScrollPane scrollPane) {
		this.eventSource = eventSource;
		this.propertyChangeSupport=propertyChangeSupport;
		this.scrollPane=scrollPane;
		mouseEventTranslator.register(this);
		setOpaque(true);
		scrollPane.getViewport().addChangeListener(new ChangeListener() {

			@Override
			public void stateChanged(ChangeEvent e) {
				mouseEventTranslator.correctionalFire();
			}
		});
	}
	
{'fraction_non_alphanumeric': 0.09242093784078517, 'fraction_numerical': 0.0029989094874591058, 'mean_word_length': 5.7622119815668205, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2979048', 'n_tokens_mistral': 2267, 'n_tokens_neox': 2070, 'n_words': 481}