<commit_before>package com.ezardlabs.lostsector.objects.environment;

import com.ezardlabs.dethsquare.Animation;
import com.ezardlabs.dethsquare.AnimationType;
import com.ezardlabs.dethsquare.Collider;
import com.ezardlabs.dethsquare.GameObject;
import com.ezardlabs.dethsquare.Script;
import com.ezardlabs.dethsquare.TextureAtlas;
import com.ezardlabs.dethsquare.TextureAtlas.Sprite;
import com.ezardlabs.dethsquare.Vector2;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentHashMap.KeySetView;

public class Door extends Script {
	private final TextureAtlas ta;

	public Door(TextureAtlas ta) {
		this.ta = ta;
	}

	@Override
	public void start() {
		gameObject.renderer.setTextureAtlas(ta, 200, 500);
		gameObject.renderer.setSprite(getInitialSprite(ta));
		gameObject.animator.addAnimations(getOpenAnimation(ta), getCloseAnimation(ta));
		GameObject.instantiate(
				new GameObject("DoorCollider", true, new Collider(64 * 3.125f, 32 * 3.125f)),
				new Vector2(transform.position));
		GameObject.instantiate(
				new GameObject("DoorCollider", true, new Collider(64 * 3.125f, 32 * 3.125f)),
				transform.position.offset(0, 128 * 3.125f));
		GameObject.instantiate(new GameObject("DoorDetection", new Collider(1200, 500, true),
				new DoorDetection(this)), transform.position.offset(-500, 0));
	}

	private void open() {
		gameObject.animator.play("open");
		gameObject.setTag(null);
	}

	private void close() {
		gameObject.animator.play("close");
		gameObject.setTag("solid");
	}

	protected Animation getOpenAnimation(TextureAtlas ta) {
		return new Animation("open", new Sprite[]{ta.getSprite("door0"),
				ta.getSprite("door1"),
				ta.getSprite("door2"),
				ta.getSprite("door3"),
				ta.getSprite("door4"),
				ta.getSprite("door5"),
				ta.getSprite("door6")}, AnimationType.ONE_SHOT, 80);
	}

	protected Animation getCloseAnimation(TextureAtlas ta) {
		return new Animation("close", new Sprite[]{ta.getSprite("door6"),
				ta.getSprite("door5"),
				ta.getSprite("door4"),
				ta.getSprite("door3"),
				ta.getSprite("door2"),
				ta.getSprite("door1"),
				ta.getSprite("door0")}, AnimationType.ONE_SHOT, 80);
	}

	protected Sprite getInitialSprite(TextureAtlas ta) {
		return ta.getSprite("door0");
	}

	private class DoorDetection extends Script {
		private final Door door;
		private KeySetView<Collider, Boolean> colliders = ConcurrentHashMap.newKeySet();

		private DoorDetection(Door door) {
			this.door = door;
		}

		@Override
		public void update() {
			colliders.stream()
					 .filter(collider -> !gameObject.collider.bounds.contains(collider.bounds) &&
							 !gameObject.collider.bounds.intersects(collider.bounds))
					 .forEach(collider -> colliders.remove(collider));
			if (colliders.size() > 0) {
				door.open();
			} else {
				door.close();
			}
		}

		@Override
		public void onTriggerEnter(Collider other) {
			if (other.gameObject.getTag().equals("player") ||
					other.gameObject.getTag().equals("enemy")) {
				colliders.add(other);
			}
		}
	}
}<commit_msg>Make sure the GameObject's tag is not null before trying to compare it<commit_after>package com.ezardlabs.lostsector.objects.environment;

import com.ezardlabs.dethsquare.Animation;
import com.ezardlabs.dethsquare.AnimationType;
import com.ezardlabs.dethsquare.Collider;
import com.ezardlabs.dethsquare.GameObject;
import com.ezardlabs.dethsquare.Script;
import com.ezardlabs.dethsquare.TextureAtlas;
import com.ezardlabs.dethsquare.TextureAtlas.Sprite;
import com.ezardlabs.dethsquare.Vector2;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentHashMap.KeySetView;

public class Door extends Script {
	private final TextureAtlas ta;

	public Door(TextureAtlas ta) {
		this.ta = ta;
	}

	@Override
	public void start() {
		gameObject.renderer.setTextureAtlas(ta, 200, 500);
		gameObject.renderer.setSprite(getInitialSprite(ta));
		gameObject.animator.addAnimations(getOpenAnimation(ta), getCloseAnimation(ta));
		GameObject.instantiate(
				new GameObject("DoorCollider", true, new Collider(64 * 3.125f, 32 * 3.125f)),
				new Vector2(transform.position));
		GameObject.instantiate(
				new GameObject("DoorCollider", true, new Collider(64 * 3.125f, 32 * 3.125f)),
				transform.position.offset(0, 128 * 3.125f));
		GameObject.instantiate(new GameObject("DoorDetection", new Collider(1200, 500, true),
				new DoorDetection(this)), transform.position.offset(-500, 0));
	}

	private void open() {
		gameObject.animator.play("open");
		gameObject.setTag(null);
	}

	private void close() {
		gameObject.animator.play("close");
		gameObject.setTag("solid");
	}

	protected Animation getOpenAnimation(TextureAtlas ta) {
		return new Animation("open", new Sprite[]{ta.getSprite("door0"),
				ta.getSprite("door1"),
				ta.getSprite("door2"),
				ta.getSprite("door3"),
				ta.getSprite("door4"),
				ta.getSprite("door5"),
				ta.getSprite("door6")}, AnimationType.ONE_SHOT, 80);
	}

	protected Animation getCloseAnimation(TextureAtlas ta) {
		return new Animation("close", new Sprite[]{ta.getSprite("door6"),
				ta.getSprite("door5"),
				ta.getSprite("door4"),
				ta.getSprite("door3"),
				ta.getSprite("door2"),
				ta.getSprite("door1"),
				ta.getSprite("door0")}, AnimationType.ONE_SHOT, 80);
	}

	protected Sprite getInitialSprite(TextureAtlas ta) {
		return ta.getSprite("door0");
	}

	private class DoorDetection extends Script {
		private final Door door;
		private KeySetView<Collider, Boolean> colliders = ConcurrentHashMap.newKeySet();

		private DoorDetection(Door door) {
			this.door = door;
		}

		@Override
		public void update() {
			colliders.stream()
					 .filter(collider -> !gameObject.collider.bounds.contains(collider.bounds) &&
							 !gameObject.collider.bounds.intersects(collider.bounds))
					 .forEach(collider -> colliders.remove(collider));
			if (colliders.size() > 0) {
				door.open();
			} else {
				door.close();
			}
		}

		@Override
		public void onTriggerEnter(Collider other) {
			if (other.gameObject.getTag() != null && other.gameObject.getTag().equals("player") ||
					other.gameObject.getTag().equals("enemy")) {
				colliders.add(other);
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.13848396501457727, 'fraction_numerical': 0.022999676060900552, 'mean_word_length': 4.754892823858341, 'pattern_counts': {'":': 0, '<': 5, '<?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': '258982', 'n_tokens_mistral': 2397, 'n_tokens_neox': 2070, 'n_words': 360}