<commit_before>package com.tagmycode.plugin.gui;

import javax.swing.*;
import java.awt.*;

public class CenterLocation {
    private int x;
    private int y;

    public CenterLocation(Frame frame, JDialog dialog) {
        int width;
        int height;
        int offsetX = 0;
        int offsetY = 0;

        if (frame == null) {
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            width = (int) screenSize.getWidth();
            height = (int) screenSize.getHeight();
        } else {
            width = frame.getWidth();
            height = frame.getHeight();
            offsetX = frame.getX();
            offsetY = frame.getY();
        }
        x = offsetX + (width / 2) - (dialog.getWidth() / 2);
        y = offsetY + (height / 2) - (dialog.getHeight() / 2);
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }
}<commit_msg>CenterLocation parameter for center screen/frame<commit_after>package com.tagmycode.plugin.gui;

import javax.swing.*;
import java.awt.*;

enum CenterLocationType {
    CENTER_FRAME,
    CENTER_SCREEN
}

public class CenterLocation {
    private static CenterLocationType centerType = CenterLocationType.CENTER_FRAME;
    private int x;
    private int y;

    public CenterLocation(Frame frame, JDialog dialog) {
        int width;
        int height;
        int offsetX = 0;
        int offsetY = 0;

        if (frame == null || centerType == CenterLocationType.CENTER_SCREEN) {
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            width = (int) screenSize.getWidth();
            height = (int) screenSize.getHeight();
        } else {
            width = frame.getWidth();
            height = frame.getHeight();
            offsetX = frame.getX();
            offsetY = frame.getY();
        }
        x = offsetX + (width / 2) - (dialog.getWidth() / 2);
        y = offsetY + (height / 2) - (dialog.getHeight() / 2);
    }

    public static void setCenterType(CenterLocationType centerType) {
        CenterLocation.centerType = centerType;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }
}
{'fraction_non_alphanumeric': 0.11260655002243158, 'fraction_numerical': 0.005383580080753701, 'mean_word_length': 2.017591339648173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4151359', 'n_tokens_mistral': 656, 'n_tokens_neox': 637, 'n_words': 168}