<commit_before>package com.htssoft.sploosh.space.bh;

import java.util.ArrayList;
import java.util.Collection;

import com.jme3.math.Vector3f;

/**
 * A Barnes-Hutt tree.
 * */
public abstract class BHTree<BODY_T extends Body> {
	
	/**
	 * The body for this cell.
	 * */
	protected BODY_T body;
	protected ArrayList<BODY_T> overflowList = new ArrayList<BODY_T>();
	
	/**
	 * The split point of this BHTree.
	 * */
	protected Vector3f splitPoint = new Vector3f();
	
	/**
	 * Cell minimum.
	 * */
	public Vector3f cellMin = new Vector3f();
	
	/**
	 * Cell maximum.
	 * */
	public Vector3f cellMax = new Vector3f();
	
	/**
	 * The half length of a cube extent.
	 * */
	protected float areaWidth;
	
	/**
	 * Children of this node.
	 * */
	BHTree<BODY_T>[] children = null;
	
	public BHTree(Vector3f min, Vector3f max){
		this.cellMax.set(max);
		this.cellMin.set(min);
		areaWidth = Math.max(Math.max(cellMax.x - cellMin.x, cellMax.y - cellMin.y), cellMax.z - cellMax.z);
		
		splitPoint.interpolate(cellMin, cellMax, 0.5f);
	}
	
	/**
	 * Is this a leaf node?
	 * */
	public boolean isLeaf(){
		return children == null;
	}
	
	/**
	 * Do we have a body already?
	 * */
	public boolean hasBody(){
		return body != null;
	}
	
	/**
	 * A body has been added through this branch
	 * of the tree.
	 * */
	public boolean isTouched(){
		return hasBody() || !isLeaf();
	}
	
	/**
	 * Get influential bodies.
	 * */
	public void getInfluential(Vector3f pos, float theta, Collection<BODY_T> storage){
		if (!isTouched()){
			return;
		}
		
		float d = getSuperPosition().distance(pos);
		float s_d = areaWidth / d;<commit_msg>Micro-optimization of isTouched() in BHTree.<commit_after>package com.htssoft.sploosh.space.bh;

import java.util.ArrayList;
import java.util.Collection;

import com.jme3.math.Vector3f;

/**
 * A Barnes-Hutt tree.
 * */
public abstract class BHTree<BODY_T extends Body> {
	
	/**
	 * The body for this cell.
	 * */
	protected BODY_T body;
	protected ArrayList<BODY_T> overflowList = new ArrayList<BODY_T>();
	
	/**
	 * The split point of this BHTree.
	 * */
	protected Vector3f splitPoint = new Vector3f();
	
	/**
	 * Cell minimum.
	 * */
	public Vector3f cellMin = new Vector3f();
	
	/**
	 * Cell maximum.
	 * */
	public Vector3f cellMax = new Vector3f();
	
	/**
	 * The half length of a cube extent.
	 * */
	protected float areaWidth;
	
	/**
	 * Children of this node.
	 * */
	BHTree<BODY_T>[] children = null;
	
	public BHTree(Vector3f min, Vector3f max){
		this.cellMax.set(max);
		this.cellMin.set(min);
		areaWidth = Math.max(Math.max(cellMax.x - cellMin.x, cellMax.y - cellMin.y), cellMax.z - cellMax.z);
		
		splitPoint.interpolate(cellMin, cellMax, 0.5f);
	}
	
	/**
	 * Is this a leaf node?
	 * */
	public boolean isLeaf(){
		return children == null;
	}
	
	/**
	 * Do we have a body already?
	 * */
	public boolean hasBody(){
		return body != null;
	}
	
	/**
	 * A body has been added through this branch
	 * of the tree.
	 * */
	public boolean isTouched(){
		return !isLeaf() || hasBody();
	}
	
	/**
	 * Get influential bodies.
	 * */
	public void getInfluential(Vector3f pos, float theta, Collection<BODY_T> storage){
		if (!isTouched()){
			return;
		}
		
		float d = getSuperPosition().distance(pos);
		float s_d = areaWidth / d;
{'fraction_non_alphanumeric': 0.14334051061211936, 'fraction_numerical': 0.007997539218701938, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6192414', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1123, 'n_words': 303}