<commit_before>package org.andengine.opengl.vbo;

import java.util.ArrayList;

import org.andengine.opengl.util.GLState;

/**
 * (c) 2010 <NAME>
 * (c) 2011 Zynga Inc.
 * 
 * @author <NAME>
 * @since 17:48:46 - 08.03.2010
 */
public class VertexBufferObjectManager {
	// ===========================================================
	// Constants
	// ===========================================================

	// ===========================================================
	// Fields
	// ===========================================================

	private final ArrayList<VertexBufferObject> mVertexBufferObjectsLoaded = new ArrayList<VertexBufferObject>();

	private final ArrayList<VertexBufferObject> mVertexBufferObjectsToBeUnloaded = new ArrayList<VertexBufferObject>();

	// ===========================================================
	// Constructors
	// ===========================================================

	// ===========================================================
	// Getter & Setter
	// ===========================================================

	public synchronized int getByteSize() {
		int byteSize = 0;
		final ArrayList<VertexBufferObject> vertexBufferObjectsLoaded = this.mVertexBufferObjectsLoaded;
		for(int i = vertexBufferObjectsLoaded.size() - 1; i >= 0; i--) {
			byteSize += vertexBufferObjectsLoaded.get(i).getByteCapacity();
		}
		return byteSize;
	}

	// ===========================================================
	// Methods for/from SuperClass/Interfaces
	// ===========================================================

	// ===========================================================
	// Methods
	// ===========================================================

	public void onCreate() {

	}

	public synchronized void onDestroy() {
		final ArrayList<VertexBufferObject> vertexBufferObjectsLoaded = this.mVertexBufferObjectsLoaded;
		for(int i = vertexBufferObjectsLoaded.size() - 1; i >= 0; i--) {
			vertexBufferObjectsLoaded.get(i).setNotLoadedToHardware();
		}

		this.mVertexBufferObjectsLoaded.clear();
	}

	public synchronized void onVertexBufferObjectLoaded(final VertexBufferObject pVertexBufferObject) {
		this.mVertexBufferObjectsLoaded.add(pVertexBufferObject);
	}

	public synchronized void onUnloadVertexBufferObject(final VertexBufferObject pVertexBufferObject) {
		if(this.mVertexBufferObjectsLoaded.remove(pVertexBufferObject)) {
			this.mVertexBufferObjectsToBeUnloaded.add(pVertexBufferObject);
		}
	}

	public synchronized void onReload() {
		final ArrayList<VertexBufferObject> vertexBufferObjectsLoaded = this.mVertexBufferObjectsLoaded;
		for(int i = vertexBufferObjectsLoaded.size() - 1; i >= 0; i--) {
			vertexBufferObjectsLoaded.get(i).setNotLoadedToHardware();
		}

		vertexBufferObjectsLoaded.clear();
	}

	public synchronized void updateVertexBufferObjects(final GLState pGLState) {
		final ArrayList<VertexBufferObject> vertexBufferObjectsLoaded = this.mVertexBufferObjectsLoaded;
		final ArrayList<VertexBufferObject> vertexBufferObjectsToBeUnloaded = this.mVertexBufferObjectsToBeUnloaded;
<commit_msg>Fixed VertexBufferObjectManager to take IVertexBufferObject instead of VertexBufferObject as parameters. (Thx to <NAME>)<commit_after>package org.andengine.opengl.vbo;

import java.util.ArrayList;

import org.andengine.opengl.util.GLState;

/**
 * (c) 2010 <NAME>
 * (c) 2011 Zynga Inc.
 * 
 * @author <NAME>
 * @since 17:48:46 - 08.03.2010
 */
public class VertexBufferObjectManager {
	// ===========================================================
	// Constants
	// ===========================================================

	// ===========================================================
	// Fields
	// ===========================================================

	private final ArrayList<IVertexBufferObject> mVertexBufferObjectsLoaded = new ArrayList<IVertexBufferObject>();

	private final ArrayList<IVertexBufferObject> mVertexBufferObjectsToBeUnloaded = new ArrayList<IVertexBufferObject>();

	// ===========================================================
	// Constructors
	// ===========================================================

	// ===========================================================
	// Getter & Setter
	// ===========================================================

	public synchronized int getByteSize() {
		int byteSize = 0;
		final ArrayList<IVertexBufferObject> vertexBufferObjectsLoaded = this.mVertexBufferObjectsLoaded;
		for(int i = vertexBufferObjectsLoaded.size() - 1; i >= 0; i--) {
			byteSize += vertexBufferObjectsLoaded.get(i).getByteCapacity();
		}
		return byteSize;
	}

	// ===========================================================
	// Methods for/from SuperClass/Interfaces
	// ===========================================================

	// ===========================================================
	// Methods
	// ===========================================================

	public void onCreate() {

	}

	public synchronized void onDestroy() {
		final ArrayList<IVertexBufferObject> vertexBufferObjectsLoaded = this.mVertexBufferObjectsLoaded;
		for(int i = vertexBufferObjectsLoaded.size() - 1; i >= 0; i--) {
			vertexBufferObjectsLoaded.get(i).setNotLoadedToHardware();
		}

		this.mVertexBufferObjectsLoaded.clear();
	}

	public synchronized void onVertexBufferObjectLoaded(final IVertexBufferObject pVertexBufferObject) {
		this.mVertexBufferObjectsLoaded.add(pVertexBufferObject);
	}

	public synchronized void onUnloadVertexBufferObject(final IVertexBufferObject pVertexBufferObject) {
		if(this.mVertexBufferObjectsLoaded.remove(pVertexBufferObject)) {
			this.mVertexBufferObjectsToBeUnloaded.add(pVertexBufferObject);
		}
	}

	public synchronized void onReload() {
		final ArrayList<IVertexBufferObject> vertexBufferObjectsLoaded = this.mVertexBufferObjectsLoaded;
		for(int i = vertexBufferObjectsLoaded.size() - 1; i >= 0; i--) {
			vertexBufferObjectsLoaded.get(i).setNotLoadedToHardware();
		}

		vertexBufferObjectsLoaded.clear();
	}

	public synchronized void updateVertexBufferObjects(final GLState pGLState) {
		final ArrayList<IVertexBufferObject> vertexBufferObjectsLoaded = this.mVertexBufferObjectsLoaded;
		final ArrayList<IVertexBufferObject> vertexBufferObjectsToBeUnloaded = this.mVertexBufferObjectsToBeUnloaded;

{'fraction_non_alphanumeric': 0.3048392231773321, 'fraction_numerical': 0.009232728430436167, 'mean_word_length': 6.680929095354523, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 32, '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': '5449525', 'n_tokens_mistral': 1713, 'n_tokens_neox': 1512, 'n_words': 272}