<commit_before>package org.genericsystem.ir.reinforcer;

public class Label {
	private final double tlx, tly, brx, bry;
	private final String label;

	public Label(double tlx, double tly, double brx, double bry, String label) {
		assert tlx < brx && tly < bry;
		this.tlx = tlx;
		this.tly = tly;
		this.brx = brx;
		this.bry = bry;
		this.label = label;
	}

	@Override
	public String toString() {
		return String.format("tl(%.1f, %.1f), br(%.1f, %.1f), %s", tlx, tly, brx, bry, label);
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Label))
			return false;
		Label al = (Label) obj;
		return al.tlx == tlx && al.tly == tly && al.brx == brx && al.bry == bry && label.equals(al.label);
	}

	@Override
	public int hashCode() {
		return label.hashCode();
	}

	public double getTlx() {
		return tlx;
	}

	public double getTly() {
		return tly;
	}

	public double getBrx() {
		return brx;
	}

	public double getBry() {
		return bry;
	}

	public boolean intersectWith(Label candidate) {
		double maxtlx = Math.max(tlx, candidate.tlx);
		double maxtly = Math.max(tly, candidate.tly);
		double minbrx = Math.min(brx, candidate.brx);
		double minbry = Math.min(bry, candidate.bry);
		return maxtlx <= minbrx || maxtly <= minbry;
		// (maxtlx,maxtly) - (minbrx,minbry)

		// return !(tlx < candidate.brx && brx > candidate.tlx && tly > candidate.bry && bry < candidate.tly);
	}

	public Label normalize(double mintlx, double mintly, double width, double height) {
		System.out.println(mintlx + " " + mintly + " " + width + " " + height);
		return new Label((tlx - mintlx) / width, (tly - mintly) / height, (brx - mintlx) / width, (bry - mintly) / height, label);
	}
}<commit_msg>gs-ir: Label: Fix intersectWith<commit_after>package org.genericsystem.ir.reinforcer;

public class Label {
	private final double tlx, tly, brx, bry;
	private final String label;

	public Label(double tlx, double tly, double brx, double bry, String label) {
		assert tlx < brx && tly < bry;
		this.tlx = tlx;
		this.tly = tly;
		this.brx = brx;
		this.bry = bry;
		this.label = label;
	}

	@Override
	public String toString() {
		return String.format("tl(%.1f, %.1f), br(%.1f, %.1f), %s", tlx, tly, brx, bry, label);
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Label))
			return false;
		Label al = (Label) obj;
		return al.tlx == tlx && al.tly == tly && al.brx == brx && al.bry == bry && label.equals(al.label);
	}

	@Override
	public int hashCode() {
		return label.hashCode();
	}

	public double getTlx() {
		return tlx;
	}

	public double getTly() {
		return tly;
	}

	public double getBrx() {
		return brx;
	}

	public double getBry() {
		return bry;
	}

	public boolean intersectWith(Label candidate) {
		return tlx < candidate.brx && candidate.tlx < brx && tly < candidate.bry && candidate.bry < bry;
	}

		// return !(tlx < candidate.brx && brx > candidate.tlx && tly > candidate.bry && bry < candidate.tly);
	}

	public Label normalize(double mintlx, double mintly, double width, double height) {
		System.out.println(mintlx + " " + mintly + " " + width + " " + height);
		return new Label((tlx - mintlx) / width, (tly - mintly) / height, (brx - mintlx) / width, (bry - mintly) / height, label);
	}
}
{'fraction_non_alphanumeric': 0.1522544780728845, 'fraction_numerical': 0.0024706609017912293, 'mean_word_length': 3.377027027027027, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 7, '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': '6271023', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1226, 'n_words': 335}